diff --git a/TP03/TP03/bin/Activate.ps1 b/TP03/TP03/bin/Activate.ps1
new file mode 100644
index 0000000000000000000000000000000000000000..2fb3852c3cf1a565ccf813f876a135ecf6f99712
--- /dev/null
+++ b/TP03/TP03/bin/Activate.ps1
@@ -0,0 +1,241 @@
+<#
+.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/TP03/TP03/bin/activate b/TP03/TP03/bin/activate
new file mode 100644
index 0000000000000000000000000000000000000000..725ef919ae95d80dfd7a9487d79efa82d76a4579
--- /dev/null
+++ b/TP03/TP03/bin/activate
@@ -0,0 +1,66 @@
+# 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 2> /dev/null
+    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/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03"
+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:-}"
+    PS1="(TP03) ${PS1:-}"
+    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 2> /dev/null
+fi
diff --git a/TP03/TP03/bin/activate.csh b/TP03/TP03/bin/activate.csh
new file mode 100644
index 0000000000000000000000000000000000000000..ab8642f3decb9a85b7322f3b41604b8c914a5597
--- /dev/null
+++ b/TP03/TP03/bin/activate.csh
@@ -0,0 +1,25 @@
+# This file must be used with "source bin/activate.csh" *from csh*.
+# You cannot run it directly.
+# Created by Davide Di Blasi <davidedb@gmail.com>.
+# Ported to Python 3.3 venv by Andrew Svetlov <andrew.svetlov@gmail.com>
+
+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/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03"
+
+set _OLD_VIRTUAL_PATH="$PATH"
+setenv PATH "$VIRTUAL_ENV/bin:$PATH"
+
+
+set _OLD_VIRTUAL_PROMPT="$prompt"
+
+if (! "$?VIRTUAL_ENV_DISABLE_PROMPT") then
+    set prompt = "(TP03) $prompt"
+endif
+
+alias pydoc python -m pydoc
+
+rehash
diff --git a/TP03/TP03/bin/activate.fish b/TP03/TP03/bin/activate.fish
new file mode 100644
index 0000000000000000000000000000000000000000..d51cefc66c9f7d457ff2e7b2ab8efc6408f7c208
--- /dev/null
+++ b/TP03/TP03/bin/activate.fish
@@ -0,0 +1,64 @@
+# This file must be used with "source <venv>/bin/activate.fish" *from fish*
+# (https://fishshell.com/); you cannot run it directly.
+
+function deactivate  -d "Exit virtual environment 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/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03"
+
+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
+
+        # Output the venv prompt; color taken from the blue of the Python logo.
+        printf "%s%s%s" (set_color 4B8BBE) "(TP03) " (set_color normal)
+
+        # Restore the return status of the previous command.
+        echo "exit $old_status" | .
+        # Output the original/"old" prompt.
+        _old_fish_prompt
+    end
+
+    set -gx _OLD_FISH_PROMPT_OVERRIDE "$VIRTUAL_ENV"
+end
diff --git a/TP03/TP03/bin/easy_install b/TP03/TP03/bin/easy_install
new file mode 100755
index 0000000000000000000000000000000000000000..db0e26d398ce003a0450e77743c0c485ecced291
--- /dev/null
+++ b/TP03/TP03/bin/easy_install
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/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/TP03/TP03/bin/easy_install-3.9 b/TP03/TP03/bin/easy_install-3.9
new file mode 100755
index 0000000000000000000000000000000000000000..db0e26d398ce003a0450e77743c0c485ecced291
--- /dev/null
+++ b/TP03/TP03/bin/easy_install-3.9
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/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/TP03/TP03/bin/fab b/TP03/TP03/bin/fab
new file mode 100755
index 0000000000000000000000000000000000000000..9f5149348a61206d6e8b7bb05737994a472399da
--- /dev/null
+++ b/TP03/TP03/bin/fab
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+# -*- coding: utf-8 -*-
+import re
+import sys
+from fabric.main import program
+if __name__ == '__main__':
+    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+    sys.exit(program.run())
diff --git a/TP03/TP03/bin/humanfriendly b/TP03/TP03/bin/humanfriendly
new file mode 100755
index 0000000000000000000000000000000000000000..28f59df68f83c3d212fbdfeab68c04ecb441142c
--- /dev/null
+++ b/TP03/TP03/bin/humanfriendly
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+# -*- coding: utf-8 -*-
+import re
+import sys
+from humanfriendly.cli import main
+if __name__ == '__main__':
+    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+    sys.exit(main())
diff --git a/TP03/TP03/bin/inv b/TP03/TP03/bin/inv
new file mode 100755
index 0000000000000000000000000000000000000000..64ef3632b090c66aeafeaf963d7517e7756424ec
--- /dev/null
+++ b/TP03/TP03/bin/inv
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+# -*- coding: utf-8 -*-
+import re
+import sys
+from invoke.main import program
+if __name__ == '__main__':
+    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+    sys.exit(program.run())
diff --git a/TP03/TP03/bin/invoke b/TP03/TP03/bin/invoke
new file mode 100755
index 0000000000000000000000000000000000000000..64ef3632b090c66aeafeaf963d7517e7756424ec
--- /dev/null
+++ b/TP03/TP03/bin/invoke
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+# -*- coding: utf-8 -*-
+import re
+import sys
+from invoke.main import program
+if __name__ == '__main__':
+    sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
+    sys.exit(program.run())
diff --git a/TP03/TP03/bin/pip b/TP03/TP03/bin/pip
new file mode 100755
index 0000000000000000000000000000000000000000..042b996e0f4294dbafccd92d8b5480a23af816e2
--- /dev/null
+++ b/TP03/TP03/bin/pip
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/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/TP03/TP03/bin/pip3 b/TP03/TP03/bin/pip3
new file mode 100755
index 0000000000000000000000000000000000000000..042b996e0f4294dbafccd92d8b5480a23af816e2
--- /dev/null
+++ b/TP03/TP03/bin/pip3
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/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/TP03/TP03/bin/pip3.9 b/TP03/TP03/bin/pip3.9
new file mode 100755
index 0000000000000000000000000000000000000000..042b996e0f4294dbafccd92d8b5480a23af816e2
--- /dev/null
+++ b/TP03/TP03/bin/pip3.9
@@ -0,0 +1,8 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/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/TP03/TP03/bin/python b/TP03/TP03/bin/python
new file mode 120000
index 0000000000000000000000000000000000000000..b8a0adbbb97ea11f36eb0c6b2a3c2881e96f8e26
--- /dev/null
+++ b/TP03/TP03/bin/python
@@ -0,0 +1 @@
+python3
\ No newline at end of file
diff --git a/TP03/TP03/bin/python3 b/TP03/TP03/bin/python3
new file mode 120000
index 0000000000000000000000000000000000000000..ae65fdaa12936b0d7525b090d198249fa7623e66
--- /dev/null
+++ b/TP03/TP03/bin/python3
@@ -0,0 +1 @@
+/usr/bin/python3
\ No newline at end of file
diff --git a/TP03/TP03/bin/python3.9 b/TP03/TP03/bin/python3.9
new file mode 120000
index 0000000000000000000000000000000000000000..b8a0adbbb97ea11f36eb0c6b2a3c2881e96f8e26
--- /dev/null
+++ b/TP03/TP03/bin/python3.9
@@ -0,0 +1 @@
+python3
\ No newline at end of file
diff --git a/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/LICENSE.rst b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/LICENSE.rst
new file mode 100644
index 0000000000000000000000000000000000000000..191ddaf31642db9d52a7f32826043c6550c299d8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/LICENSE.rst
@@ -0,0 +1,21 @@
+The MIT License (MIT)
+
+Copyright (c) 2017 Laurent LAPORTE
+
+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/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..9ecede23e0fc3c0ecea8945ab82322890d133e74
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/METADATA
@@ -0,0 +1,181 @@
+Metadata-Version: 2.1
+Name: Deprecated
+Version: 1.2.14
+Summary: Python @deprecated decorator to deprecate old python classes, functions or methods.
+Home-page: https://github.com/tantale/deprecated
+Author: Laurent LAPORTE
+Author-email: tantale.solutions@gmail.com
+License: MIT
+Project-URL: Documentation, https://deprecated.readthedocs.io/en/latest/
+Project-URL: Source, https://github.com/tantale/deprecated
+Project-URL: Bug Tracker, https://github.com/tantale/deprecated/issues
+Keywords: deprecate,deprecated,deprecation,warning,warn,decorator
+Platform: any
+Classifier: Development Status :: 5 - Production/Stable
+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 :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+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 :: 3.12
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+Description-Content-Type: text/x-rst
+License-File: LICENSE.rst
+Requires-Dist: wrapt (<2,>=1.10)
+Provides-Extra: dev
+Requires-Dist: tox ; extra == 'dev'
+Requires-Dist: PyTest ; extra == 'dev'
+Requires-Dist: PyTest-Cov ; extra == 'dev'
+Requires-Dist: bump2version (<1) ; extra == 'dev'
+Requires-Dist: sphinx (<2) ; extra == 'dev'
+
+
+Deprecated Library
+------------------
+
+Deprecated is Easy to Use
+`````````````````````````
+
+If you need to mark a function or a method as deprecated,
+you can use the ``@deprecated`` decorator:
+
+Save in a hello.py:
+
+.. code:: python
+
+    from deprecated import deprecated
+
+
+    @deprecated(version='1.2.1', reason="You should use another function")
+    def some_old_function(x, y):
+        return x + y
+
+
+    class SomeClass(object):
+        @deprecated(version='1.3.0', reason="This method is deprecated")
+        def some_old_method(self, x, y):
+            return x + y
+
+
+    some_old_function(12, 34)
+    obj = SomeClass()
+    obj.some_old_method(5, 8)
+
+
+And Easy to Setup
+`````````````````
+
+And run it:
+
+.. code:: bash
+
+    $ pip install Deprecated
+    $ python hello.py
+    hello.py:15: DeprecationWarning: Call to deprecated function (or staticmethod) some_old_function.
+    (You should use another function) -- Deprecated since version 1.2.0.
+      some_old_function(12, 34)
+    hello.py:17: DeprecationWarning: Call to deprecated method some_old_method.
+    (This method is deprecated) -- Deprecated since version 1.3.0.
+      obj.some_old_method(5, 8)
+
+
+You can document your code
+``````````````````````````
+
+Have you ever wonder how to document that some functions, classes, methods, etc. are deprecated?
+This is now possible with the integrated Sphinx directives:
+
+For instance, in hello_sphinx.py:
+
+.. code:: python
+
+    from deprecated.sphinx import deprecated
+    from deprecated.sphinx import versionadded
+    from deprecated.sphinx import versionchanged
+
+
+    @versionadded(version='1.0', reason="This function is new")
+    def function_one():
+        '''This is the function one'''
+
+
+    @versionchanged(version='1.0', reason="This function is modified")
+    def function_two():
+        '''This is the function two'''
+
+
+    @deprecated(version='1.0', reason="This function will be removed soon")
+    def function_three():
+        '''This is the function three'''
+
+
+    function_one()
+    function_two()
+    function_three()  # warns
+
+    help(function_one)
+    help(function_two)
+    help(function_three)
+
+
+The result it immediate
+```````````````````````
+
+Run it:
+
+.. code:: bash
+
+    $ python hello_sphinx.py
+
+    hello_sphinx.py:23: DeprecationWarning: Call to deprecated function (or staticmethod) function_three.
+    (This function will be removed soon) -- Deprecated since version 1.0.
+      function_three()  # warns
+
+    Help on function function_one in module __main__:
+
+    function_one()
+        This is the function one
+
+        .. versionadded:: 1.0
+           This function is new
+
+    Help on function function_two in module __main__:
+
+    function_two()
+        This is the function two
+
+        .. versionchanged:: 1.0
+           This function is modified
+
+    Help on function function_three in module __main__:
+
+    function_three()
+        This is the function three
+
+        .. deprecated:: 1.0
+           This function will be removed soon
+
+
+Links
+`````
+
+* `Python package index (PyPi) <https://pypi.python.org/pypi/deprecated>`_
+* `GitHub website <https://github.com/tantale/deprecated>`_
+* `Read The Docs <https://readthedocs.org/projects/deprecated>`_
+* `EBook on Lulu.com <http://www.lulu.com/commerce/index.php?fBuyContent=21305117>`_
+* `StackOverFlow Q&A <https://stackoverflow.com/a/40301488/1513933>`_
+* `Development version
+  <https://github.com/tantale/deprecated/zipball/master#egg=Deprecated-dev>`_
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..b3a8e843e7a48fba3ce2d300bb2f1b814bf1e955
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/RECORD
@@ -0,0 +1,12 @@
+Deprecated-1.2.14.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+Deprecated-1.2.14.dist-info/LICENSE.rst,sha256=HoPt0VvkGbXVveNy4yXlJ_9PmRX1SOfHUxS0H2aZ6Dw,1081
+Deprecated-1.2.14.dist-info/METADATA,sha256=xQYvk5nwOfnkxxRD-VHkpE-sMu0IBHRZ8ayspypfkTs,5354
+Deprecated-1.2.14.dist-info/RECORD,,
+Deprecated-1.2.14.dist-info/WHEEL,sha256=a-zpFRIJzOq5QfuhBzbhiA1eHTzNCJn8OdRvhdNX0Rk,110
+Deprecated-1.2.14.dist-info/top_level.txt,sha256=nHbOYawKPQQE5lQl-toUB1JBRJjUyn_m_Mb8RVJ0RjA,11
+deprecated/__init__.py,sha256=ZphiULqDVrESSB0mLV2WA88JyhQxZSK44zuDGbV5k-g,349
+deprecated/__pycache__/__init__.cpython-39.pyc,,
+deprecated/__pycache__/classic.cpython-39.pyc,,
+deprecated/__pycache__/sphinx.cpython-39.pyc,,
+deprecated/classic.py,sha256=QugmUi7IhBvp2nDvMtyWqFDPRR43-9nfSZG1ZJSDpFM,9880
+deprecated/sphinx.py,sha256=NqQ0oKGcVn6yUe23iGbCieCgvWbEDQSPt9QelbXJnDU,10258
diff --git a/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..f771c29b873190987cd5295252cd7430a9c28d71
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/WHEEL
@@ -0,0 +1,6 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.40.0)
+Root-Is-Purelib: true
+Tag: py2-none-any
+Tag: py3-none-any
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9f8d5502dae589d488c5107e99768ae5023bb4ea
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/Deprecated-1.2.14.dist-info/top_level.txt
@@ -0,0 +1 @@
+deprecated
diff --git a/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..91e18a62b67551a4d427e2eaee0d33dcab94e141
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/LICENSE
@@ -0,0 +1,174 @@
+                              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/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..fb216d4e8790acb9ccd057e2b3965accd9afa196
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/METADATA
@@ -0,0 +1,245 @@
+Metadata-Version: 2.1
+Name: PyNaCl
+Version: 1.5.0
+Summary: Python binding to the Networking and Cryptography (NaCl) library
+Home-page: https://github.com/pyca/pynacl/
+Author: The PyNaCl developers
+Author-email: cryptography-dev@python.org
+License: Apache License 2.0
+Platform: UNKNOWN
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+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
+Requires-Python: >=3.6
+Requires-Dist: cffi (>=1.4.1)
+Provides-Extra: docs
+Requires-Dist: sphinx (>=1.6.5) ; extra == 'docs'
+Requires-Dist: sphinx-rtd-theme ; extra == 'docs'
+Provides-Extra: tests
+Requires-Dist: pytest (!=3.3.0,>=3.2.1) ; extra == 'tests'
+Requires-Dist: hypothesis (>=3.27.0) ; extra == 'tests'
+
+===============================================
+PyNaCl: Python binding to the libsodium library
+===============================================
+
+.. image:: https://img.shields.io/pypi/v/pynacl.svg
+    :target: https://pypi.org/project/PyNaCl/
+    :alt: Latest Version
+
+.. image:: https://codecov.io/github/pyca/pynacl/coverage.svg?branch=main
+    :target: https://codecov.io/github/pyca/pynacl?branch=main
+
+.. image:: https://img.shields.io/pypi/pyversions/pynacl.svg
+    :target: https://pypi.org/project/PyNaCl/
+    :alt: Compatible Python Versions
+
+PyNaCl is a Python binding to `libsodium`_, which is a fork of the
+`Networking and Cryptography library`_. These libraries have a stated goal of
+improving usability, security and speed. It supports Python 3.6+ as well as
+PyPy 3.
+
+.. _libsodium: https://github.com/jedisct1/libsodium
+.. _Networking and Cryptography library: https://nacl.cr.yp.to/
+
+Features
+--------
+
+* Digital signatures
+* Secret-key encryption
+* Public-key encryption
+* Hashing and message authentication
+* Password based key derivation and password hashing
+
+`Changelog`_
+------------
+
+.. _Changelog: https://pynacl.readthedocs.io/en/stable/changelog/
+
+Installation
+============
+
+Binary wheel install
+--------------------
+
+PyNaCl ships as a binary wheel on macOS, Windows and Linux ``manylinux1`` [#many]_ ,
+so all dependencies are included. Make sure you have an up-to-date pip
+and run:
+
+.. code-block:: console
+
+    $ pip install pynacl
+
+Faster wheel build
+------------------
+
+You can define the environment variable ``LIBSODIUM_MAKE_ARGS`` to pass arguments to ``make``
+and enable `parallelization`_:
+
+.. code-block:: console
+
+    $ LIBSODIUM_MAKE_ARGS=-j4 pip install pynacl
+
+Linux source build
+------------------
+
+PyNaCl relies on `libsodium`_, a portable C library. A copy is bundled
+with PyNaCl so to install you can run:
+
+.. code-block:: console
+
+    $ pip install pynacl
+
+If you'd prefer to use the version of ``libsodium`` provided by your
+distribution, you can disable the bundled copy during install by running:
+
+.. code-block:: console
+
+    $ SODIUM_INSTALL=system pip install pynacl
+
+.. warning:: Usage of the legacy ``easy_install`` command provided by setuptools
+   is generally discouraged, and is completely unsupported in PyNaCl's case.
+
+.. _parallelization: https://www.gnu.org/software/make/manual/html_node/Parallel.html
+
+.. _libsodium: https://github.com/jedisct1/libsodium
+
+.. [#many] `manylinux1 wheels <https://www.python.org/dev/peps/pep-0513/>`_
+    are built on a baseline linux environment based on Centos 5.11
+    and should work on most x86 and x86_64 glibc based linux environments.
+
+Changelog
+=========
+
+1.5.0 (2022-01-07)
+------------------
+
+* **BACKWARDS INCOMPATIBLE:** Removed support for Python 2.7 and Python 3.5.
+* **BACKWARDS INCOMPATIBLE:** We no longer distribute ``manylinux1``
+  wheels.
+* Added ``manylinux2014``, ``manylinux_2_24``, ``musllinux``, and macOS
+  ``universal2`` wheels (the latter supports macOS ``arm64``).
+* Update ``libsodium`` to 1.0.18-stable (July 25, 2021 release).
+* Add inline type hints.
+
+1.4.0 (2020-05-25)
+------------------
+
+* Update ``libsodium`` to 1.0.18.
+* **BACKWARDS INCOMPATIBLE:** We no longer distribute 32-bit ``manylinux1``
+  wheels. Continuing to produce them was a maintenance burden.
+* Added support for Python 3.8, and removed support for Python 3.4.
+* Add low level bindings for extracting the seed and the public key
+  from crypto_sign_ed25519 secret key
+* Add low level bindings for deterministic random generation.
+* Add ``wheel`` and ``setuptools`` setup_requirements in ``setup.py`` (#485)
+* Fix checks on very slow builders (#481, #495)
+* Add low-level bindings to ed25519 arithmetic functions
+* Update low-level blake2b state implementation
+* Fix wrong short-input behavior of SealedBox.decrypt() (#517)
+* Raise CryptPrefixError exception instead of InvalidkeyError when trying
+  to check a password against a verifier stored in a unknown format (#519)
+* Add support for minimal builds of libsodium. Trying to call functions
+  not available in a minimal build will raise an UnavailableError
+  exception. To compile a minimal build of the bundled libsodium, set
+  the SODIUM_INSTALL_MINIMAL environment variable to any non-empty
+  string (e.g. ``SODIUM_INSTALL_MINIMAL=1``) for setup.
+
+1.3.0 2018-09-26
+----------------
+
+* Added support for Python 3.7.
+* Update ``libsodium`` to 1.0.16.
+* Run and test all code examples in PyNaCl docs through sphinx's
+  doctest builder.
+* Add low-level bindings for chacha20-poly1305 AEAD constructions.
+* Add low-level bindings for the chacha20-poly1305 secretstream constructions.
+* Add low-level bindings for ed25519ph pre-hashed signing construction.
+* Add low-level bindings for constant-time increment and addition
+  on fixed-precision big integers represented as little-endian
+  byte sequences.
+* Add low-level bindings for the ISO/IEC 7816-4 compatible padding API.
+* Add low-level bindings for libsodium's crypto_kx... key exchange
+  construction.
+* Set hypothesis deadline to None in tests/test_pwhash.py to avoid
+  incorrect test failures on slower processor architectures.  GitHub
+  issue #370
+
+1.2.1 - 2017-12-04
+------------------
+
+* Update hypothesis minimum allowed version.
+* Infrastructure: add proper configuration for readthedocs builder
+  runtime environment.
+
+1.2.0 - 2017-11-01
+------------------
+
+* Update ``libsodium`` to 1.0.15.
+* Infrastructure: add jenkins support for automatic build of
+  ``manylinux1`` binary wheels
+* Added support for ``SealedBox`` construction.
+* Added support for ``argon2i`` and ``argon2id`` password hashing constructs
+  and restructured high-level password hashing implementation to expose
+  the same interface for all hashers.
+* Added support for 128 bit ``siphashx24`` variant of ``siphash24``.
+* Added support for ``from_seed`` APIs for X25519 keypair generation.
+* Dropped support for Python 3.3.
+
+1.1.2 - 2017-03-31
+------------------
+
+* reorder link time library search path when using bundled
+  libsodium
+
+1.1.1 - 2017-03-15
+------------------
+
+* Fixed a circular import bug in ``nacl.utils``.
+
+1.1.0 - 2017-03-14
+------------------
+
+* Dropped support for Python 2.6.
+* Added ``shared_key()`` method on ``Box``.
+* You can now pass ``None`` to ``nonce`` when encrypting with ``Box`` or
+  ``SecretBox`` and it will automatically generate a random nonce.
+* Added support for ``siphash24``.
+* Added support for ``blake2b``.
+* Added support for ``scrypt``.
+* Update ``libsodium`` to 1.0.11.
+* Default to the bundled ``libsodium`` when compiling.
+* All raised exceptions are defined mixing-in
+  ``nacl.exceptions.CryptoError``
+
+1.0.1 - 2016-01-24
+------------------
+
+* Fix an issue with absolute paths that prevented the creation of wheels.
+
+1.0 - 2016-01-23
+----------------
+
+* PyNaCl has been ported to use the new APIs available in cffi 1.0+.
+  Due to this change we no longer support PyPy releases older than 2.6.
+* Python 3.2 support has been dropped.
+* Functions to convert between Ed25519 and Curve25519 keys have been added.
+
+0.3.0 - 2015-03-04
+------------------
+
+* The low-level API (`nacl.c.*`) has been changed to match the
+  upstream NaCl C/C++ conventions (as well as those of other NaCl bindings).
+  The order of arguments and return values has changed significantly. To
+  avoid silent failures, `nacl.c` has been removed, and replaced with
+  `nacl.bindings` (with the new argument ordering). If you have code which
+  calls these functions (e.g. `nacl.c.crypto_box_keypair()`), you must review
+  the new docstrings and update your code/imports to match the new
+  conventions.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..abdc9998255ea3ef155e8fdd429c27143de41639
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/RECORD
@@ -0,0 +1,68 @@
+PyNaCl-1.5.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+PyNaCl-1.5.0.dist-info/LICENSE,sha256=0xdK1j5yHUydzLitQyCEiZLTFDabxGMZcgtYAskVP-k,9694
+PyNaCl-1.5.0.dist-info/METADATA,sha256=OJaXCiHgNRywLY9cj3X2euddUPZ4dnyyqAQMU01X4j0,8634
+PyNaCl-1.5.0.dist-info/RECORD,,
+PyNaCl-1.5.0.dist-info/WHEEL,sha256=TIQeZFe3DwXBO5UGlCH1aKpf5Cx6FJLbIUqd-Sq2juI,185
+PyNaCl-1.5.0.dist-info/top_level.txt,sha256=wfdEOI_G2RIzmzsMyhpqP17HUh6Jcqi99to9aHLEslo,13
+nacl/__init__.py,sha256=0IUunzBT8_Jn0DUdHacBExOYeAEMggo8slkfjo7O0XM,1116
+nacl/__pycache__/__init__.cpython-39.pyc,,
+nacl/__pycache__/encoding.cpython-39.pyc,,
+nacl/__pycache__/exceptions.cpython-39.pyc,,
+nacl/__pycache__/hash.cpython-39.pyc,,
+nacl/__pycache__/hashlib.cpython-39.pyc,,
+nacl/__pycache__/public.cpython-39.pyc,,
+nacl/__pycache__/secret.cpython-39.pyc,,
+nacl/__pycache__/signing.cpython-39.pyc,,
+nacl/__pycache__/utils.cpython-39.pyc,,
+nacl/_sodium.abi3.so,sha256=uJ6RwSnbb9wO4esR0bVUqrfFHtBOGm34IQIdmaE1fGY,2740136
+nacl/bindings/__init__.py,sha256=BDlStrds2EuUS4swOL4pnf92PWVS_CHRCptX3KhEX-s,16997
+nacl/bindings/__pycache__/__init__.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_aead.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_box.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_core.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_generichash.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_hash.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_kx.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_pwhash.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_scalarmult.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_secretbox.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_secretstream.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_shorthash.cpython-39.pyc,,
+nacl/bindings/__pycache__/crypto_sign.cpython-39.pyc,,
+nacl/bindings/__pycache__/randombytes.cpython-39.pyc,,
+nacl/bindings/__pycache__/sodium_core.cpython-39.pyc,,
+nacl/bindings/__pycache__/utils.cpython-39.pyc,,
+nacl/bindings/crypto_aead.py,sha256=BIw1k_JCfr5ylZk0RF5rCFIM1fhfLkEa-aiWkrfffNE,15597
+nacl/bindings/crypto_box.py,sha256=Ox0NG2t4MsGhBAa7Kgah4o0gc99ULMsqkdX56ofOouY,10139
+nacl/bindings/crypto_core.py,sha256=6u9G3y7H-QrawO785UkFFFtwDoCkeHE63GOUl9p5-eA,13736
+nacl/bindings/crypto_generichash.py,sha256=9mX0DGIIzicr-uXrqFM1nU4tirasbixDwbcdfV7W1fc,8852
+nacl/bindings/crypto_hash.py,sha256=Rg1rsEwE3azhsQT-dNVPA4NB9VogJAKn1EfxYt0pPe0,2175
+nacl/bindings/crypto_kx.py,sha256=oZNVlNgROpHOa1XQ_uZe0tqIkdfuApeJlRnwR23_74k,6723
+nacl/bindings/crypto_pwhash.py,sha256=laVDo4xFUuGyEjtZAU510AklBF6ablBy7Z3HN1WDYjY,18848
+nacl/bindings/crypto_scalarmult.py,sha256=_DX-mst2uCnzjo6fP5HRTnhv1BC95B9gmJc3L_or16g,8244
+nacl/bindings/crypto_secretbox.py,sha256=KgZ1VvkCJDlQ85jtfe9c02VofPvuEgZEhWni-aX3MsM,2914
+nacl/bindings/crypto_secretstream.py,sha256=G0FgZS01qA5RzWzm5Bdms8Yy_lvgdZDoUYYBActPmvQ,11165
+nacl/bindings/crypto_shorthash.py,sha256=PQU7djHTLDGdVs-w_TsivjFHHp5EK5k2Yh6p-6z0T60,2603
+nacl/bindings/crypto_sign.py,sha256=53j2im9E4F79qT_2U8IfCAc3lzg0VMwEjvAPEUccVDg,10342
+nacl/bindings/randombytes.py,sha256=uBK3W4WcjgnjZdWanrX0fjYZpr9KHbBgNMl9rui-Ojc,1563
+nacl/bindings/sodium_core.py,sha256=9Y9CX--sq-TaPaQRPRpx8SWDSS9PJOja_Cqb-yqyJNQ,1039
+nacl/bindings/utils.py,sha256=KDwQnadXeNMbqEA1SmpNyCVo5k8MiUQa07QM66VzfXM,4298
+nacl/encoding.py,sha256=qTAPc2MXSkdh4cqDVY0ra6kHyViHMCmEo_re7cgGk5w,2915
+nacl/exceptions.py,sha256=GZH32aJtZgqCO4uz0LRsev8z0WyvAYuV3YVqT9AAQq4,2451
+nacl/hash.py,sha256=EYBOe6UVc9SUQINEmyuRSa1QGRSvdwdrBzTL1tdFLU8,6392
+nacl/hashlib.py,sha256=L5Fv75St8AMPvb-GhA4YqX5p1mC_Sb4HhC1NxNQMpJA,4400
+nacl/public.py,sha256=RVGCWQRjIJOmW-8sNrVLtsDjMMGx30i6UyfViGCnQNA,14792
+nacl/pwhash/__init__.py,sha256=XSDXd7wQHNLEHl0mkHfVb5lFQsp6ygHkhen718h0BSM,2675
+nacl/pwhash/__pycache__/__init__.cpython-39.pyc,,
+nacl/pwhash/__pycache__/_argon2.cpython-39.pyc,,
+nacl/pwhash/__pycache__/argon2i.cpython-39.pyc,,
+nacl/pwhash/__pycache__/argon2id.cpython-39.pyc,,
+nacl/pwhash/__pycache__/scrypt.cpython-39.pyc,,
+nacl/pwhash/_argon2.py,sha256=jL1ChR9biwYh3RSuc-LJ2-W4DlVLHpir-XHGX8cpeJQ,1779
+nacl/pwhash/argon2i.py,sha256=IIvIuO9siKUu5-Wpz0SGiltLQv7Du_mi9BUE8INRK_4,4405
+nacl/pwhash/argon2id.py,sha256=H22i8O4j9Ws4L3JsXl9TRcJzDcyaVumhQRPzINAgJWM,4433
+nacl/pwhash/scrypt.py,sha256=fMr3Qht1a1EY8aebNNntfLRjinIPXtKYKKrrBhY5LDc,6986
+nacl/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+nacl/secret.py,sha256=kauBNuP-0rb3TjU2EMBMu5Vnmzjnscp1bRqMspy5LzU,12108
+nacl/signing.py,sha256=kbTEUyHLUMaNLv1nCjxzGxCs82Qs5w8gxE_CnEwPuIU,8337
+nacl/utils.py,sha256=gmlTD1x9ZNwzHd8LpALH1CHud-Htv8ejRb3y7TyS9f0,2341
diff --git a/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..b93bb215c339b8e370dd4771640df50ecdf4b751
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/WHEEL
@@ -0,0 +1,7 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.37.1)
+Root-Is-Purelib: false
+Tag: cp36-abi3-manylinux_2_17_x86_64
+Tag: cp36-abi3-manylinux2014_x86_64
+Tag: cp36-abi3-manylinux_2_24_x86_64
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f52507f09b95c1d37c005528f28b345a8af187a4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/PyNaCl-1.5.0.dist-info/top_level.txt
@@ -0,0 +1,2 @@
+_sodium
+nacl
diff --git a/TP03/TP03/lib/python3.9/site-packages/__pycache__/decorator.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/__pycache__/decorator.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5d9bb1bb807b5d1fbc9004b2a2cd83b29a89d1c4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/__pycache__/decorator.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/__pycache__/easy_install.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/__pycache__/easy_install.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b62c600a8cd39196044be9cca6b63bcbf0744efa
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/__pycache__/easy_install.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/_cffi_backend.cpython-39-x86_64-linux-gnu.so b/TP03/TP03/lib/python3.9/site-packages/_cffi_backend.cpython-39-x86_64-linux-gnu.so
new file mode 100755
index 0000000000000000000000000000000000000000..ebf38dc542c6ddf290131ddef52e120d115be093
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/_cffi_backend.cpython-39-x86_64-linux-gnu.so differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..11069edd79019f7dafbe3138841cf289209270dd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/LICENSE
@@ -0,0 +1,201 @@
+                              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/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..789f784fdcda43364b659528260e82f0cf5c5cb3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/METADATA
@@ -0,0 +1,292 @@
+Metadata-Version: 2.1
+Name: bcrypt
+Version: 4.0.1
+Summary: Modern password hashing for your software and your servers
+Home-page: https://github.com/pyca/bcrypt/
+Author: The Python Cryptographic Authority developers
+Author-email: cryptography-dev@python.org
+License: Apache License, Version 2.0
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+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
+Requires-Python: >=3.6
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+Provides-Extra: tests
+Requires-Dist: pytest (!=3.3.0,>=3.2.1) ; extra == 'tests'
+Provides-Extra: typecheck
+Requires-Dist: mypy ; extra == 'typecheck'
+
+bcrypt
+======
+
+.. image:: https://img.shields.io/pypi/v/bcrypt.svg
+    :target: https://pypi.org/project/bcrypt/
+    :alt: Latest Version
+
+.. image:: https://github.com/pyca/bcrypt/workflows/CI/badge.svg?branch=main
+    :target: https://github.com/pyca/bcrypt/actions?query=workflow%3ACI+branch%3Amain
+
+Acceptable password hashing for your software and your servers (but you should
+really use argon2id or scrypt)
+
+
+Installation
+============
+
+To install bcrypt, simply:
+
+.. code:: bash
+
+    $ pip install bcrypt
+
+Note that bcrypt should build very easily on Linux provided you have a C
+compiler and a Rust compiler (the minimum supported Rust version is 1.56.0).
+
+For Debian and Ubuntu, the following command will ensure that the required dependencies are installed:
+
+.. code:: bash
+
+    $ sudo apt-get install build-essential cargo
+
+For Fedora and RHEL-derivatives, the following command will ensure that the required dependencies are installed:
+
+.. code:: bash
+
+    $ sudo yum install gcc cargo
+
+For Alpine, the following command will ensure that the required dependencies are installed:
+
+.. code:: bash
+
+    $ apk add --update musl-dev gcc cargo
+
+
+Alternatives
+============
+
+While bcrypt remains an acceptable choice for password storage, depending on your specific use case you may also want to consider using scrypt (either via `standard library`_ or `cryptography`_) or argon2id via `argon2_cffi`_.
+
+Changelog
+=========
+
+4.0.1
+-----
+
+* We now build PyPy ``manylinux`` wheels.
+* Fixed a bug where passing an invalid ``salt`` to ``checkpw`` could result in
+  a ``pyo3_runtime.PanicException``. It now correctly raises a ``ValueError``.
+
+4.0.0
+-----
+
+* ``bcrypt`` is now implemented in Rust. Users building from source will need
+  to have a Rust compiler available. Nothing will change for users downloading
+  wheels.
+* We no longer ship ``manylinux2010`` wheels. Users should upgrade to the latest
+  ``pip`` to ensure this doesn’t cause issues downloading wheels on their
+  platform. We now ship ``manylinux_2_28`` wheels for users on new enough platforms.
+* ``NUL`` bytes are now allowed in inputs.
+
+
+3.2.2
+-----
+
+* Fixed packaging of ``py.typed`` files in wheels so that ``mypy`` works.
+
+3.2.1
+-----
+
+* Added support for compilation on z/OS
+* The next release of ``bcrypt`` with be 4.0 and it will require Rust at
+  compile time, for users building from source. There will be no additional
+  requirement for users who are installing from wheels. Users on most
+  platforms will be able to obtain a wheel by making sure they have an up to
+  date ``pip``. The minimum supported Rust version will be 1.56.0.
+* This will be the final release for which we ship ``manylinux2010`` wheels.
+  Going forward the minimum supported manylinux ABI for our wheels will be
+  ``manylinux2014``. The vast majority of users will continue to receive
+  ``manylinux`` wheels provided they have an up to date ``pip``.
+
+
+3.2.0
+-----
+
+* Added typehints for library functions.
+* Dropped support for Python versions less than 3.6 (2.7, 3.4, 3.5).
+* Shipped ``abi3`` Windows wheels (requires pip >= 20).
+
+3.1.7
+-----
+
+* Set a ``setuptools`` lower bound for PEP517 wheel building.
+* We no longer distribute 32-bit ``manylinux1`` wheels. Continuing to produce
+  them was a maintenance burden.
+
+3.1.6
+-----
+
+* Added support for compilation on Haiku.
+
+3.1.5
+-----
+
+* Added support for compilation on AIX.
+* Dropped Python 2.6 and 3.3 support.
+* Switched to using ``abi3`` wheels for Python 3. If you are not getting a
+  wheel on a compatible platform please upgrade your ``pip`` version.
+
+3.1.4
+-----
+
+* Fixed compilation with mingw and on illumos.
+
+3.1.3
+-----
+* Fixed a compilation issue on Solaris.
+* Added a warning when using too few rounds with ``kdf``.
+
+3.1.2
+-----
+* Fixed a compile issue affecting big endian platforms.
+* Fixed invalid escape sequence warnings on Python 3.6.
+* Fixed building in non-UTF8 environments on Python 2.
+
+3.1.1
+-----
+* Resolved a ``UserWarning`` when used with ``cffi`` 1.8.3.
+
+3.1.0
+-----
+* Added support for ``checkpw``, a convenience method for verifying a password.
+* Ensure that you get a ``$2y$`` hash when you input a ``$2y$`` salt.
+* Fixed a regression where ``$2a`` hashes were vulnerable to a wraparound bug.
+* Fixed compilation under Alpine Linux.
+
+3.0.0
+-----
+* Switched the C backend to code obtained from the OpenBSD project rather than
+  openwall.
+* Added support for ``bcrypt_pbkdf`` via the ``kdf`` function.
+
+2.0.0
+-----
+* Added support for an adjustible prefix when calling ``gensalt``.
+* Switched to CFFI 1.0+
+
+Usage
+-----
+
+Password Hashing
+~~~~~~~~~~~~~~~~
+
+Hashing and then later checking that a password matches the previous hashed
+password is very simple:
+
+.. code:: pycon
+
+    >>> import bcrypt
+    >>> password = b"super secret password"
+    >>> # Hash a password for the first time, with a randomly-generated salt
+    >>> hashed = bcrypt.hashpw(password, bcrypt.gensalt())
+    >>> # Check that an unhashed password matches one that has previously been
+    >>> # hashed
+    >>> if bcrypt.checkpw(password, hashed):
+    ...     print("It Matches!")
+    ... else:
+    ...     print("It Does not Match :(")
+
+KDF
+~~~
+
+As of 3.0.0 ``bcrypt`` now offers a ``kdf`` function which does ``bcrypt_pbkdf``.
+This KDF is used in OpenSSH's newer encrypted private key format.
+
+.. code:: pycon
+
+    >>> import bcrypt
+    >>> key = bcrypt.kdf(
+    ...     password=b'password',
+    ...     salt=b'salt',
+    ...     desired_key_bytes=32,
+    ...     rounds=100)
+
+
+Adjustable Work Factor
+~~~~~~~~~~~~~~~~~~~~~~
+One of bcrypt's features is an adjustable logarithmic work factor. To adjust
+the work factor merely pass the desired number of rounds to
+``bcrypt.gensalt(rounds=12)`` which defaults to 12):
+
+.. code:: pycon
+
+    >>> import bcrypt
+    >>> password = b"super secret password"
+    >>> # Hash a password for the first time, with a certain number of rounds
+    >>> hashed = bcrypt.hashpw(password, bcrypt.gensalt(14))
+    >>> # Check that a unhashed password matches one that has previously been
+    >>> #   hashed
+    >>> if bcrypt.checkpw(password, hashed):
+    ...     print("It Matches!")
+    ... else:
+    ...     print("It Does not Match :(")
+
+
+Adjustable Prefix
+~~~~~~~~~~~~~~~~~
+
+Another one of bcrypt's features is an adjustable prefix to let you define what
+libraries you'll remain compatible with. To adjust this, pass either ``2a`` or
+``2b`` (the default) to ``bcrypt.gensalt(prefix=b"2b")`` as a bytes object.
+
+As of 3.0.0 the ``$2y$`` prefix is still supported in ``hashpw`` but deprecated.
+
+Maximum Password Length
+~~~~~~~~~~~~~~~~~~~~~~~
+
+The bcrypt algorithm only handles passwords up to 72 characters, any characters
+beyond that are ignored. To work around this, a common approach is to hash a
+password with a cryptographic hash (such as ``sha256``) and then base64
+encode it to prevent NULL byte problems before hashing the result with
+``bcrypt``:
+
+.. code:: pycon
+
+    >>> password = b"an incredibly long password" * 10
+    >>> hashed = bcrypt.hashpw(
+    ...     base64.b64encode(hashlib.sha256(password).digest()),
+    ...     bcrypt.gensalt()
+    ... )
+
+Compatibility
+-------------
+
+This library should be compatible with py-bcrypt and it will run on Python
+3.6+, and PyPy 3.
+
+C Code
+------
+
+This library uses code from OpenBSD.
+
+Security
+--------
+
+``bcrypt`` follows the `same security policy as cryptography`_, if you
+identify a vulnerability, we ask you to contact us privately.
+
+.. _`same security policy as cryptography`: https://cryptography.io/en/latest/security.html
+.. _`standard library`: https://docs.python.org/3/library/hashlib.html#hashlib.scrypt
+.. _`argon2_cffi`: https://argon2-cffi.readthedocs.io
+.. _`cryptography`: https://cryptography.io/en/latest/hazmat/primitives/key-derivation-functions/#cryptography.hazmat.primitives.kdf.scrypt.Scrypt
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..8b18afaa5bd9adc2531867da7a603c646b7684d6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/RECORD
@@ -0,0 +1,13 @@
+bcrypt-4.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+bcrypt-4.0.1.dist-info/LICENSE,sha256=gXPVwptPlW1TJ4HSuG5OMPg-a3h43OGMkZRR1rpwfJA,10850
+bcrypt-4.0.1.dist-info/METADATA,sha256=peZwWFa95xnpp4NiIE7gJkV01CTkbVXIzoEN66SXd3c,8972
+bcrypt-4.0.1.dist-info/RECORD,,
+bcrypt-4.0.1.dist-info/WHEEL,sha256=ZXaM-AC_dnzk1sUAdQV_bMrIMG6zI-GthFaEkNkWsgU,112
+bcrypt-4.0.1.dist-info/top_level.txt,sha256=BkR_qBzDbSuycMzHWE1vzXrfYecAzUVmQs6G2CukqNI,7
+bcrypt/__about__.py,sha256=F7i0CQOa8G3Yjw1T71jQv8yi__Z_4TzLyZJv1GFqVx0,1320
+bcrypt/__init__.py,sha256=EpUdbfHaiHlSoaM-SSUB6MOgNpWOIkS0ZrjxogPIRLM,3781
+bcrypt/__pycache__/__about__.cpython-39.pyc,,
+bcrypt/__pycache__/__init__.cpython-39.pyc,,
+bcrypt/_bcrypt.abi3.so,sha256=_T-y5IrekziUzkYio4hWH7Xzw92XBKewSLd8kmERhGU,1959696
+bcrypt/_bcrypt.pyi,sha256=O-vvHdooGyAxIkdKemVqOzBF5aMhh0evPSaDMgETgEk,214
+bcrypt/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..dc50279d3c651f1ee4224afb098c39f32bd7371d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.37.1)
+Root-Is-Purelib: false
+Tag: cp36-abi3-manylinux_2_28_x86_64
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..7f0b6e759aaaf6034eb8451960128a353d92c29f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt-4.0.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+bcrypt
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/__about__.py b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__about__.py
new file mode 100644
index 0000000000000000000000000000000000000000..020b748ec4bfe6c485e62a2f100e20c6df2bf6a5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__about__.py
@@ -0,0 +1,41 @@
+# Author:: Donald Stufft (<donald@stufft.io>)
+# Copyright:: Copyright (c) 2013 Donald Stufft
+# License:: Apache License, Version 2.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.
+from __future__ import absolute_import
+from __future__ import division
+from __future__ import unicode_literals
+
+__all__ = [
+    "__title__",
+    "__summary__",
+    "__uri__",
+    "__version__",
+    "__author__",
+    "__email__",
+    "__license__",
+    "__copyright__",
+]
+
+__title__ = "bcrypt"
+__summary__ = "Modern password hashing for your software and your servers"
+__uri__ = "https://github.com/pyca/bcrypt/"
+
+__version__ = "4.0.1"
+
+__author__ = "The Python Cryptographic Authority developers"
+__email__ = "cryptography-dev@python.org"
+
+__license__ = "Apache License, Version 2.0"
+__copyright__ = "Copyright 2013-2022 {0}".format(__author__)
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/__init__.py b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..1f2886f3b5a0a4ec4e30b53ea73657a13a4d3181
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__init__.py
@@ -0,0 +1,127 @@
+# Author:: Donald Stufft (<donald@stufft.io>)
+# Copyright:: Copyright (c) 2013 Donald Stufft
+# License:: Apache License, Version 2.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.
+from __future__ import absolute_import
+from __future__ import division
+
+import hmac
+import os
+import warnings
+
+from .__about__ import (
+    __author__,
+    __copyright__,
+    __email__,
+    __license__,
+    __summary__,
+    __title__,
+    __uri__,
+    __version__,
+)
+from . import _bcrypt  # noqa: I100
+
+
+__all__ = [
+    "__title__",
+    "__summary__",
+    "__uri__",
+    "__version__",
+    "__author__",
+    "__email__",
+    "__license__",
+    "__copyright__",
+    "gensalt",
+    "hashpw",
+    "kdf",
+    "checkpw",
+]
+
+
+def gensalt(rounds: int = 12, prefix: bytes = b"2b") -> bytes:
+    if prefix not in (b"2a", b"2b"):
+        raise ValueError("Supported prefixes are b'2a' or b'2b'")
+
+    if rounds < 4 or rounds > 31:
+        raise ValueError("Invalid rounds")
+
+    salt = os.urandom(16)
+    output = _bcrypt.encode_base64(salt)
+
+    return (
+        b"$"
+        + prefix
+        + b"$"
+        + ("%2.2u" % rounds).encode("ascii")
+        + b"$"
+        + output
+    )
+
+
+def hashpw(password: bytes, salt: bytes) -> bytes:
+    if isinstance(password, str) or isinstance(salt, str):
+        raise TypeError("Strings must be encoded before hashing")
+
+    # bcrypt originally suffered from a wraparound bug:
+    # http://www.openwall.com/lists/oss-security/2012/01/02/4
+    # This bug was corrected in the OpenBSD source by truncating inputs to 72
+    # bytes on the updated prefix $2b$, but leaving $2a$ unchanged for
+    # compatibility. However, pyca/bcrypt 2.0.0 *did* correctly truncate inputs
+    # on $2a$, so we do it here to preserve compatibility with 2.0.0
+    password = password[:72]
+
+    return _bcrypt.hashpass(password, salt)
+
+
+def checkpw(password: bytes, hashed_password: bytes) -> bool:
+    if isinstance(password, str) or isinstance(hashed_password, str):
+        raise TypeError("Strings must be encoded before checking")
+
+    ret = hashpw(password, hashed_password)
+    return hmac.compare_digest(ret, hashed_password)
+
+
+def kdf(
+    password: bytes,
+    salt: bytes,
+    desired_key_bytes: int,
+    rounds: int,
+    ignore_few_rounds: bool = False,
+) -> bytes:
+    if isinstance(password, str) or isinstance(salt, str):
+        raise TypeError("Strings must be encoded before hashing")
+
+    if len(password) == 0 or len(salt) == 0:
+        raise ValueError("password and salt must not be empty")
+
+    if desired_key_bytes <= 0 or desired_key_bytes > 512:
+        raise ValueError("desired_key_bytes must be 1-512")
+
+    if rounds < 1:
+        raise ValueError("rounds must be 1 or more")
+
+    if rounds < 50 and not ignore_few_rounds:
+        # They probably think bcrypt.kdf()'s rounds parameter is logarithmic,
+        # expecting this value to be slow enough (it probably would be if this
+        # were bcrypt). Emit a warning.
+        warnings.warn(
+            (
+                "Warning: bcrypt.kdf() called with only {0} round(s). "
+                "This few is not secure: the parameter is linear, like PBKDF2."
+            ).format(rounds),
+            UserWarning,
+            stacklevel=2,
+        )
+
+    return _bcrypt.pbkdf(password, salt, rounds, desired_key_bytes)
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__about__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__about__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e3729c5b047a85403b8e326b1aca45be80465cd8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__about__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..522a5443991c18b003678115e77a075fd222d6e3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/bcrypt/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.abi3.so b/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.abi3.so
new file mode 100755
index 0000000000000000000000000000000000000000..5651953d8f327c0ed1e68bd8202d9ec97b0a5800
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.abi3.so differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.pyi b/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..640e913571a83141f317f1f0e9e959367311ed9d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/bcrypt/_bcrypt.pyi
@@ -0,0 +1,7 @@
+import typing
+
+def encode_base64(data: bytes) -> bytes: ...
+def hashpass(password: bytes, salt: bytes) -> bytes: ...
+def pbkdf(
+    password: bytes, salt: bytes, rounds: int, desired_key_bytes: int
+) -> bytes: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/bcrypt/py.typed b/TP03/TP03/lib/python3.9/site-packages/bcrypt/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..29225eee9edcd72c6a354550a5a3bedf1932b2ef
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/LICENSE
@@ -0,0 +1,26 @@
+
+Except when otherwise stated (look for LICENSE files in directories or
+information at the beginning of each file) all software and
+documentation is licensed as follows: 
+
+    The MIT License
+
+    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/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..f582bfbba8c686a734d15d5b04071e5c31d3eea0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/METADATA
@@ -0,0 +1,39 @@
+Metadata-Version: 2.1
+Name: cffi
+Version: 1.16.0
+Summary: Foreign Function Interface for Python calling C code.
+Home-page: http://cffi.readthedocs.org
+Author: Armin Rigo, Maciej Fijalkowski
+Author-email: python-cffi@googlegroups.com
+License: MIT
+Project-URL: Documentation, http://cffi.readthedocs.org/
+Project-URL: Source Code, https://github.com/python-cffi/cffi
+Project-URL: Issue Tracker, https://github.com/python-cffi/cffi/issues
+Project-URL: Changelog, https://cffi.readthedocs.io/en/latest/whatsnew.html
+Project-URL: Downloads, https://github.com/python-cffi/cffi/releases
+Project-URL: Contact, https://groups.google.com/forum/#!forum/python-cffi
+Classifier: Programming Language :: Python
+Classifier: Programming Language :: Python :: 3
+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: License :: OSI Approved :: MIT License
+Requires-Python: >=3.8
+License-File: LICENSE
+Requires-Dist: pycparser
+
+
+CFFI
+====
+
+Foreign Function Interface for Python calling C code.
+Please see the `Documentation <http://cffi.readthedocs.org/>`_.
+
+Contact
+-------
+
+`Mailing list <https://groups.google.com/forum/#!forum/python-cffi>`_
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..42af597a15841034860af68ed55dae93692b2e5a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/RECORD
@@ -0,0 +1,48 @@
+_cffi_backend.cpython-39-x86_64-linux-gnu.so,sha256=TFolRqs1c3KesWrf8lVAaAZg8ZQ-Ip2wdaAqGhzZZ_k,979456
+cffi-1.16.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+cffi-1.16.0.dist-info/LICENSE,sha256=BLgPWwd7vtaICM_rreteNSPyqMmpZJXFh72W3x6sKjM,1294
+cffi-1.16.0.dist-info/METADATA,sha256=qOBI2i0qSlLOKwmzNjbJfLmrTzHV_JFS7uKbcFj_p9Y,1480
+cffi-1.16.0.dist-info/RECORD,,
+cffi-1.16.0.dist-info/WHEEL,sha256=_BMdtp3IQ4NF7VFMKD4lD9Cik0H3WhEP1vtG22VwXhU,148
+cffi-1.16.0.dist-info/entry_points.txt,sha256=y6jTxnyeuLnL-XJcDv8uML3n6wyYiGRg8MTp_QGJ9Ho,75
+cffi-1.16.0.dist-info/top_level.txt,sha256=rE7WR3rZfNKxWI9-jn6hsHCAl7MDkB-FmuQbxWjFehQ,19
+cffi/__init__.py,sha256=uEnzaXlQndR9nc8ar1qk6_coNEfxfn4pA0sWPVg2MP8,513
+cffi/__pycache__/__init__.cpython-39.pyc,,
+cffi/__pycache__/_imp_emulation.cpython-39.pyc,,
+cffi/__pycache__/_shimmed_dist_utils.cpython-39.pyc,,
+cffi/__pycache__/api.cpython-39.pyc,,
+cffi/__pycache__/backend_ctypes.cpython-39.pyc,,
+cffi/__pycache__/cffi_opcode.cpython-39.pyc,,
+cffi/__pycache__/commontypes.cpython-39.pyc,,
+cffi/__pycache__/cparser.cpython-39.pyc,,
+cffi/__pycache__/error.cpython-39.pyc,,
+cffi/__pycache__/ffiplatform.cpython-39.pyc,,
+cffi/__pycache__/lock.cpython-39.pyc,,
+cffi/__pycache__/model.cpython-39.pyc,,
+cffi/__pycache__/pkgconfig.cpython-39.pyc,,
+cffi/__pycache__/recompiler.cpython-39.pyc,,
+cffi/__pycache__/setuptools_ext.cpython-39.pyc,,
+cffi/__pycache__/vengine_cpy.cpython-39.pyc,,
+cffi/__pycache__/vengine_gen.cpython-39.pyc,,
+cffi/__pycache__/verifier.cpython-39.pyc,,
+cffi/_cffi_errors.h,sha256=zQXt7uR_m8gUW-fI2hJg0KoSkJFwXv8RGUkEDZ177dQ,3908
+cffi/_cffi_include.h,sha256=tKnA1rdSoPHp23FnDL1mDGwFo-Uj6fXfA6vA6kcoEUc,14800
+cffi/_embedding.h,sha256=QEmrJKlB_W2VC601CjjyfMuxtgzPQwwEKFlwMCGHbT0,18787
+cffi/_imp_emulation.py,sha256=RxREG8zAbI2RPGBww90u_5fi8sWdahpdipOoPzkp7C0,2960
+cffi/_shimmed_dist_utils.py,sha256=mLuEtxw4gbuA2De_gD7zEhb6Q8Wm2lBPtwC68gd9XTs,2007
+cffi/api.py,sha256=wtJU0aGUC3TyYnjBIgsOIlv7drF19jV-y_srt7c8yhg,42085
+cffi/backend_ctypes.py,sha256=h5ZIzLc6BFVXnGyc9xPqZWUS7qGy7yFSDqXe68Sa8z4,42454
+cffi/cffi_opcode.py,sha256=v9RdD_ovA8rCtqsC95Ivki5V667rAOhGgs3fb2q9xpM,5724
+cffi/commontypes.py,sha256=QS4uxCDI7JhtTyjh1hlnCA-gynmaszWxJaRRLGkJa1A,2689
+cffi/cparser.py,sha256=rO_1pELRw1gI1DE1m4gi2ik5JMfpxouAACLXpRPlVEA,44231
+cffi/error.py,sha256=v6xTiS4U0kvDcy4h_BDRo5v39ZQuj-IMRYLv5ETddZs,877
+cffi/ffiplatform.py,sha256=avxFjdikYGJoEtmJO7ewVmwG_VEVl6EZ_WaNhZYCqv4,3584
+cffi/lock.py,sha256=l9TTdwMIMpi6jDkJGnQgE9cvTIR7CAntIJr8EGHt3pY,747
+cffi/model.py,sha256=RVsAb3h_u7VHWZJ-J_Z4kvB36pFyFG_MVIjPOQ8YhQ8,21790
+cffi/parse_c_type.h,sha256=OdwQfwM9ktq6vlCB43exFQmxDBtj2MBNdK8LYl15tjw,5976
+cffi/pkgconfig.py,sha256=LP1w7vmWvmKwyqLaU1Z243FOWGNQMrgMUZrvgFuOlco,4374
+cffi/recompiler.py,sha256=oTusgKQ02YY6LXhcmWcqpIlPrG178RMXXSBseSACRgg,64601
+cffi/setuptools_ext.py,sha256=-ebj79lO2_AUH-kRcaja2pKY1Z_5tloGwsJgzK8P3Cc,8871
+cffi/vengine_cpy.py,sha256=nK_im1DbdIGMMgxFgeo1MndFjaB-Qlkc2ZYlSquLjs0,43351
+cffi/vengine_gen.py,sha256=5dX7s1DU6pTBOMI6oTVn_8Bnmru_lj932B6b4v29Hlg,26684
+cffi/verifier.py,sha256=oX8jpaohg2Qm3aHcznidAdvrVm5N4sQYG0a3Eo5mIl4,11182
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ca2752b0b74cd7b7f1ad7e1a9c3ec2f79d905ca4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/WHEEL
@@ -0,0 +1,6 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.41.2)
+Root-Is-Purelib: false
+Tag: cp39-cp39-manylinux_2_17_x86_64
+Tag: cp39-cp39-manylinux2014_x86_64
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4b0274f2333a8cfadbe2d13922c47d0138e48141
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/entry_points.txt
@@ -0,0 +1,2 @@
+[distutils.setup_keywords]
+cffi_modules = cffi.setuptools_ext:cffi_modules
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f64577957eb0d893196994ae517759f3fa8e48dd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi-1.16.0.dist-info/top_level.txt
@@ -0,0 +1,2 @@
+_cffi_backend
+cffi
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cffi/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..90dedf43339ebd579902c9f50b0e6b0f73267122
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/__init__.py
@@ -0,0 +1,14 @@
+__all__ = ['FFI', 'VerificationError', 'VerificationMissing', 'CDefError',
+           'FFIError']
+
+from .api import FFI
+from .error import CDefError, FFIError, VerificationError, VerificationMissing
+from .error import PkgConfigError
+
+__version__ = "1.16.0"
+__version_info__ = (1, 16, 0)
+
+# The verifier module file names are based on the CRC32 of a string that
+# contains the following version number.  It may be older than __version__
+# if nothing is clearly incompatible.
+__version_verifier_modules__ = "0.8.6"
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f5ad3e396dec53f6096a583da693b6681efb4c6b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_imp_emulation.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_imp_emulation.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ea0839fc00d56e8bb510ad2b150920c8dbd3f883
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_imp_emulation.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_shimmed_dist_utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_shimmed_dist_utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7fd5c7448f58863cc11c5392b16be6713ef84fd0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/_shimmed_dist_utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/api.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/api.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c7bbb833981c33c7e9dc811da4213d706fdc4fca
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/api.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/backend_ctypes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/backend_ctypes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2e77bc7c0e998d84d28b8d070cf8ac73ffd031fa
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/backend_ctypes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cffi_opcode.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cffi_opcode.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2c6a43735622d52f8ae9c7514494224774d2637b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cffi_opcode.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/commontypes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/commontypes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b935f68079665d4f5c882de83f7b35a1f59b7b12
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/commontypes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cparser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cparser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5bc80e59c1cc0baf791eefc66bcaf64f6443cddd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/cparser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/error.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/error.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..58d559635403fdc83faf1a28a0721ee1087dbb57
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/error.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/ffiplatform.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/ffiplatform.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7170fe0dd16dba3c07e23f0c59994a2282fae6a6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/ffiplatform.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/lock.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/lock.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ef34250ea2fb9f53d9d3f15878e15fcd7da19983
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/lock.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/model.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/model.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ae1d7d91017b831753ac63a8a1025509fc05fce9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/model.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/pkgconfig.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/pkgconfig.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1d880ec97532cf57184b814167c00d47869b66f0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/pkgconfig.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/recompiler.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/recompiler.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7828b0c44d16cc4a964c0900fcd142df4c172040
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/recompiler.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/setuptools_ext.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/setuptools_ext.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3cef2a67fc14be28c92849a005a8dccfe69f3ec6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/setuptools_ext.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_cpy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_cpy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3a15a6f42abe125b9440b28b7523e382f8e87450
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_cpy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_gen.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_gen.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6fa9e5bf5771a1d5700b285090730ef26183bca4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/vengine_gen.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/verifier.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/verifier.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fe426435ef4a84367999be5b00d8573ce063fcf9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cffi/__pycache__/verifier.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_errors.h b/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_errors.h
new file mode 100644
index 0000000000000000000000000000000000000000..158e0590346a9a8b2ab047ac1bd23bcb3af21398
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_errors.h
@@ -0,0 +1,149 @@
+#ifndef CFFI_MESSAGEBOX
+# ifdef _MSC_VER
+#  define CFFI_MESSAGEBOX  1
+# else
+#  define CFFI_MESSAGEBOX  0
+# endif
+#endif
+
+
+#if CFFI_MESSAGEBOX
+/* Windows only: logic to take the Python-CFFI embedding logic
+   initialization errors and display them in a background thread
+   with MessageBox.  The idea is that if the whole program closes
+   as a result of this problem, then likely it is already a console
+   program and you can read the stderr output in the console too.
+   If it is not a console program, then it will likely show its own
+   dialog to complain, or generally not abruptly close, and for this
+   case the background thread should stay alive.
+*/
+static void *volatile _cffi_bootstrap_text;
+
+static PyObject *_cffi_start_error_capture(void)
+{
+    PyObject *result = NULL;
+    PyObject *x, *m, *bi;
+
+    if (InterlockedCompareExchangePointer(&_cffi_bootstrap_text,
+            (void *)1, NULL) != NULL)
+        return (PyObject *)1;
+
+    m = PyImport_AddModule("_cffi_error_capture");
+    if (m == NULL)
+        goto error;
+
+    result = PyModule_GetDict(m);
+    if (result == NULL)
+        goto error;
+
+#if PY_MAJOR_VERSION >= 3
+    bi = PyImport_ImportModule("builtins");
+#else
+    bi = PyImport_ImportModule("__builtin__");
+#endif
+    if (bi == NULL)
+        goto error;
+    PyDict_SetItemString(result, "__builtins__", bi);
+    Py_DECREF(bi);
+
+    x = PyRun_String(
+        "import sys\n"
+        "class FileLike:\n"
+        "  def write(self, x):\n"
+        "    try:\n"
+        "      of.write(x)\n"
+        "    except: pass\n"
+        "    self.buf += x\n"
+        "  def flush(self):\n"
+        "    pass\n"
+        "fl = FileLike()\n"
+        "fl.buf = ''\n"
+        "of = sys.stderr\n"
+        "sys.stderr = fl\n"
+        "def done():\n"
+        "  sys.stderr = of\n"
+        "  return fl.buf\n",   /* make sure the returned value stays alive */
+        Py_file_input,
+        result, result);
+    Py_XDECREF(x);
+
+ error:
+    if (PyErr_Occurred())
+    {
+        PyErr_WriteUnraisable(Py_None);
+        PyErr_Clear();
+    }
+    return result;
+}
+
+#pragma comment(lib, "user32.lib")
+
+static DWORD WINAPI _cffi_bootstrap_dialog(LPVOID ignored)
+{
+    Sleep(666);    /* may be interrupted if the whole process is closing */
+#if PY_MAJOR_VERSION >= 3
+    MessageBoxW(NULL, (wchar_t *)_cffi_bootstrap_text,
+                L"Python-CFFI error",
+                MB_OK | MB_ICONERROR);
+#else
+    MessageBoxA(NULL, (char *)_cffi_bootstrap_text,
+                "Python-CFFI error",
+                MB_OK | MB_ICONERROR);
+#endif
+    _cffi_bootstrap_text = NULL;
+    return 0;
+}
+
+static void _cffi_stop_error_capture(PyObject *ecap)
+{
+    PyObject *s;
+    void *text;
+
+    if (ecap == (PyObject *)1)
+        return;
+
+    if (ecap == NULL)
+        goto error;
+
+    s = PyRun_String("done()", Py_eval_input, ecap, ecap);
+    if (s == NULL)
+        goto error;
+
+    /* Show a dialog box, but in a background thread, and
+       never show multiple dialog boxes at once. */
+#if PY_MAJOR_VERSION >= 3
+    text = PyUnicode_AsWideCharString(s, NULL);
+#else
+    text = PyString_AsString(s);
+#endif
+
+    _cffi_bootstrap_text = text;
+
+    if (text != NULL)
+    {
+        HANDLE h;
+        h = CreateThread(NULL, 0, _cffi_bootstrap_dialog,
+                         NULL, 0, NULL);
+        if (h != NULL)
+            CloseHandle(h);
+    }
+    /* decref the string, but it should stay alive as 'fl.buf'
+       in the small module above.  It will really be freed only if
+       we later get another similar error.  So it's a leak of at
+       most one copy of the small module.  That's fine for this
+       situation which is usually a "fatal error" anyway. */
+    Py_DECREF(s);
+    PyErr_Clear();
+    return;
+
+  error:
+    _cffi_bootstrap_text = NULL;
+    PyErr_Clear();
+}
+
+#else
+
+static PyObject *_cffi_start_error_capture(void) { return NULL; }
+static void _cffi_stop_error_capture(PyObject *ecap) { }
+
+#endif
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_include.h b/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_include.h
new file mode 100644
index 0000000000000000000000000000000000000000..e4c0a672405298ddb3dcb2e2ca6da9eea3d2e162
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/_cffi_include.h
@@ -0,0 +1,385 @@
+#define _CFFI_
+
+/* We try to define Py_LIMITED_API before including Python.h.
+
+   Mess: we can only define it if Py_DEBUG, Py_TRACE_REFS and
+   Py_REF_DEBUG are not defined.  This is a best-effort approximation:
+   we can learn about Py_DEBUG from pyconfig.h, but it is unclear if
+   the same works for the other two macros.  Py_DEBUG implies them,
+   but not the other way around.
+
+   The implementation is messy (issue #350): on Windows, with _MSC_VER,
+   we have to define Py_LIMITED_API even before including pyconfig.h.
+   In that case, we guess what pyconfig.h will do to the macros above,
+   and check our guess after the #include.
+
+   Note that on Windows, with CPython 3.x, you need >= 3.5 and virtualenv
+   version >= 16.0.0.  With older versions of either, you don't get a
+   copy of PYTHON3.DLL in the virtualenv.  We can't check the version of
+   CPython *before* we even include pyconfig.h.  ffi.set_source() puts
+   a ``#define _CFFI_NO_LIMITED_API'' at the start of this file if it is
+   running on Windows < 3.5, as an attempt at fixing it, but that's
+   arguably wrong because it may not be the target version of Python.
+   Still better than nothing I guess.  As another workaround, you can
+   remove the definition of Py_LIMITED_API here.
+
+   See also 'py_limited_api' in cffi/setuptools_ext.py.
+*/
+#if !defined(_CFFI_USE_EMBEDDING) && !defined(Py_LIMITED_API)
+#  ifdef _MSC_VER
+#    if !defined(_DEBUG) && !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API)
+#      define Py_LIMITED_API
+#    endif
+#    include <pyconfig.h>
+     /* sanity-check: Py_LIMITED_API will cause crashes if any of these
+        are also defined.  Normally, the Python file PC/pyconfig.h does not
+        cause any of these to be defined, with the exception that _DEBUG
+        causes Py_DEBUG.  Double-check that. */
+#    ifdef Py_LIMITED_API
+#      if defined(Py_DEBUG)
+#        error "pyconfig.h unexpectedly defines Py_DEBUG, but Py_LIMITED_API is set"
+#      endif
+#      if defined(Py_TRACE_REFS)
+#        error "pyconfig.h unexpectedly defines Py_TRACE_REFS, but Py_LIMITED_API is set"
+#      endif
+#      if defined(Py_REF_DEBUG)
+#        error "pyconfig.h unexpectedly defines Py_REF_DEBUG, but Py_LIMITED_API is set"
+#      endif
+#    endif
+#  else
+#    include <pyconfig.h>
+#    if !defined(Py_DEBUG) && !defined(Py_TRACE_REFS) && !defined(Py_REF_DEBUG) && !defined(_CFFI_NO_LIMITED_API)
+#      define Py_LIMITED_API
+#    endif
+#  endif
+#endif
+
+#include <Python.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+#include <stddef.h>
+#include "parse_c_type.h"
+
+/* this block of #ifs should be kept exactly identical between
+   c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py
+   and cffi/_cffi_include.h */
+#if defined(_MSC_VER)
+# include <malloc.h>   /* for alloca() */
+# if _MSC_VER < 1600   /* MSVC < 2010 */
+   typedef __int8 int8_t;
+   typedef __int16 int16_t;
+   typedef __int32 int32_t;
+   typedef __int64 int64_t;
+   typedef unsigned __int8 uint8_t;
+   typedef unsigned __int16 uint16_t;
+   typedef unsigned __int32 uint32_t;
+   typedef unsigned __int64 uint64_t;
+   typedef __int8 int_least8_t;
+   typedef __int16 int_least16_t;
+   typedef __int32 int_least32_t;
+   typedef __int64 int_least64_t;
+   typedef unsigned __int8 uint_least8_t;
+   typedef unsigned __int16 uint_least16_t;
+   typedef unsigned __int32 uint_least32_t;
+   typedef unsigned __int64 uint_least64_t;
+   typedef __int8 int_fast8_t;
+   typedef __int16 int_fast16_t;
+   typedef __int32 int_fast32_t;
+   typedef __int64 int_fast64_t;
+   typedef unsigned __int8 uint_fast8_t;
+   typedef unsigned __int16 uint_fast16_t;
+   typedef unsigned __int32 uint_fast32_t;
+   typedef unsigned __int64 uint_fast64_t;
+   typedef __int64 intmax_t;
+   typedef unsigned __int64 uintmax_t;
+# else
+#  include <stdint.h>
+# endif
+# if _MSC_VER < 1800   /* MSVC < 2013 */
+#  ifndef __cplusplus
+    typedef unsigned char _Bool;
+#  endif
+# endif
+#else
+# include <stdint.h>
+# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
+#  include <alloca.h>
+# endif
+#endif
+
+#ifdef __GNUC__
+# define _CFFI_UNUSED_FN  __attribute__((unused))
+#else
+# define _CFFI_UNUSED_FN  /* nothing */
+#endif
+
+#ifdef __cplusplus
+# ifndef _Bool
+   typedef bool _Bool;   /* semi-hackish: C++ has no _Bool; bool is builtin */
+# endif
+#endif
+
+/**********  CPython-specific section  **********/
+#ifndef PYPY_VERSION
+
+
+#if PY_MAJOR_VERSION >= 3
+# define PyInt_FromLong PyLong_FromLong
+#endif
+
+#define _cffi_from_c_double PyFloat_FromDouble
+#define _cffi_from_c_float PyFloat_FromDouble
+#define _cffi_from_c_long PyInt_FromLong
+#define _cffi_from_c_ulong PyLong_FromUnsignedLong
+#define _cffi_from_c_longlong PyLong_FromLongLong
+#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong
+#define _cffi_from_c__Bool PyBool_FromLong
+
+#define _cffi_to_c_double PyFloat_AsDouble
+#define _cffi_to_c_float PyFloat_AsDouble
+
+#define _cffi_from_c_int(x, type)                                        \
+    (((type)-1) > 0 ? /* unsigned */                                     \
+        (sizeof(type) < sizeof(long) ?                                   \
+            PyInt_FromLong((long)x) :                                    \
+         sizeof(type) == sizeof(long) ?                                  \
+            PyLong_FromUnsignedLong((unsigned long)x) :                  \
+            PyLong_FromUnsignedLongLong((unsigned long long)x)) :        \
+        (sizeof(type) <= sizeof(long) ?                                  \
+            PyInt_FromLong((long)x) :                                    \
+            PyLong_FromLongLong((long long)x)))
+
+#define _cffi_to_c_int(o, type)                                          \
+    ((type)(                                                             \
+     sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o)        \
+                                         : (type)_cffi_to_c_i8(o)) :     \
+     sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o)       \
+                                         : (type)_cffi_to_c_i16(o)) :    \
+     sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o)       \
+                                         : (type)_cffi_to_c_i32(o)) :    \
+     sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o)       \
+                                         : (type)_cffi_to_c_i64(o)) :    \
+     (Py_FatalError("unsupported size for type " #type), (type)0)))
+
+#define _cffi_to_c_i8                                                    \
+                 ((int(*)(PyObject *))_cffi_exports[1])
+#define _cffi_to_c_u8                                                    \
+                 ((int(*)(PyObject *))_cffi_exports[2])
+#define _cffi_to_c_i16                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[3])
+#define _cffi_to_c_u16                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[4])
+#define _cffi_to_c_i32                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[5])
+#define _cffi_to_c_u32                                                   \
+                 ((unsigned int(*)(PyObject *))_cffi_exports[6])
+#define _cffi_to_c_i64                                                   \
+                 ((long long(*)(PyObject *))_cffi_exports[7])
+#define _cffi_to_c_u64                                                   \
+                 ((unsigned long long(*)(PyObject *))_cffi_exports[8])
+#define _cffi_to_c_char                                                  \
+                 ((int(*)(PyObject *))_cffi_exports[9])
+#define _cffi_from_c_pointer                                             \
+    ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[10])
+#define _cffi_to_c_pointer                                               \
+    ((char *(*)(PyObject *, struct _cffi_ctypedescr *))_cffi_exports[11])
+#define _cffi_get_struct_layout                                          \
+    not used any more
+#define _cffi_restore_errno                                              \
+    ((void(*)(void))_cffi_exports[13])
+#define _cffi_save_errno                                                 \
+    ((void(*)(void))_cffi_exports[14])
+#define _cffi_from_c_char                                                \
+    ((PyObject *(*)(char))_cffi_exports[15])
+#define _cffi_from_c_deref                                               \
+    ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[16])
+#define _cffi_to_c                                                       \
+    ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[17])
+#define _cffi_from_c_struct                                              \
+    ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[18])
+#define _cffi_to_c_wchar_t                                               \
+    ((_cffi_wchar_t(*)(PyObject *))_cffi_exports[19])
+#define _cffi_from_c_wchar_t                                             \
+    ((PyObject *(*)(_cffi_wchar_t))_cffi_exports[20])
+#define _cffi_to_c_long_double                                           \
+    ((long double(*)(PyObject *))_cffi_exports[21])
+#define _cffi_to_c__Bool                                                 \
+    ((_Bool(*)(PyObject *))_cffi_exports[22])
+#define _cffi_prepare_pointer_call_argument                              \
+    ((Py_ssize_t(*)(struct _cffi_ctypedescr *,                           \
+                    PyObject *, char **))_cffi_exports[23])
+#define _cffi_convert_array_from_object                                  \
+    ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[24])
+#define _CFFI_CPIDX  25
+#define _cffi_call_python                                                \
+    ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX])
+#define _cffi_to_c_wchar3216_t                                           \
+    ((int(*)(PyObject *))_cffi_exports[26])
+#define _cffi_from_c_wchar3216_t                                         \
+    ((PyObject *(*)(int))_cffi_exports[27])
+#define _CFFI_NUM_EXPORTS 28
+
+struct _cffi_ctypedescr;
+
+static void *_cffi_exports[_CFFI_NUM_EXPORTS];
+
+#define _cffi_type(index)   (                           \
+    assert((((uintptr_t)_cffi_types[index]) & 1) == 0), \
+    (struct _cffi_ctypedescr *)_cffi_types[index])
+
+static PyObject *_cffi_init(const char *module_name, Py_ssize_t version,
+                            const struct _cffi_type_context_s *ctx)
+{
+    PyObject *module, *o_arg, *new_module;
+    void *raw[] = {
+        (void *)module_name,
+        (void *)version,
+        (void *)_cffi_exports,
+        (void *)ctx,
+    };
+
+    module = PyImport_ImportModule("_cffi_backend");
+    if (module == NULL)
+        goto failure;
+
+    o_arg = PyLong_FromVoidPtr((void *)raw);
+    if (o_arg == NULL)
+        goto failure;
+
+    new_module = PyObject_CallMethod(
+        module, (char *)"_init_cffi_1_0_external_module", (char *)"O", o_arg);
+
+    Py_DECREF(o_arg);
+    Py_DECREF(module);
+    return new_module;
+
+  failure:
+    Py_XDECREF(module);
+    return NULL;
+}
+
+
+#ifdef HAVE_WCHAR_H
+typedef wchar_t _cffi_wchar_t;
+#else
+typedef uint16_t _cffi_wchar_t;   /* same random pick as _cffi_backend.c */
+#endif
+
+_CFFI_UNUSED_FN static uint16_t _cffi_to_c_char16_t(PyObject *o)
+{
+    if (sizeof(_cffi_wchar_t) == 2)
+        return (uint16_t)_cffi_to_c_wchar_t(o);
+    else
+        return (uint16_t)_cffi_to_c_wchar3216_t(o);
+}
+
+_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char16_t(uint16_t x)
+{
+    if (sizeof(_cffi_wchar_t) == 2)
+        return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
+    else
+        return _cffi_from_c_wchar3216_t((int)x);
+}
+
+_CFFI_UNUSED_FN static int _cffi_to_c_char32_t(PyObject *o)
+{
+    if (sizeof(_cffi_wchar_t) == 4)
+        return (int)_cffi_to_c_wchar_t(o);
+    else
+        return (int)_cffi_to_c_wchar3216_t(o);
+}
+
+_CFFI_UNUSED_FN static PyObject *_cffi_from_c_char32_t(unsigned int x)
+{
+    if (sizeof(_cffi_wchar_t) == 4)
+        return _cffi_from_c_wchar_t((_cffi_wchar_t)x);
+    else
+        return _cffi_from_c_wchar3216_t((int)x);
+}
+
+union _cffi_union_alignment_u {
+    unsigned char m_char;
+    unsigned short m_short;
+    unsigned int m_int;
+    unsigned long m_long;
+    unsigned long long m_longlong;
+    float m_float;
+    double m_double;
+    long double m_longdouble;
+};
+
+struct _cffi_freeme_s {
+    struct _cffi_freeme_s *next;
+    union _cffi_union_alignment_u alignment;
+};
+
+_CFFI_UNUSED_FN static int
+_cffi_convert_array_argument(struct _cffi_ctypedescr *ctptr, PyObject *arg,
+                             char **output_data, Py_ssize_t datasize,
+                             struct _cffi_freeme_s **freeme)
+{
+    char *p;
+    if (datasize < 0)
+        return -1;
+
+    p = *output_data;
+    if (p == NULL) {
+        struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc(
+            offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize);
+        if (fp == NULL)
+            return -1;
+        fp->next = *freeme;
+        *freeme = fp;
+        p = *output_data = (char *)&fp->alignment;
+    }
+    memset((void *)p, 0, (size_t)datasize);
+    return _cffi_convert_array_from_object(p, ctptr, arg);
+}
+
+_CFFI_UNUSED_FN static void
+_cffi_free_array_arguments(struct _cffi_freeme_s *freeme)
+{
+    do {
+        void *p = (void *)freeme;
+        freeme = freeme->next;
+        PyObject_Free(p);
+    } while (freeme != NULL);
+}
+
+/**********  end CPython-specific section  **********/
+#else
+_CFFI_UNUSED_FN
+static void (*_cffi_call_python_org)(struct _cffi_externpy_s *, char *);
+# define _cffi_call_python  _cffi_call_python_org
+#endif
+
+
+#define _cffi_array_len(array)   (sizeof(array) / sizeof((array)[0]))
+
+#define _cffi_prim_int(size, sign)                                      \
+    ((size) == 1 ? ((sign) ? _CFFI_PRIM_INT8  : _CFFI_PRIM_UINT8)  :    \
+     (size) == 2 ? ((sign) ? _CFFI_PRIM_INT16 : _CFFI_PRIM_UINT16) :    \
+     (size) == 4 ? ((sign) ? _CFFI_PRIM_INT32 : _CFFI_PRIM_UINT32) :    \
+     (size) == 8 ? ((sign) ? _CFFI_PRIM_INT64 : _CFFI_PRIM_UINT64) :    \
+     _CFFI__UNKNOWN_PRIM)
+
+#define _cffi_prim_float(size)                                          \
+    ((size) == sizeof(float) ? _CFFI_PRIM_FLOAT :                       \
+     (size) == sizeof(double) ? _CFFI_PRIM_DOUBLE :                     \
+     (size) == sizeof(long double) ? _CFFI__UNKNOWN_LONG_DOUBLE :       \
+     _CFFI__UNKNOWN_FLOAT_PRIM)
+
+#define _cffi_check_int(got, got_nonpos, expected)      \
+    ((got_nonpos) == (expected <= 0) &&                 \
+     (got) == (unsigned long long)expected)
+
+#ifdef MS_WIN32
+# define _cffi_stdcall  __stdcall
+#else
+# define _cffi_stdcall  /* nothing */
+#endif
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/_embedding.h b/TP03/TP03/lib/python3.9/site-packages/cffi/_embedding.h
new file mode 100644
index 0000000000000000000000000000000000000000..1cb66f2352cd0ac9dc506bcdb7b333f3d70b92ed
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/_embedding.h
@@ -0,0 +1,550 @@
+
+/***** Support code for embedding *****/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+#if defined(_WIN32)
+#  define CFFI_DLLEXPORT  __declspec(dllexport)
+#elif defined(__GNUC__)
+#  define CFFI_DLLEXPORT  __attribute__((visibility("default")))
+#else
+#  define CFFI_DLLEXPORT  /* nothing */
+#endif
+
+
+/* There are two global variables of type _cffi_call_python_fnptr:
+
+   * _cffi_call_python, which we declare just below, is the one called
+     by ``extern "Python"`` implementations.
+
+   * _cffi_call_python_org, which on CPython is actually part of the
+     _cffi_exports[] array, is the function pointer copied from
+     _cffi_backend.  If _cffi_start_python() fails, then this is set
+     to NULL; otherwise, it should never be NULL.
+
+   After initialization is complete, both are equal.  However, the
+   first one remains equal to &_cffi_start_and_call_python until the
+   very end of initialization, when we are (or should be) sure that
+   concurrent threads also see a completely initialized world, and
+   only then is it changed.
+*/
+#undef _cffi_call_python
+typedef void (*_cffi_call_python_fnptr)(struct _cffi_externpy_s *, char *);
+static void _cffi_start_and_call_python(struct _cffi_externpy_s *, char *);
+static _cffi_call_python_fnptr _cffi_call_python = &_cffi_start_and_call_python;
+
+
+#ifndef _MSC_VER
+   /* --- Assuming a GCC not infinitely old --- */
+# define cffi_compare_and_swap(l,o,n)  __sync_bool_compare_and_swap(l,o,n)
+# define cffi_write_barrier()          __sync_synchronize()
+# if !defined(__amd64__) && !defined(__x86_64__) &&   \
+     !defined(__i386__) && !defined(__i386)
+#   define cffi_read_barrier()         __sync_synchronize()
+# else
+#   define cffi_read_barrier()         (void)0
+# endif
+#else
+   /* --- Windows threads version --- */
+# include <Windows.h>
+# define cffi_compare_and_swap(l,o,n) \
+                               (InterlockedCompareExchangePointer(l,n,o) == (o))
+# define cffi_write_barrier()       InterlockedCompareExchange(&_cffi_dummy,0,0)
+# define cffi_read_barrier()           (void)0
+static volatile LONG _cffi_dummy;
+#endif
+
+#ifdef WITH_THREAD
+# ifndef _MSC_VER
+#  include <pthread.h>
+   static pthread_mutex_t _cffi_embed_startup_lock;
+# else
+   static CRITICAL_SECTION _cffi_embed_startup_lock;
+# endif
+  static char _cffi_embed_startup_lock_ready = 0;
+#endif
+
+static void _cffi_acquire_reentrant_mutex(void)
+{
+    static void *volatile lock = NULL;
+
+    while (!cffi_compare_and_swap(&lock, NULL, (void *)1)) {
+        /* should ideally do a spin loop instruction here, but
+           hard to do it portably and doesn't really matter I
+           think: pthread_mutex_init() should be very fast, and
+           this is only run at start-up anyway. */
+    }
+
+#ifdef WITH_THREAD
+    if (!_cffi_embed_startup_lock_ready) {
+# ifndef _MSC_VER
+        pthread_mutexattr_t attr;
+        pthread_mutexattr_init(&attr);
+        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+        pthread_mutex_init(&_cffi_embed_startup_lock, &attr);
+# else
+        InitializeCriticalSection(&_cffi_embed_startup_lock);
+# endif
+        _cffi_embed_startup_lock_ready = 1;
+    }
+#endif
+
+    while (!cffi_compare_and_swap(&lock, (void *)1, NULL))
+        ;
+
+#ifndef _MSC_VER
+    pthread_mutex_lock(&_cffi_embed_startup_lock);
+#else
+    EnterCriticalSection(&_cffi_embed_startup_lock);
+#endif
+}
+
+static void _cffi_release_reentrant_mutex(void)
+{
+#ifndef _MSC_VER
+    pthread_mutex_unlock(&_cffi_embed_startup_lock);
+#else
+    LeaveCriticalSection(&_cffi_embed_startup_lock);
+#endif
+}
+
+
+/**********  CPython-specific section  **********/
+#ifndef PYPY_VERSION
+
+#include "_cffi_errors.h"
+
+
+#define _cffi_call_python_org  _cffi_exports[_CFFI_CPIDX]
+
+PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(void);   /* forward */
+
+static void _cffi_py_initialize(void)
+{
+    /* XXX use initsigs=0, which "skips initialization registration of
+       signal handlers, which might be useful when Python is
+       embedded" according to the Python docs.  But review and think
+       if it should be a user-controllable setting.
+
+       XXX we should also give a way to write errors to a buffer
+       instead of to stderr.
+
+       XXX if importing 'site' fails, CPython (any version) calls
+       exit().  Should we try to work around this behavior here?
+    */
+    Py_InitializeEx(0);
+}
+
+static int _cffi_initialize_python(void)
+{
+    /* This initializes Python, imports _cffi_backend, and then the
+       present .dll/.so is set up as a CPython C extension module.
+    */
+    int result;
+    PyGILState_STATE state;
+    PyObject *pycode=NULL, *global_dict=NULL, *x;
+    PyObject *builtins;
+
+    state = PyGILState_Ensure();
+
+    /* Call the initxxx() function from the present module.  It will
+       create and initialize us as a CPython extension module, instead
+       of letting the startup Python code do it---it might reimport
+       the same .dll/.so and get maybe confused on some platforms.
+       It might also have troubles locating the .dll/.so again for all
+       I know.
+    */
+    (void)_CFFI_PYTHON_STARTUP_FUNC();
+    if (PyErr_Occurred())
+        goto error;
+
+    /* Now run the Python code provided to ffi.embedding_init_code().
+     */
+    pycode = Py_CompileString(_CFFI_PYTHON_STARTUP_CODE,
+                              "<init code for '" _CFFI_MODULE_NAME "'>",
+                              Py_file_input);
+    if (pycode == NULL)
+        goto error;
+    global_dict = PyDict_New();
+    if (global_dict == NULL)
+        goto error;
+    builtins = PyEval_GetBuiltins();
+    if (builtins == NULL)
+        goto error;
+    if (PyDict_SetItemString(global_dict, "__builtins__", builtins) < 0)
+        goto error;
+    x = PyEval_EvalCode(
+#if PY_MAJOR_VERSION < 3
+                        (PyCodeObject *)
+#endif
+                        pycode, global_dict, global_dict);
+    if (x == NULL)
+        goto error;
+    Py_DECREF(x);
+
+    /* Done!  Now if we've been called from
+       _cffi_start_and_call_python() in an ``extern "Python"``, we can
+       only hope that the Python code did correctly set up the
+       corresponding @ffi.def_extern() function.  Otherwise, the
+       general logic of ``extern "Python"`` functions (inside the
+       _cffi_backend module) will find that the reference is still
+       missing and print an error.
+     */
+    result = 0;
+ done:
+    Py_XDECREF(pycode);
+    Py_XDECREF(global_dict);
+    PyGILState_Release(state);
+    return result;
+
+ error:;
+    {
+        /* Print as much information as potentially useful.
+           Debugging load-time failures with embedding is not fun
+        */
+        PyObject *ecap;
+        PyObject *exception, *v, *tb, *f, *modules, *mod;
+        PyErr_Fetch(&exception, &v, &tb);
+        ecap = _cffi_start_error_capture();
+        f = PySys_GetObject((char *)"stderr");
+        if (f != NULL && f != Py_None) {
+            PyFile_WriteString(
+                "Failed to initialize the Python-CFFI embedding logic:\n\n", f);
+        }
+
+        if (exception != NULL) {
+            PyErr_NormalizeException(&exception, &v, &tb);
+            PyErr_Display(exception, v, tb);
+        }
+        Py_XDECREF(exception);
+        Py_XDECREF(v);
+        Py_XDECREF(tb);
+
+        if (f != NULL && f != Py_None) {
+            PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME
+                               "\ncompiled with cffi version: 1.16.0"
+                               "\n_cffi_backend module: ", f);
+            modules = PyImport_GetModuleDict();
+            mod = PyDict_GetItemString(modules, "_cffi_backend");
+            if (mod == NULL) {
+                PyFile_WriteString("not loaded", f);
+            }
+            else {
+                v = PyObject_GetAttrString(mod, "__file__");
+                PyFile_WriteObject(v, f, 0);
+                Py_XDECREF(v);
+            }
+            PyFile_WriteString("\nsys.path: ", f);
+            PyFile_WriteObject(PySys_GetObject((char *)"path"), f, 0);
+            PyFile_WriteString("\n\n", f);
+        }
+        _cffi_stop_error_capture(ecap);
+    }
+    result = -1;
+    goto done;
+}
+
+#if PY_VERSION_HEX < 0x03080000
+PyAPI_DATA(char *) _PyParser_TokenNames[];  /* from CPython */
+#endif
+
+static int _cffi_carefully_make_gil(void)
+{
+    /* This does the basic initialization of Python.  It can be called
+       completely concurrently from unrelated threads.  It assumes
+       that we don't hold the GIL before (if it exists), and we don't
+       hold it afterwards.
+
+       (What it really does used to be completely different in Python 2
+       and Python 3, with the Python 2 solution avoiding the spin-lock
+       around the Py_InitializeEx() call.  However, after recent changes
+       to CPython 2.7 (issue #358) it no longer works.  So we use the
+       Python 3 solution everywhere.)
+
+       This initializes Python by calling Py_InitializeEx().
+       Important: this must not be called concurrently at all.
+       So we use a global variable as a simple spin lock.  This global
+       variable must be from 'libpythonX.Y.so', not from this
+       cffi-based extension module, because it must be shared from
+       different cffi-based extension modules.
+
+       In Python < 3.8, we choose
+       _PyParser_TokenNames[0] as a completely arbitrary pointer value
+       that is never written to.  The default is to point to the
+       string "ENDMARKER".  We change it temporarily to point to the
+       next character in that string.  (Yes, I know it's REALLY
+       obscure.)
+
+       In Python >= 3.8, this string array is no longer writable, so
+       instead we pick PyCapsuleType.tp_version_tag.  We can't change
+       Python < 3.8 because someone might use a mixture of cffi
+       embedded modules, some of which were compiled before this file
+       changed.
+
+       In Python >= 3.12, this stopped working because that particular
+       tp_version_tag gets modified during interpreter startup.  It's
+       arguably a bad idea before 3.12 too, but again we can't change
+       that because someone might use a mixture of cffi embedded
+       modules, and no-one reported a bug so far.  In Python >= 3.12
+       we go instead for PyCapsuleType.tp_as_buffer, which is supposed
+       to always be NULL.  We write to it temporarily a pointer to
+       a struct full of NULLs, which is semantically the same.
+    */
+
+#ifdef WITH_THREAD
+# if PY_VERSION_HEX < 0x03080000
+    char *volatile *lock = (char *volatile *)_PyParser_TokenNames;
+    char *old_value, *locked_value;
+
+    while (1) {    /* spin loop */
+        old_value = *lock;
+        locked_value = old_value + 1;
+        if (old_value[0] == 'E') {
+            assert(old_value[1] == 'N');
+            if (cffi_compare_and_swap(lock, old_value, locked_value))
+                break;
+        }
+        else {
+            assert(old_value[0] == 'N');
+            /* should ideally do a spin loop instruction here, but
+               hard to do it portably and doesn't really matter I
+               think: PyEval_InitThreads() should be very fast, and
+               this is only run at start-up anyway. */
+        }
+    }
+# else
+#  if PY_VERSION_HEX < 0x030C0000
+    int volatile *lock = (int volatile *)&PyCapsule_Type.tp_version_tag;
+    int old_value, locked_value = -42;
+    assert(!(PyCapsule_Type.tp_flags & Py_TPFLAGS_HAVE_VERSION_TAG));
+#  else
+    static struct ebp_s { PyBufferProcs buf; int mark; } empty_buffer_procs;
+    empty_buffer_procs.mark = -42;
+    PyBufferProcs *volatile *lock = (PyBufferProcs *volatile *)
+        &PyCapsule_Type.tp_as_buffer;
+    PyBufferProcs *old_value, *locked_value = &empty_buffer_procs.buf;
+#  endif
+
+    while (1) {    /* spin loop */
+        old_value = *lock;
+        if (old_value == 0) {
+            if (cffi_compare_and_swap(lock, old_value, locked_value))
+                break;
+        }
+        else {
+#  if PY_VERSION_HEX < 0x030C0000
+            assert(old_value == locked_value);
+#  else
+            /* The pointer should point to a possibly different
+               empty_buffer_procs from another C extension module */
+            assert(((struct ebp_s *)old_value)->mark == -42);
+#  endif
+            /* should ideally do a spin loop instruction here, but
+               hard to do it portably and doesn't really matter I
+               think: PyEval_InitThreads() should be very fast, and
+               this is only run at start-up anyway. */
+        }
+    }
+# endif
+#endif
+
+    /* call Py_InitializeEx() */
+    if (!Py_IsInitialized()) {
+        _cffi_py_initialize();
+#if PY_VERSION_HEX < 0x03070000
+        PyEval_InitThreads();
+#endif
+        PyEval_SaveThread();  /* release the GIL */
+        /* the returned tstate must be the one that has been stored into the
+           autoTLSkey by _PyGILState_Init() called from Py_Initialize(). */
+    }
+    else {
+#if PY_VERSION_HEX < 0x03070000
+        /* PyEval_InitThreads() is always a no-op from CPython 3.7 */
+        PyGILState_STATE state = PyGILState_Ensure();
+        PyEval_InitThreads();
+        PyGILState_Release(state);
+#endif
+    }
+
+#ifdef WITH_THREAD
+    /* release the lock */
+    while (!cffi_compare_and_swap(lock, locked_value, old_value))
+        ;
+#endif
+
+    return 0;
+}
+
+/**********  end CPython-specific section  **********/
+
+
+#else
+
+
+/**********  PyPy-specific section  **********/
+
+PyMODINIT_FUNC _CFFI_PYTHON_STARTUP_FUNC(const void *[]);   /* forward */
+
+static struct _cffi_pypy_init_s {
+    const char *name;
+    void *func;    /* function pointer */
+    const char *code;
+} _cffi_pypy_init = {
+    _CFFI_MODULE_NAME,
+    _CFFI_PYTHON_STARTUP_FUNC,
+    _CFFI_PYTHON_STARTUP_CODE,
+};
+
+extern int pypy_carefully_make_gil(const char *);
+extern int pypy_init_embedded_cffi_module(int, struct _cffi_pypy_init_s *);
+
+static int _cffi_carefully_make_gil(void)
+{
+    return pypy_carefully_make_gil(_CFFI_MODULE_NAME);
+}
+
+static int _cffi_initialize_python(void)
+{
+    return pypy_init_embedded_cffi_module(0xB011, &_cffi_pypy_init);
+}
+
+/**********  end PyPy-specific section  **********/
+
+
+#endif
+
+
+#ifdef __GNUC__
+__attribute__((noinline))
+#endif
+static _cffi_call_python_fnptr _cffi_start_python(void)
+{
+    /* Delicate logic to initialize Python.  This function can be
+       called multiple times concurrently, e.g. when the process calls
+       its first ``extern "Python"`` functions in multiple threads at
+       once.  It can also be called recursively, in which case we must
+       ignore it.  We also have to consider what occurs if several
+       different cffi-based extensions reach this code in parallel
+       threads---it is a different copy of the code, then, and we
+       can't have any shared global variable unless it comes from
+       'libpythonX.Y.so'.
+
+       Idea:
+
+       * _cffi_carefully_make_gil(): "carefully" call
+         PyEval_InitThreads() (possibly with Py_InitializeEx() first).
+
+       * then we use a (local) custom lock to make sure that a call to this
+         cffi-based extension will wait if another call to the *same*
+         extension is running the initialization in another thread.
+         It is reentrant, so that a recursive call will not block, but
+         only one from a different thread.
+
+       * then we grab the GIL and (Python 2) we call Py_InitializeEx().
+         At this point, concurrent calls to Py_InitializeEx() are not
+         possible: we have the GIL.
+
+       * do the rest of the specific initialization, which may
+         temporarily release the GIL but not the custom lock.
+         Only release the custom lock when we are done.
+    */
+    static char called = 0;
+
+    if (_cffi_carefully_make_gil() != 0)
+        return NULL;
+
+    _cffi_acquire_reentrant_mutex();
+
+    /* Here the GIL exists, but we don't have it.  We're only protected
+       from concurrency by the reentrant mutex. */
+
+    /* This file only initializes the embedded module once, the first
+       time this is called, even if there are subinterpreters. */
+    if (!called) {
+        called = 1;  /* invoke _cffi_initialize_python() only once,
+                        but don't set '_cffi_call_python' right now,
+                        otherwise concurrent threads won't call
+                        this function at all (we need them to wait) */
+        if (_cffi_initialize_python() == 0) {
+            /* now initialization is finished.  Switch to the fast-path. */
+
+            /* We would like nobody to see the new value of
+               '_cffi_call_python' without also seeing the rest of the
+               data initialized.  However, this is not possible.  But
+               the new value of '_cffi_call_python' is the function
+               'cffi_call_python()' from _cffi_backend.  So:  */
+            cffi_write_barrier();
+            /* ^^^ we put a write barrier here, and a corresponding
+               read barrier at the start of cffi_call_python().  This
+               ensures that after that read barrier, we see everything
+               done here before the write barrier.
+            */
+
+            assert(_cffi_call_python_org != NULL);
+            _cffi_call_python = (_cffi_call_python_fnptr)_cffi_call_python_org;
+        }
+        else {
+            /* initialization failed.  Reset this to NULL, even if it was
+               already set to some other value.  Future calls to
+               _cffi_start_python() are still forced to occur, and will
+               always return NULL from now on. */
+            _cffi_call_python_org = NULL;
+        }
+    }
+
+    _cffi_release_reentrant_mutex();
+
+    return (_cffi_call_python_fnptr)_cffi_call_python_org;
+}
+
+static
+void _cffi_start_and_call_python(struct _cffi_externpy_s *externpy, char *args)
+{
+    _cffi_call_python_fnptr fnptr;
+    int current_err = errno;
+#ifdef _MSC_VER
+    int current_lasterr = GetLastError();
+#endif
+    fnptr = _cffi_start_python();
+    if (fnptr == NULL) {
+        fprintf(stderr, "function %s() called, but initialization code "
+                        "failed.  Returning 0.\n", externpy->name);
+        memset(args, 0, externpy->size_of_result);
+    }
+#ifdef _MSC_VER
+    SetLastError(current_lasterr);
+#endif
+    errno = current_err;
+
+    if (fnptr != NULL)
+        fnptr(externpy, args);
+}
+
+
+/* The cffi_start_python() function makes sure Python is initialized
+   and our cffi module is set up.  It can be called manually from the
+   user C code.  The same effect is obtained automatically from any
+   dll-exported ``extern "Python"`` function.  This function returns
+   -1 if initialization failed, 0 if all is OK.  */
+_CFFI_UNUSED_FN
+static int cffi_start_python(void)
+{
+    if (_cffi_call_python == &_cffi_start_and_call_python) {
+        if (_cffi_start_python() == NULL)
+            return -1;
+    }
+    cffi_read_barrier();
+    return 0;
+}
+
+#undef cffi_compare_and_swap
+#undef cffi_write_barrier
+#undef cffi_read_barrier
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/_imp_emulation.py b/TP03/TP03/lib/python3.9/site-packages/cffi/_imp_emulation.py
new file mode 100644
index 0000000000000000000000000000000000000000..136abdddf9d1276095e6f6724298ac19811c136a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/_imp_emulation.py
@@ -0,0 +1,83 @@
+
+try:
+    # this works on Python < 3.12
+    from imp import *
+
+except ImportError:
+    # this is a limited emulation for Python >= 3.12.
+    # Note that this is used only for tests or for the old ffi.verify().
+    # This is copied from the source code of Python 3.11.
+
+    from _imp import (acquire_lock, release_lock,
+                      is_builtin, is_frozen)
+
+    from importlib._bootstrap import _load
+
+    from importlib import machinery
+    import os
+    import sys
+    import tokenize
+
+    SEARCH_ERROR = 0
+    PY_SOURCE = 1
+    PY_COMPILED = 2
+    C_EXTENSION = 3
+    PY_RESOURCE = 4
+    PKG_DIRECTORY = 5
+    C_BUILTIN = 6
+    PY_FROZEN = 7
+    PY_CODERESOURCE = 8
+    IMP_HOOK = 9
+
+    def get_suffixes():
+        extensions = [(s, 'rb', C_EXTENSION)
+                      for s in machinery.EXTENSION_SUFFIXES]
+        source = [(s, 'r', PY_SOURCE) for s in machinery.SOURCE_SUFFIXES]
+        bytecode = [(s, 'rb', PY_COMPILED) for s in machinery.BYTECODE_SUFFIXES]
+        return extensions + source + bytecode
+
+    def find_module(name, path=None):
+        if not isinstance(name, str):
+            raise TypeError("'name' must be a str, not {}".format(type(name)))
+        elif not isinstance(path, (type(None), list)):
+            # Backwards-compatibility
+            raise RuntimeError("'path' must be None or a list, "
+                               "not {}".format(type(path)))
+
+        if path is None:
+            if is_builtin(name):
+                return None, None, ('', '', C_BUILTIN)
+            elif is_frozen(name):
+                return None, None, ('', '', PY_FROZEN)
+            else:
+                path = sys.path
+
+        for entry in path:
+            package_directory = os.path.join(entry, name)
+            for suffix in ['.py', machinery.BYTECODE_SUFFIXES[0]]:
+                package_file_name = '__init__' + suffix
+                file_path = os.path.join(package_directory, package_file_name)
+                if os.path.isfile(file_path):
+                    return None, package_directory, ('', '', PKG_DIRECTORY)
+            for suffix, mode, type_ in get_suffixes():
+                file_name = name + suffix
+                file_path = os.path.join(entry, file_name)
+                if os.path.isfile(file_path):
+                    break
+            else:
+                continue
+            break  # Break out of outer loop when breaking out of inner loop.
+        else:
+            raise ImportError(name, name=name)
+
+        encoding = None
+        if 'b' not in mode:
+            with open(file_path, 'rb') as file:
+                encoding = tokenize.detect_encoding(file.readline)[0]
+        file = open(file_path, mode, encoding=encoding)
+        return file, file_path, (suffix, mode, type_)
+
+    def load_dynamic(name, path, file=None):
+        loader = machinery.ExtensionFileLoader(name, path)
+        spec = machinery.ModuleSpec(name=name, loader=loader, origin=path)
+        return _load(spec)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/_shimmed_dist_utils.py b/TP03/TP03/lib/python3.9/site-packages/cffi/_shimmed_dist_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..611bf40f40ffbda6d9514ef40996947dd6f5097c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/_shimmed_dist_utils.py
@@ -0,0 +1,41 @@
+"""
+Temporary shim module to indirect the bits of distutils we need from setuptools/distutils while providing useful
+error messages beyond `No module named 'distutils' on Python >= 3.12, or when setuptools' vendored distutils is broken.
+
+This is a compromise to avoid a hard-dep on setuptools for Python >= 3.12, since many users don't need runtime compilation support from CFFI.
+"""
+import sys
+
+try:
+    # import setuptools first; this is the most robust way to ensure its embedded distutils is available
+    # (the .pth shim should usually work, but this is even more robust)
+    import setuptools
+except Exception as ex:
+    if sys.version_info >= (3, 12):
+        # Python 3.12 has no built-in distutils to fall back on, so any import problem is fatal
+        raise Exception("This CFFI feature requires setuptools on Python >= 3.12. The setuptools module is missing or non-functional.") from ex
+
+    # silently ignore on older Pythons (support fallback to stdlib distutils where available)
+else:
+    del setuptools
+
+try:
+    # bring in just the bits of distutils we need, whether they really came from setuptools or stdlib-embedded distutils
+    from distutils import log, sysconfig
+    from distutils.ccompiler import CCompiler
+    from distutils.command.build_ext import build_ext
+    from distutils.core import Distribution, Extension
+    from distutils.dir_util import mkpath
+    from distutils.errors import DistutilsSetupError, CompileError, LinkError
+    from distutils.log import set_threshold, set_verbosity
+
+    if sys.platform == 'win32':
+        from distutils.msvc9compiler import MSVCCompiler
+except Exception as ex:
+    if sys.version_info >= (3, 12):
+        raise Exception("This CFFI feature requires setuptools on Python >= 3.12. Please install the setuptools package.") from ex
+
+    # anything older, just let the underlying distutils import error fly
+    raise Exception("This CFFI feature requires distutils. Please install the distutils or setuptools package.") from ex
+
+del sys
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/api.py b/TP03/TP03/lib/python3.9/site-packages/cffi/api.py
new file mode 100644
index 0000000000000000000000000000000000000000..edeb7928107c7f8bc56411f67013f4ea08403860
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/api.py
@@ -0,0 +1,965 @@
+import sys, types
+from .lock import allocate_lock
+from .error import CDefError
+from . import model
+
+try:
+    callable
+except NameError:
+    # Python 3.1
+    from collections import Callable
+    callable = lambda x: isinstance(x, Callable)
+
+try:
+    basestring
+except NameError:
+    # Python 3.x
+    basestring = str
+
+_unspecified = object()
+
+
+
+class FFI(object):
+    r'''
+    The main top-level class that you instantiate once, or once per module.
+
+    Example usage:
+
+        ffi = FFI()
+        ffi.cdef("""
+            int printf(const char *, ...);
+        """)
+
+        C = ffi.dlopen(None)   # standard library
+        -or-
+        C = ffi.verify()  # use a C compiler: verify the decl above is right
+
+        C.printf("hello, %s!\n", ffi.new("char[]", "world"))
+    '''
+
+    def __init__(self, backend=None):
+        """Create an FFI instance.  The 'backend' argument is used to
+        select a non-default backend, mostly for tests.
+        """
+        if backend is None:
+            # You need PyPy (>= 2.0 beta), or a CPython (>= 2.6) with
+            # _cffi_backend.so compiled.
+            import _cffi_backend as backend
+            from . import __version__
+            if backend.__version__ != __version__:
+                # bad version!  Try to be as explicit as possible.
+                if hasattr(backend, '__file__'):
+                    # CPython
+                    raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r.  When we import the top-level '_cffi_backend' extension module, we get version %s, located in %r.  The two versions should be equal; check your installation." % (
+                        __version__, __file__,
+                        backend.__version__, backend.__file__))
+                else:
+                    # PyPy
+                    raise Exception("Version mismatch: this is the 'cffi' package version %s, located in %r.  This interpreter comes with a built-in '_cffi_backend' module, which is version %s.  The two versions should be equal; check your installation." % (
+                        __version__, __file__, backend.__version__))
+            # (If you insist you can also try to pass the option
+            # 'backend=backend_ctypes.CTypesBackend()', but don't
+            # rely on it!  It's probably not going to work well.)
+
+        from . import cparser
+        self._backend = backend
+        self._lock = allocate_lock()
+        self._parser = cparser.Parser()
+        self._cached_btypes = {}
+        self._parsed_types = types.ModuleType('parsed_types').__dict__
+        self._new_types = types.ModuleType('new_types').__dict__
+        self._function_caches = []
+        self._libraries = []
+        self._cdefsources = []
+        self._included_ffis = []
+        self._windows_unicode = None
+        self._init_once_cache = {}
+        self._cdef_version = None
+        self._embedding = None
+        self._typecache = model.get_typecache(backend)
+        if hasattr(backend, 'set_ffi'):
+            backend.set_ffi(self)
+        for name in list(backend.__dict__):
+            if name.startswith('RTLD_'):
+                setattr(self, name, getattr(backend, name))
+        #
+        with self._lock:
+            self.BVoidP = self._get_cached_btype(model.voidp_type)
+            self.BCharA = self._get_cached_btype(model.char_array_type)
+        if isinstance(backend, types.ModuleType):
+            # _cffi_backend: attach these constants to the class
+            if not hasattr(FFI, 'NULL'):
+                FFI.NULL = self.cast(self.BVoidP, 0)
+                FFI.CData, FFI.CType = backend._get_types()
+        else:
+            # ctypes backend: attach these constants to the instance
+            self.NULL = self.cast(self.BVoidP, 0)
+            self.CData, self.CType = backend._get_types()
+        self.buffer = backend.buffer
+
+    def cdef(self, csource, override=False, packed=False, pack=None):
+        """Parse the given C source.  This registers all declared functions,
+        types, and global variables.  The functions and global variables can
+        then be accessed via either 'ffi.dlopen()' or 'ffi.verify()'.
+        The types can be used in 'ffi.new()' and other functions.
+        If 'packed' is specified as True, all structs declared inside this
+        cdef are packed, i.e. laid out without any field alignment at all.
+        Alternatively, 'pack' can be a small integer, and requests for
+        alignment greater than that are ignored (pack=1 is equivalent to
+        packed=True).
+        """
+        self._cdef(csource, override=override, packed=packed, pack=pack)
+
+    def embedding_api(self, csource, packed=False, pack=None):
+        self._cdef(csource, packed=packed, pack=pack, dllexport=True)
+        if self._embedding is None:
+            self._embedding = ''
+
+    def _cdef(self, csource, override=False, **options):
+        if not isinstance(csource, str):    # unicode, on Python 2
+            if not isinstance(csource, basestring):
+                raise TypeError("cdef() argument must be a string")
+            csource = csource.encode('ascii')
+        with self._lock:
+            self._cdef_version = object()
+            self._parser.parse(csource, override=override, **options)
+            self._cdefsources.append(csource)
+            if override:
+                for cache in self._function_caches:
+                    cache.clear()
+            finishlist = self._parser._recomplete
+            if finishlist:
+                self._parser._recomplete = []
+                for tp in finishlist:
+                    tp.finish_backend_type(self, finishlist)
+
+    def dlopen(self, name, flags=0):
+        """Load and return a dynamic library identified by 'name'.
+        The standard C library can be loaded by passing None.
+        Note that functions and types declared by 'ffi.cdef()' are not
+        linked to a particular library, just like C headers; in the
+        library we only look for the actual (untyped) symbols.
+        """
+        if not (isinstance(name, basestring) or
+                name is None or
+                isinstance(name, self.CData)):
+            raise TypeError("dlopen(name): name must be a file name, None, "
+                            "or an already-opened 'void *' handle")
+        with self._lock:
+            lib, function_cache = _make_ffi_library(self, name, flags)
+            self._function_caches.append(function_cache)
+            self._libraries.append(lib)
+        return lib
+
+    def dlclose(self, lib):
+        """Close a library obtained with ffi.dlopen().  After this call,
+        access to functions or variables from the library will fail
+        (possibly with a segmentation fault).
+        """
+        type(lib).__cffi_close__(lib)
+
+    def _typeof_locked(self, cdecl):
+        # call me with the lock!
+        key = cdecl
+        if key in self._parsed_types:
+            return self._parsed_types[key]
+        #
+        if not isinstance(cdecl, str):    # unicode, on Python 2
+            cdecl = cdecl.encode('ascii')
+        #
+        type = self._parser.parse_type(cdecl)
+        really_a_function_type = type.is_raw_function
+        if really_a_function_type:
+            type = type.as_function_pointer()
+        btype = self._get_cached_btype(type)
+        result = btype, really_a_function_type
+        self._parsed_types[key] = result
+        return result
+
+    def _typeof(self, cdecl, consider_function_as_funcptr=False):
+        # string -> ctype object
+        try:
+            result = self._parsed_types[cdecl]
+        except KeyError:
+            with self._lock:
+                result = self._typeof_locked(cdecl)
+        #
+        btype, really_a_function_type = result
+        if really_a_function_type and not consider_function_as_funcptr:
+            raise CDefError("the type %r is a function type, not a "
+                            "pointer-to-function type" % (cdecl,))
+        return btype
+
+    def typeof(self, cdecl):
+        """Parse the C type given as a string and return the
+        corresponding <ctype> object.
+        It can also be used on 'cdata' instance to get its C type.
+        """
+        if isinstance(cdecl, basestring):
+            return self._typeof(cdecl)
+        if isinstance(cdecl, self.CData):
+            return self._backend.typeof(cdecl)
+        if isinstance(cdecl, types.BuiltinFunctionType):
+            res = _builtin_function_type(cdecl)
+            if res is not None:
+                return res
+        if (isinstance(cdecl, types.FunctionType)
+                and hasattr(cdecl, '_cffi_base_type')):
+            with self._lock:
+                return self._get_cached_btype(cdecl._cffi_base_type)
+        raise TypeError(type(cdecl))
+
+    def sizeof(self, cdecl):
+        """Return the size in bytes of the argument.  It can be a
+        string naming a C type, or a 'cdata' instance.
+        """
+        if isinstance(cdecl, basestring):
+            BType = self._typeof(cdecl)
+            return self._backend.sizeof(BType)
+        else:
+            return self._backend.sizeof(cdecl)
+
+    def alignof(self, cdecl):
+        """Return the natural alignment size in bytes of the C type
+        given as a string.
+        """
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        return self._backend.alignof(cdecl)
+
+    def offsetof(self, cdecl, *fields_or_indexes):
+        """Return the offset of the named field inside the given
+        structure or array, which must be given as a C type name.
+        You can give several field names in case of nested structures.
+        You can also give numeric values which correspond to array
+        items, in case of an array type.
+        """
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        return self._typeoffsetof(cdecl, *fields_or_indexes)[1]
+
+    def new(self, cdecl, init=None):
+        """Allocate an instance according to the specified C type and
+        return a pointer to it.  The specified C type must be either a
+        pointer or an array: ``new('X *')`` allocates an X and returns
+        a pointer to it, whereas ``new('X[n]')`` allocates an array of
+        n X'es and returns an array referencing it (which works
+        mostly like a pointer, like in C).  You can also use
+        ``new('X[]', n)`` to allocate an array of a non-constant
+        length n.
+
+        The memory is initialized following the rules of declaring a
+        global variable in C: by default it is zero-initialized, but
+        an explicit initializer can be given which can be used to
+        fill all or part of the memory.
+
+        When the returned <cdata> object goes out of scope, the memory
+        is freed.  In other words the returned <cdata> object has
+        ownership of the value of type 'cdecl' that it points to.  This
+        means that the raw data can be used as long as this object is
+        kept alive, but must not be used for a longer time.  Be careful
+        about that when copying the pointer to the memory somewhere
+        else, e.g. into another structure.
+        """
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        return self._backend.newp(cdecl, init)
+
+    def new_allocator(self, alloc=None, free=None,
+                      should_clear_after_alloc=True):
+        """Return a new allocator, i.e. a function that behaves like ffi.new()
+        but uses the provided low-level 'alloc' and 'free' functions.
+
+        'alloc' is called with the size as argument.  If it returns NULL, a
+        MemoryError is raised.  'free' is called with the result of 'alloc'
+        as argument.  Both can be either Python function or directly C
+        functions.  If 'free' is None, then no free function is called.
+        If both 'alloc' and 'free' are None, the default is used.
+
+        If 'should_clear_after_alloc' is set to False, then the memory
+        returned by 'alloc' is assumed to be already cleared (or you are
+        fine with garbage); otherwise CFFI will clear it.
+        """
+        compiled_ffi = self._backend.FFI()
+        allocator = compiled_ffi.new_allocator(alloc, free,
+                                               should_clear_after_alloc)
+        def allocate(cdecl, init=None):
+            if isinstance(cdecl, basestring):
+                cdecl = self._typeof(cdecl)
+            return allocator(cdecl, init)
+        return allocate
+
+    def cast(self, cdecl, source):
+        """Similar to a C cast: returns an instance of the named C
+        type initialized with the given 'source'.  The source is
+        casted between integers or pointers of any type.
+        """
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        return self._backend.cast(cdecl, source)
+
+    def string(self, cdata, maxlen=-1):
+        """Return a Python string (or unicode string) from the 'cdata'.
+        If 'cdata' is a pointer or array of characters or bytes, returns
+        the null-terminated string.  The returned string extends until
+        the first null character, or at most 'maxlen' characters.  If
+        'cdata' is an array then 'maxlen' defaults to its length.
+
+        If 'cdata' is a pointer or array of wchar_t, returns a unicode
+        string following the same rules.
+
+        If 'cdata' is a single character or byte or a wchar_t, returns
+        it as a string or unicode string.
+
+        If 'cdata' is an enum, returns the value of the enumerator as a
+        string, or 'NUMBER' if the value is out of range.
+        """
+        return self._backend.string(cdata, maxlen)
+
+    def unpack(self, cdata, length):
+        """Unpack an array of C data of the given length,
+        returning a Python string/unicode/list.
+
+        If 'cdata' is a pointer to 'char', returns a byte string.
+        It does not stop at the first null.  This is equivalent to:
+        ffi.buffer(cdata, length)[:]
+
+        If 'cdata' is a pointer to 'wchar_t', returns a unicode string.
+        'length' is measured in wchar_t's; it is not the size in bytes.
+
+        If 'cdata' is a pointer to anything else, returns a list of
+        'length' items.  This is a faster equivalent to:
+        [cdata[i] for i in range(length)]
+        """
+        return self._backend.unpack(cdata, length)
+
+   #def buffer(self, cdata, size=-1):
+   #    """Return a read-write buffer object that references the raw C data
+   #    pointed to by the given 'cdata'.  The 'cdata' must be a pointer or
+   #    an array.  Can be passed to functions expecting a buffer, or directly
+   #    manipulated with:
+   #
+   #        buf[:]          get a copy of it in a regular string, or
+   #        buf[idx]        as a single character
+   #        buf[:] = ...
+   #        buf[idx] = ...  change the content
+   #    """
+   #    note that 'buffer' is a type, set on this instance by __init__
+
+    def from_buffer(self, cdecl, python_buffer=_unspecified,
+                    require_writable=False):
+        """Return a cdata of the given type pointing to the data of the
+        given Python object, which must support the buffer interface.
+        Note that this is not meant to be used on the built-in types
+        str or unicode (you can build 'char[]' arrays explicitly)
+        but only on objects containing large quantities of raw data
+        in some other format, like 'array.array' or numpy arrays.
+
+        The first argument is optional and default to 'char[]'.
+        """
+        if python_buffer is _unspecified:
+            cdecl, python_buffer = self.BCharA, cdecl
+        elif isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        return self._backend.from_buffer(cdecl, python_buffer,
+                                         require_writable)
+
+    def memmove(self, dest, src, n):
+        """ffi.memmove(dest, src, n) copies n bytes of memory from src to dest.
+
+        Like the C function memmove(), the memory areas may overlap;
+        apart from that it behaves like the C function memcpy().
+
+        'src' can be any cdata ptr or array, or any Python buffer object.
+        'dest' can be any cdata ptr or array, or a writable Python buffer
+        object.  The size to copy, 'n', is always measured in bytes.
+
+        Unlike other methods, this one supports all Python buffer including
+        byte strings and bytearrays---but it still does not support
+        non-contiguous buffers.
+        """
+        return self._backend.memmove(dest, src, n)
+
+    def callback(self, cdecl, python_callable=None, error=None, onerror=None):
+        """Return a callback object or a decorator making such a
+        callback object.  'cdecl' must name a C function pointer type.
+        The callback invokes the specified 'python_callable' (which may
+        be provided either directly or via a decorator).  Important: the
+        callback object must be manually kept alive for as long as the
+        callback may be invoked from the C level.
+        """
+        def callback_decorator_wrap(python_callable):
+            if not callable(python_callable):
+                raise TypeError("the 'python_callable' argument "
+                                "is not callable")
+            return self._backend.callback(cdecl, python_callable,
+                                          error, onerror)
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl, consider_function_as_funcptr=True)
+        if python_callable is None:
+            return callback_decorator_wrap                # decorator mode
+        else:
+            return callback_decorator_wrap(python_callable)  # direct mode
+
+    def getctype(self, cdecl, replace_with=''):
+        """Return a string giving the C type 'cdecl', which may be itself
+        a string or a <ctype> object.  If 'replace_with' is given, it gives
+        extra text to append (or insert for more complicated C types), like
+        a variable name, or '*' to get actually the C type 'pointer-to-cdecl'.
+        """
+        if isinstance(cdecl, basestring):
+            cdecl = self._typeof(cdecl)
+        replace_with = replace_with.strip()
+        if (replace_with.startswith('*')
+                and '&[' in self._backend.getcname(cdecl, '&')):
+            replace_with = '(%s)' % replace_with
+        elif replace_with and not replace_with[0] in '[(':
+            replace_with = ' ' + replace_with
+        return self._backend.getcname(cdecl, replace_with)
+
+    def gc(self, cdata, destructor, size=0):
+        """Return a new cdata object that points to the same
+        data.  Later, when this new cdata object is garbage-collected,
+        'destructor(old_cdata_object)' will be called.
+
+        The optional 'size' gives an estimate of the size, used to
+        trigger the garbage collection more eagerly.  So far only used
+        on PyPy.  It tells the GC that the returned object keeps alive
+        roughly 'size' bytes of external memory.
+        """
+        return self._backend.gcp(cdata, destructor, size)
+
+    def _get_cached_btype(self, type):
+        assert self._lock.acquire(False) is False
+        # call me with the lock!
+        try:
+            BType = self._cached_btypes[type]
+        except KeyError:
+            finishlist = []
+            BType = type.get_cached_btype(self, finishlist)
+            for type in finishlist:
+                type.finish_backend_type(self, finishlist)
+        return BType
+
+    def verify(self, source='', tmpdir=None, **kwargs):
+        """Verify that the current ffi signatures compile on this
+        machine, and return a dynamic library object.  The dynamic
+        library can be used to call functions and access global
+        variables declared in this 'ffi'.  The library is compiled
+        by the C compiler: it gives you C-level API compatibility
+        (including calling macros).  This is unlike 'ffi.dlopen()',
+        which requires binary compatibility in the signatures.
+        """
+        from .verifier import Verifier, _caller_dir_pycache
+        #
+        # If set_unicode(True) was called, insert the UNICODE and
+        # _UNICODE macro declarations
+        if self._windows_unicode:
+            self._apply_windows_unicode(kwargs)
+        #
+        # Set the tmpdir here, and not in Verifier.__init__: it picks
+        # up the caller's directory, which we want to be the caller of
+        # ffi.verify(), as opposed to the caller of Veritier().
+        tmpdir = tmpdir or _caller_dir_pycache()
+        #
+        # Make a Verifier() and use it to load the library.
+        self.verifier = Verifier(self, source, tmpdir, **kwargs)
+        lib = self.verifier.load_library()
+        #
+        # Save the loaded library for keep-alive purposes, even
+        # if the caller doesn't keep it alive itself (it should).
+        self._libraries.append(lib)
+        return lib
+
+    def _get_errno(self):
+        return self._backend.get_errno()
+    def _set_errno(self, errno):
+        self._backend.set_errno(errno)
+    errno = property(_get_errno, _set_errno, None,
+                     "the value of 'errno' from/to the C calls")
+
+    def getwinerror(self, code=-1):
+        return self._backend.getwinerror(code)
+
+    def _pointer_to(self, ctype):
+        with self._lock:
+            return model.pointer_cache(self, ctype)
+
+    def addressof(self, cdata, *fields_or_indexes):
+        """Return the address of a <cdata 'struct-or-union'>.
+        If 'fields_or_indexes' are given, returns the address of that
+        field or array item in the structure or array, recursively in
+        case of nested structures.
+        """
+        try:
+            ctype = self._backend.typeof(cdata)
+        except TypeError:
+            if '__addressof__' in type(cdata).__dict__:
+                return type(cdata).__addressof__(cdata, *fields_or_indexes)
+            raise
+        if fields_or_indexes:
+            ctype, offset = self._typeoffsetof(ctype, *fields_or_indexes)
+        else:
+            if ctype.kind == "pointer":
+                raise TypeError("addressof(pointer)")
+            offset = 0
+        ctypeptr = self._pointer_to(ctype)
+        return self._backend.rawaddressof(ctypeptr, cdata, offset)
+
+    def _typeoffsetof(self, ctype, field_or_index, *fields_or_indexes):
+        ctype, offset = self._backend.typeoffsetof(ctype, field_or_index)
+        for field1 in fields_or_indexes:
+            ctype, offset1 = self._backend.typeoffsetof(ctype, field1, 1)
+            offset += offset1
+        return ctype, offset
+
+    def include(self, ffi_to_include):
+        """Includes the typedefs, structs, unions and enums defined
+        in another FFI instance.  Usage is similar to a #include in C,
+        where a part of the program might include types defined in
+        another part for its own usage.  Note that the include()
+        method has no effect on functions, constants and global
+        variables, which must anyway be accessed directly from the
+        lib object returned by the original FFI instance.
+        """
+        if not isinstance(ffi_to_include, FFI):
+            raise TypeError("ffi.include() expects an argument that is also of"
+                            " type cffi.FFI, not %r" % (
+                                type(ffi_to_include).__name__,))
+        if ffi_to_include is self:
+            raise ValueError("self.include(self)")
+        with ffi_to_include._lock:
+            with self._lock:
+                self._parser.include(ffi_to_include._parser)
+                self._cdefsources.append('[')
+                self._cdefsources.extend(ffi_to_include._cdefsources)
+                self._cdefsources.append(']')
+                self._included_ffis.append(ffi_to_include)
+
+    def new_handle(self, x):
+        return self._backend.newp_handle(self.BVoidP, x)
+
+    def from_handle(self, x):
+        return self._backend.from_handle(x)
+
+    def release(self, x):
+        self._backend.release(x)
+
+    def set_unicode(self, enabled_flag):
+        """Windows: if 'enabled_flag' is True, enable the UNICODE and
+        _UNICODE defines in C, and declare the types like TCHAR and LPTCSTR
+        to be (pointers to) wchar_t.  If 'enabled_flag' is False,
+        declare these types to be (pointers to) plain 8-bit characters.
+        This is mostly for backward compatibility; you usually want True.
+        """
+        if self._windows_unicode is not None:
+            raise ValueError("set_unicode() can only be called once")
+        enabled_flag = bool(enabled_flag)
+        if enabled_flag:
+            self.cdef("typedef wchar_t TBYTE;"
+                      "typedef wchar_t TCHAR;"
+                      "typedef const wchar_t *LPCTSTR;"
+                      "typedef const wchar_t *PCTSTR;"
+                      "typedef wchar_t *LPTSTR;"
+                      "typedef wchar_t *PTSTR;"
+                      "typedef TBYTE *PTBYTE;"
+                      "typedef TCHAR *PTCHAR;")
+        else:
+            self.cdef("typedef char TBYTE;"
+                      "typedef char TCHAR;"
+                      "typedef const char *LPCTSTR;"
+                      "typedef const char *PCTSTR;"
+                      "typedef char *LPTSTR;"
+                      "typedef char *PTSTR;"
+                      "typedef TBYTE *PTBYTE;"
+                      "typedef TCHAR *PTCHAR;")
+        self._windows_unicode = enabled_flag
+
+    def _apply_windows_unicode(self, kwds):
+        defmacros = kwds.get('define_macros', ())
+        if not isinstance(defmacros, (list, tuple)):
+            raise TypeError("'define_macros' must be a list or tuple")
+        defmacros = list(defmacros) + [('UNICODE', '1'),
+                                       ('_UNICODE', '1')]
+        kwds['define_macros'] = defmacros
+
+    def _apply_embedding_fix(self, kwds):
+        # must include an argument like "-lpython2.7" for the compiler
+        def ensure(key, value):
+            lst = kwds.setdefault(key, [])
+            if value not in lst:
+                lst.append(value)
+        #
+        if '__pypy__' in sys.builtin_module_names:
+            import os
+            if sys.platform == "win32":
+                # we need 'libpypy-c.lib'.  Current distributions of
+                # pypy (>= 4.1) contain it as 'libs/python27.lib'.
+                pythonlib = "python{0[0]}{0[1]}".format(sys.version_info)
+                if hasattr(sys, 'prefix'):
+                    ensure('library_dirs', os.path.join(sys.prefix, 'libs'))
+            else:
+                # we need 'libpypy-c.{so,dylib}', which should be by
+                # default located in 'sys.prefix/bin' for installed
+                # systems.
+                if sys.version_info < (3,):
+                    pythonlib = "pypy-c"
+                else:
+                    pythonlib = "pypy3-c"
+                if hasattr(sys, 'prefix'):
+                    ensure('library_dirs', os.path.join(sys.prefix, 'bin'))
+            # On uninstalled pypy's, the libpypy-c is typically found in
+            # .../pypy/goal/.
+            if hasattr(sys, 'prefix'):
+                ensure('library_dirs', os.path.join(sys.prefix, 'pypy', 'goal'))
+        else:
+            if sys.platform == "win32":
+                template = "python%d%d"
+                if hasattr(sys, 'gettotalrefcount'):
+                    template += '_d'
+            else:
+                try:
+                    import sysconfig
+                except ImportError:    # 2.6
+                    from cffi._shimmed_dist_utils import sysconfig
+                template = "python%d.%d"
+                if sysconfig.get_config_var('DEBUG_EXT'):
+                    template += sysconfig.get_config_var('DEBUG_EXT')
+            pythonlib = (template %
+                    (sys.hexversion >> 24, (sys.hexversion >> 16) & 0xff))
+            if hasattr(sys, 'abiflags'):
+                pythonlib += sys.abiflags
+        ensure('libraries', pythonlib)
+        if sys.platform == "win32":
+            ensure('extra_link_args', '/MANIFEST')
+
+    def set_source(self, module_name, source, source_extension='.c', **kwds):
+        import os
+        if hasattr(self, '_assigned_source'):
+            raise ValueError("set_source() cannot be called several times "
+                             "per ffi object")
+        if not isinstance(module_name, basestring):
+            raise TypeError("'module_name' must be a string")
+        if os.sep in module_name or (os.altsep and os.altsep in module_name):
+            raise ValueError("'module_name' must not contain '/': use a dotted "
+                             "name to make a 'package.module' location")
+        self._assigned_source = (str(module_name), source,
+                                 source_extension, kwds)
+
+    def set_source_pkgconfig(self, module_name, pkgconfig_libs, source,
+                             source_extension='.c', **kwds):
+        from . import pkgconfig
+        if not isinstance(pkgconfig_libs, list):
+            raise TypeError("the pkgconfig_libs argument must be a list "
+                            "of package names")
+        kwds2 = pkgconfig.flags_from_pkgconfig(pkgconfig_libs)
+        pkgconfig.merge_flags(kwds, kwds2)
+        self.set_source(module_name, source, source_extension, **kwds)
+
+    def distutils_extension(self, tmpdir='build', verbose=True):
+        from cffi._shimmed_dist_utils import mkpath
+        from .recompiler import recompile
+        #
+        if not hasattr(self, '_assigned_source'):
+            if hasattr(self, 'verifier'):     # fallback, 'tmpdir' ignored
+                return self.verifier.get_extension()
+            raise ValueError("set_source() must be called before"
+                             " distutils_extension()")
+        module_name, source, source_extension, kwds = self._assigned_source
+        if source is None:
+            raise TypeError("distutils_extension() is only for C extension "
+                            "modules, not for dlopen()-style pure Python "
+                            "modules")
+        mkpath(tmpdir)
+        ext, updated = recompile(self, module_name,
+                                 source, tmpdir=tmpdir, extradir=tmpdir,
+                                 source_extension=source_extension,
+                                 call_c_compiler=False, **kwds)
+        if verbose:
+            if updated:
+                sys.stderr.write("regenerated: %r\n" % (ext.sources[0],))
+            else:
+                sys.stderr.write("not modified: %r\n" % (ext.sources[0],))
+        return ext
+
+    def emit_c_code(self, filename):
+        from .recompiler import recompile
+        #
+        if not hasattr(self, '_assigned_source'):
+            raise ValueError("set_source() must be called before emit_c_code()")
+        module_name, source, source_extension, kwds = self._assigned_source
+        if source is None:
+            raise TypeError("emit_c_code() is only for C extension modules, "
+                            "not for dlopen()-style pure Python modules")
+        recompile(self, module_name, source,
+                  c_file=filename, call_c_compiler=False, **kwds)
+
+    def emit_python_code(self, filename):
+        from .recompiler import recompile
+        #
+        if not hasattr(self, '_assigned_source'):
+            raise ValueError("set_source() must be called before emit_c_code()")
+        module_name, source, source_extension, kwds = self._assigned_source
+        if source is not None:
+            raise TypeError("emit_python_code() is only for dlopen()-style "
+                            "pure Python modules, not for C extension modules")
+        recompile(self, module_name, source,
+                  c_file=filename, call_c_compiler=False, **kwds)
+
+    def compile(self, tmpdir='.', verbose=0, target=None, debug=None):
+        """The 'target' argument gives the final file name of the
+        compiled DLL.  Use '*' to force distutils' choice, suitable for
+        regular CPython C API modules.  Use a file name ending in '.*'
+        to ask for the system's default extension for dynamic libraries
+        (.so/.dll/.dylib).
+
+        The default is '*' when building a non-embedded C API extension,
+        and (module_name + '.*') when building an embedded library.
+        """
+        from .recompiler import recompile
+        #
+        if not hasattr(self, '_assigned_source'):
+            raise ValueError("set_source() must be called before compile()")
+        module_name, source, source_extension, kwds = self._assigned_source
+        return recompile(self, module_name, source, tmpdir=tmpdir,
+                         target=target, source_extension=source_extension,
+                         compiler_verbose=verbose, debug=debug, **kwds)
+
+    def init_once(self, func, tag):
+        # Read _init_once_cache[tag], which is either (False, lock) if
+        # we're calling the function now in some thread, or (True, result).
+        # Don't call setdefault() in most cases, to avoid allocating and
+        # immediately freeing a lock; but still use setdefaut() to avoid
+        # races.
+        try:
+            x = self._init_once_cache[tag]
+        except KeyError:
+            x = self._init_once_cache.setdefault(tag, (False, allocate_lock()))
+        # Common case: we got (True, result), so we return the result.
+        if x[0]:
+            return x[1]
+        # Else, it's a lock.  Acquire it to serialize the following tests.
+        with x[1]:
+            # Read again from _init_once_cache the current status.
+            x = self._init_once_cache[tag]
+            if x[0]:
+                return x[1]
+            # Call the function and store the result back.
+            result = func()
+            self._init_once_cache[tag] = (True, result)
+        return result
+
+    def embedding_init_code(self, pysource):
+        if self._embedding:
+            raise ValueError("embedding_init_code() can only be called once")
+        # fix 'pysource' before it gets dumped into the C file:
+        # - remove empty lines at the beginning, so it starts at "line 1"
+        # - dedent, if all non-empty lines are indented
+        # - check for SyntaxErrors
+        import re
+        match = re.match(r'\s*\n', pysource)
+        if match:
+            pysource = pysource[match.end():]
+        lines = pysource.splitlines() or ['']
+        prefix = re.match(r'\s*', lines[0]).group()
+        for i in range(1, len(lines)):
+            line = lines[i]
+            if line.rstrip():
+                while not line.startswith(prefix):
+                    prefix = prefix[:-1]
+        i = len(prefix)
+        lines = [line[i:]+'\n' for line in lines]
+        pysource = ''.join(lines)
+        #
+        compile(pysource, "cffi_init", "exec")
+        #
+        self._embedding = pysource
+
+    def def_extern(self, *args, **kwds):
+        raise ValueError("ffi.def_extern() is only available on API-mode FFI "
+                         "objects")
+
+    def list_types(self):
+        """Returns the user type names known to this FFI instance.
+        This returns a tuple containing three lists of names:
+        (typedef_names, names_of_structs, names_of_unions)
+        """
+        typedefs = []
+        structs = []
+        unions = []
+        for key in self._parser._declarations:
+            if key.startswith('typedef '):
+                typedefs.append(key[8:])
+            elif key.startswith('struct '):
+                structs.append(key[7:])
+            elif key.startswith('union '):
+                unions.append(key[6:])
+        typedefs.sort()
+        structs.sort()
+        unions.sort()
+        return (typedefs, structs, unions)
+
+
+def _load_backend_lib(backend, name, flags):
+    import os
+    if not isinstance(name, basestring):
+        if sys.platform != "win32" or name is not None:
+            return backend.load_library(name, flags)
+        name = "c"    # Windows: load_library(None) fails, but this works
+                      # on Python 2 (backward compatibility hack only)
+    first_error = None
+    if '.' in name or '/' in name or os.sep in name:
+        try:
+            return backend.load_library(name, flags)
+        except OSError as e:
+            first_error = e
+    import ctypes.util
+    path = ctypes.util.find_library(name)
+    if path is None:
+        if name == "c" and sys.platform == "win32" and sys.version_info >= (3,):
+            raise OSError("dlopen(None) cannot work on Windows for Python 3 "
+                          "(see http://bugs.python.org/issue23606)")
+        msg = ("ctypes.util.find_library() did not manage "
+               "to locate a library called %r" % (name,))
+        if first_error is not None:
+            msg = "%s.  Additionally, %s" % (first_error, msg)
+        raise OSError(msg)
+    return backend.load_library(path, flags)
+
+def _make_ffi_library(ffi, libname, flags):
+    backend = ffi._backend
+    backendlib = _load_backend_lib(backend, libname, flags)
+    #
+    def accessor_function(name):
+        key = 'function ' + name
+        tp, _ = ffi._parser._declarations[key]
+        BType = ffi._get_cached_btype(tp)
+        value = backendlib.load_function(BType, name)
+        library.__dict__[name] = value
+    #
+    def accessor_variable(name):
+        key = 'variable ' + name
+        tp, _ = ffi._parser._declarations[key]
+        BType = ffi._get_cached_btype(tp)
+        read_variable = backendlib.read_variable
+        write_variable = backendlib.write_variable
+        setattr(FFILibrary, name, property(
+            lambda self: read_variable(BType, name),
+            lambda self, value: write_variable(BType, name, value)))
+    #
+    def addressof_var(name):
+        try:
+            return addr_variables[name]
+        except KeyError:
+            with ffi._lock:
+                if name not in addr_variables:
+                    key = 'variable ' + name
+                    tp, _ = ffi._parser._declarations[key]
+                    BType = ffi._get_cached_btype(tp)
+                    if BType.kind != 'array':
+                        BType = model.pointer_cache(ffi, BType)
+                    p = backendlib.load_function(BType, name)
+                    addr_variables[name] = p
+            return addr_variables[name]
+    #
+    def accessor_constant(name):
+        raise NotImplementedError("non-integer constant '%s' cannot be "
+                                  "accessed from a dlopen() library" % (name,))
+    #
+    def accessor_int_constant(name):
+        library.__dict__[name] = ffi._parser._int_constants[name]
+    #
+    accessors = {}
+    accessors_version = [False]
+    addr_variables = {}
+    #
+    def update_accessors():
+        if accessors_version[0] is ffi._cdef_version:
+            return
+        #
+        for key, (tp, _) in ffi._parser._declarations.items():
+            if not isinstance(tp, model.EnumType):
+                tag, name = key.split(' ', 1)
+                if tag == 'function':
+                    accessors[name] = accessor_function
+                elif tag == 'variable':
+                    accessors[name] = accessor_variable
+                elif tag == 'constant':
+                    accessors[name] = accessor_constant
+            else:
+                for i, enumname in enumerate(tp.enumerators):
+                    def accessor_enum(name, tp=tp, i=i):
+                        tp.check_not_partial()
+                        library.__dict__[name] = tp.enumvalues[i]
+                    accessors[enumname] = accessor_enum
+        for name in ffi._parser._int_constants:
+            accessors.setdefault(name, accessor_int_constant)
+        accessors_version[0] = ffi._cdef_version
+    #
+    def make_accessor(name):
+        with ffi._lock:
+            if name in library.__dict__ or name in FFILibrary.__dict__:
+                return    # added by another thread while waiting for the lock
+            if name not in accessors:
+                update_accessors()
+                if name not in accessors:
+                    raise AttributeError(name)
+            accessors[name](name)
+    #
+    class FFILibrary(object):
+        def __getattr__(self, name):
+            make_accessor(name)
+            return getattr(self, name)
+        def __setattr__(self, name, value):
+            try:
+                property = getattr(self.__class__, name)
+            except AttributeError:
+                make_accessor(name)
+                setattr(self, name, value)
+            else:
+                property.__set__(self, value)
+        def __dir__(self):
+            with ffi._lock:
+                update_accessors()
+                return accessors.keys()
+        def __addressof__(self, name):
+            if name in library.__dict__:
+                return library.__dict__[name]
+            if name in FFILibrary.__dict__:
+                return addressof_var(name)
+            make_accessor(name)
+            if name in library.__dict__:
+                return library.__dict__[name]
+            if name in FFILibrary.__dict__:
+                return addressof_var(name)
+            raise AttributeError("cffi library has no function or "
+                                 "global variable named '%s'" % (name,))
+        def __cffi_close__(self):
+            backendlib.close_lib()
+            self.__dict__.clear()
+    #
+    if isinstance(libname, basestring):
+        try:
+            if not isinstance(libname, str):    # unicode, on Python 2
+                libname = libname.encode('utf-8')
+            FFILibrary.__name__ = 'FFILibrary_%s' % libname
+        except UnicodeError:
+            pass
+    library = FFILibrary()
+    return library, library.__dict__
+
+def _builtin_function_type(func):
+    # a hack to make at least ffi.typeof(builtin_function) work,
+    # if the builtin function was obtained by 'vengine_cpy'.
+    import sys
+    try:
+        module = sys.modules[func.__module__]
+        ffi = module._cffi_original_ffi
+        types_of_builtin_funcs = module._cffi_types_of_builtin_funcs
+        tp = types_of_builtin_funcs[func]
+    except (KeyError, AttributeError, TypeError):
+        return None
+    else:
+        with ffi._lock:
+            return ffi._get_cached_btype(tp)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/backend_ctypes.py b/TP03/TP03/lib/python3.9/site-packages/cffi/backend_ctypes.py
new file mode 100644
index 0000000000000000000000000000000000000000..e7956a79cfb1c3d28a2ad22a40b261ae7dbbbb5f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/backend_ctypes.py
@@ -0,0 +1,1121 @@
+import ctypes, ctypes.util, operator, sys
+from . import model
+
+if sys.version_info < (3,):
+    bytechr = chr
+else:
+    unicode = str
+    long = int
+    xrange = range
+    bytechr = lambda num: bytes([num])
+
+class CTypesType(type):
+    pass
+
+class CTypesData(object):
+    __metaclass__ = CTypesType
+    __slots__ = ['__weakref__']
+    __name__ = '<cdata>'
+
+    def __init__(self, *args):
+        raise TypeError("cannot instantiate %r" % (self.__class__,))
+
+    @classmethod
+    def _newp(cls, init):
+        raise TypeError("expected a pointer or array ctype, got '%s'"
+                        % (cls._get_c_name(),))
+
+    @staticmethod
+    def _to_ctypes(value):
+        raise TypeError
+
+    @classmethod
+    def _arg_to_ctypes(cls, *value):
+        try:
+            ctype = cls._ctype
+        except AttributeError:
+            raise TypeError("cannot create an instance of %r" % (cls,))
+        if value:
+            res = cls._to_ctypes(*value)
+            if not isinstance(res, ctype):
+                res = cls._ctype(res)
+        else:
+            res = cls._ctype()
+        return res
+
+    @classmethod
+    def _create_ctype_obj(cls, init):
+        if init is None:
+            return cls._arg_to_ctypes()
+        else:
+            return cls._arg_to_ctypes(init)
+
+    @staticmethod
+    def _from_ctypes(ctypes_value):
+        raise TypeError
+
+    @classmethod
+    def _get_c_name(cls, replace_with=''):
+        return cls._reftypename.replace(' &', replace_with)
+
+    @classmethod
+    def _fix_class(cls):
+        cls.__name__ = 'CData<%s>' % (cls._get_c_name(),)
+        cls.__qualname__ = 'CData<%s>' % (cls._get_c_name(),)
+        cls.__module__ = 'ffi'
+
+    def _get_own_repr(self):
+        raise NotImplementedError
+
+    def _addr_repr(self, address):
+        if address == 0:
+            return 'NULL'
+        else:
+            if address < 0:
+                address += 1 << (8*ctypes.sizeof(ctypes.c_void_p))
+            return '0x%x' % address
+
+    def __repr__(self, c_name=None):
+        own = self._get_own_repr()
+        return '<cdata %r %s>' % (c_name or self._get_c_name(), own)
+
+    def _convert_to_address(self, BClass):
+        if BClass is None:
+            raise TypeError("cannot convert %r to an address" % (
+                self._get_c_name(),))
+        else:
+            raise TypeError("cannot convert %r to %r" % (
+                self._get_c_name(), BClass._get_c_name()))
+
+    @classmethod
+    def _get_size(cls):
+        return ctypes.sizeof(cls._ctype)
+
+    def _get_size_of_instance(self):
+        return ctypes.sizeof(self._ctype)
+
+    @classmethod
+    def _cast_from(cls, source):
+        raise TypeError("cannot cast to %r" % (cls._get_c_name(),))
+
+    def _cast_to_integer(self):
+        return self._convert_to_address(None)
+
+    @classmethod
+    def _alignment(cls):
+        return ctypes.alignment(cls._ctype)
+
+    def __iter__(self):
+        raise TypeError("cdata %r does not support iteration" % (
+            self._get_c_name()),)
+
+    def _make_cmp(name):
+        cmpfunc = getattr(operator, name)
+        def cmp(self, other):
+            v_is_ptr = not isinstance(self, CTypesGenericPrimitive)
+            w_is_ptr = (isinstance(other, CTypesData) and
+                           not isinstance(other, CTypesGenericPrimitive))
+            if v_is_ptr and w_is_ptr:
+                return cmpfunc(self._convert_to_address(None),
+                               other._convert_to_address(None))
+            elif v_is_ptr or w_is_ptr:
+                return NotImplemented
+            else:
+                if isinstance(self, CTypesGenericPrimitive):
+                    self = self._value
+                if isinstance(other, CTypesGenericPrimitive):
+                    other = other._value
+                return cmpfunc(self, other)
+        cmp.func_name = name
+        return cmp
+
+    __eq__ = _make_cmp('__eq__')
+    __ne__ = _make_cmp('__ne__')
+    __lt__ = _make_cmp('__lt__')
+    __le__ = _make_cmp('__le__')
+    __gt__ = _make_cmp('__gt__')
+    __ge__ = _make_cmp('__ge__')
+
+    def __hash__(self):
+        return hash(self._convert_to_address(None))
+
+    def _to_string(self, maxlen):
+        raise TypeError("string(): %r" % (self,))
+
+
+class CTypesGenericPrimitive(CTypesData):
+    __slots__ = []
+
+    def __hash__(self):
+        return hash(self._value)
+
+    def _get_own_repr(self):
+        return repr(self._from_ctypes(self._value))
+
+
+class CTypesGenericArray(CTypesData):
+    __slots__ = []
+
+    @classmethod
+    def _newp(cls, init):
+        return cls(init)
+
+    def __iter__(self):
+        for i in xrange(len(self)):
+            yield self[i]
+
+    def _get_own_repr(self):
+        return self._addr_repr(ctypes.addressof(self._blob))
+
+
+class CTypesGenericPtr(CTypesData):
+    __slots__ = ['_address', '_as_ctype_ptr']
+    _automatic_casts = False
+    kind = "pointer"
+
+    @classmethod
+    def _newp(cls, init):
+        return cls(init)
+
+    @classmethod
+    def _cast_from(cls, source):
+        if source is None:
+            address = 0
+        elif isinstance(source, CTypesData):
+            address = source._cast_to_integer()
+        elif isinstance(source, (int, long)):
+            address = source
+        else:
+            raise TypeError("bad type for cast to %r: %r" %
+                            (cls, type(source).__name__))
+        return cls._new_pointer_at(address)
+
+    @classmethod
+    def _new_pointer_at(cls, address):
+        self = cls.__new__(cls)
+        self._address = address
+        self._as_ctype_ptr = ctypes.cast(address, cls._ctype)
+        return self
+
+    def _get_own_repr(self):
+        try:
+            return self._addr_repr(self._address)
+        except AttributeError:
+            return '???'
+
+    def _cast_to_integer(self):
+        return self._address
+
+    def __nonzero__(self):
+        return bool(self._address)
+    __bool__ = __nonzero__
+
+    @classmethod
+    def _to_ctypes(cls, value):
+        if not isinstance(value, CTypesData):
+            raise TypeError("unexpected %s object" % type(value).__name__)
+        address = value._convert_to_address(cls)
+        return ctypes.cast(address, cls._ctype)
+
+    @classmethod
+    def _from_ctypes(cls, ctypes_ptr):
+        address = ctypes.cast(ctypes_ptr, ctypes.c_void_p).value or 0
+        return cls._new_pointer_at(address)
+
+    @classmethod
+    def _initialize(cls, ctypes_ptr, value):
+        if value:
+            ctypes_ptr.contents = cls._to_ctypes(value).contents
+
+    def _convert_to_address(self, BClass):
+        if (BClass in (self.__class__, None) or BClass._automatic_casts
+            or self._automatic_casts):
+            return self._address
+        else:
+            return CTypesData._convert_to_address(self, BClass)
+
+
+class CTypesBaseStructOrUnion(CTypesData):
+    __slots__ = ['_blob']
+
+    @classmethod
+    def _create_ctype_obj(cls, init):
+        # may be overridden
+        raise TypeError("cannot instantiate opaque type %s" % (cls,))
+
+    def _get_own_repr(self):
+        return self._addr_repr(ctypes.addressof(self._blob))
+
+    @classmethod
+    def _offsetof(cls, fieldname):
+        return getattr(cls._ctype, fieldname).offset
+
+    def _convert_to_address(self, BClass):
+        if getattr(BClass, '_BItem', None) is self.__class__:
+            return ctypes.addressof(self._blob)
+        else:
+            return CTypesData._convert_to_address(self, BClass)
+
+    @classmethod
+    def _from_ctypes(cls, ctypes_struct_or_union):
+        self = cls.__new__(cls)
+        self._blob = ctypes_struct_or_union
+        return self
+
+    @classmethod
+    def _to_ctypes(cls, value):
+        return value._blob
+
+    def __repr__(self, c_name=None):
+        return CTypesData.__repr__(self, c_name or self._get_c_name(' &'))
+
+
+class CTypesBackend(object):
+
+    PRIMITIVE_TYPES = {
+        'char': ctypes.c_char,
+        'short': ctypes.c_short,
+        'int': ctypes.c_int,
+        'long': ctypes.c_long,
+        'long long': ctypes.c_longlong,
+        'signed char': ctypes.c_byte,
+        'unsigned char': ctypes.c_ubyte,
+        'unsigned short': ctypes.c_ushort,
+        'unsigned int': ctypes.c_uint,
+        'unsigned long': ctypes.c_ulong,
+        'unsigned long long': ctypes.c_ulonglong,
+        'float': ctypes.c_float,
+        'double': ctypes.c_double,
+        '_Bool': ctypes.c_bool,
+        }
+
+    for _name in ['unsigned long long', 'unsigned long',
+                  'unsigned int', 'unsigned short', 'unsigned char']:
+        _size = ctypes.sizeof(PRIMITIVE_TYPES[_name])
+        PRIMITIVE_TYPES['uint%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name]
+        if _size == ctypes.sizeof(ctypes.c_void_p):
+            PRIMITIVE_TYPES['uintptr_t'] = PRIMITIVE_TYPES[_name]
+        if _size == ctypes.sizeof(ctypes.c_size_t):
+            PRIMITIVE_TYPES['size_t'] = PRIMITIVE_TYPES[_name]
+
+    for _name in ['long long', 'long', 'int', 'short', 'signed char']:
+        _size = ctypes.sizeof(PRIMITIVE_TYPES[_name])
+        PRIMITIVE_TYPES['int%d_t' % (8*_size)] = PRIMITIVE_TYPES[_name]
+        if _size == ctypes.sizeof(ctypes.c_void_p):
+            PRIMITIVE_TYPES['intptr_t'] = PRIMITIVE_TYPES[_name]
+            PRIMITIVE_TYPES['ptrdiff_t'] = PRIMITIVE_TYPES[_name]
+        if _size == ctypes.sizeof(ctypes.c_size_t):
+            PRIMITIVE_TYPES['ssize_t'] = PRIMITIVE_TYPES[_name]
+
+
+    def __init__(self):
+        self.RTLD_LAZY = 0   # not supported anyway by ctypes
+        self.RTLD_NOW  = 0
+        self.RTLD_GLOBAL = ctypes.RTLD_GLOBAL
+        self.RTLD_LOCAL = ctypes.RTLD_LOCAL
+
+    def set_ffi(self, ffi):
+        self.ffi = ffi
+
+    def _get_types(self):
+        return CTypesData, CTypesType
+
+    def load_library(self, path, flags=0):
+        cdll = ctypes.CDLL(path, flags)
+        return CTypesLibrary(self, cdll)
+
+    def new_void_type(self):
+        class CTypesVoid(CTypesData):
+            __slots__ = []
+            _reftypename = 'void &'
+            @staticmethod
+            def _from_ctypes(novalue):
+                return None
+            @staticmethod
+            def _to_ctypes(novalue):
+                if novalue is not None:
+                    raise TypeError("None expected, got %s object" %
+                                    (type(novalue).__name__,))
+                return None
+        CTypesVoid._fix_class()
+        return CTypesVoid
+
+    def new_primitive_type(self, name):
+        if name == 'wchar_t':
+            raise NotImplementedError(name)
+        ctype = self.PRIMITIVE_TYPES[name]
+        if name == 'char':
+            kind = 'char'
+        elif name in ('float', 'double'):
+            kind = 'float'
+        else:
+            if name in ('signed char', 'unsigned char'):
+                kind = 'byte'
+            elif name == '_Bool':
+                kind = 'bool'
+            else:
+                kind = 'int'
+            is_signed = (ctype(-1).value == -1)
+        #
+        def _cast_source_to_int(source):
+            if isinstance(source, (int, long, float)):
+                source = int(source)
+            elif isinstance(source, CTypesData):
+                source = source._cast_to_integer()
+            elif isinstance(source, bytes):
+                source = ord(source)
+            elif source is None:
+                source = 0
+            else:
+                raise TypeError("bad type for cast to %r: %r" %
+                                (CTypesPrimitive, type(source).__name__))
+            return source
+        #
+        kind1 = kind
+        class CTypesPrimitive(CTypesGenericPrimitive):
+            __slots__ = ['_value']
+            _ctype = ctype
+            _reftypename = '%s &' % name
+            kind = kind1
+
+            def __init__(self, value):
+                self._value = value
+
+            @staticmethod
+            def _create_ctype_obj(init):
+                if init is None:
+                    return ctype()
+                return ctype(CTypesPrimitive._to_ctypes(init))
+
+            if kind == 'int' or kind == 'byte':
+                @classmethod
+                def _cast_from(cls, source):
+                    source = _cast_source_to_int(source)
+                    source = ctype(source).value     # cast within range
+                    return cls(source)
+                def __int__(self):
+                    return self._value
+
+            if kind == 'bool':
+                @classmethod
+                def _cast_from(cls, source):
+                    if not isinstance(source, (int, long, float)):
+                        source = _cast_source_to_int(source)
+                    return cls(bool(source))
+                def __int__(self):
+                    return int(self._value)
+
+            if kind == 'char':
+                @classmethod
+                def _cast_from(cls, source):
+                    source = _cast_source_to_int(source)
+                    source = bytechr(source & 0xFF)
+                    return cls(source)
+                def __int__(self):
+                    return ord(self._value)
+
+            if kind == 'float':
+                @classmethod
+                def _cast_from(cls, source):
+                    if isinstance(source, float):
+                        pass
+                    elif isinstance(source, CTypesGenericPrimitive):
+                        if hasattr(source, '__float__'):
+                            source = float(source)
+                        else:
+                            source = int(source)
+                    else:
+                        source = _cast_source_to_int(source)
+                    source = ctype(source).value     # fix precision
+                    return cls(source)
+                def __int__(self):
+                    return int(self._value)
+                def __float__(self):
+                    return self._value
+
+            _cast_to_integer = __int__
+
+            if kind == 'int' or kind == 'byte' or kind == 'bool':
+                @staticmethod
+                def _to_ctypes(x):
+                    if not isinstance(x, (int, long)):
+                        if isinstance(x, CTypesData):
+                            x = int(x)
+                        else:
+                            raise TypeError("integer expected, got %s" %
+                                            type(x).__name__)
+                    if ctype(x).value != x:
+                        if not is_signed and x < 0:
+                            raise OverflowError("%s: negative integer" % name)
+                        else:
+                            raise OverflowError("%s: integer out of bounds"
+                                                % name)
+                    return x
+
+            if kind == 'char':
+                @staticmethod
+                def _to_ctypes(x):
+                    if isinstance(x, bytes) and len(x) == 1:
+                        return x
+                    if isinstance(x, CTypesPrimitive):    # <CData <char>>
+                        return x._value
+                    raise TypeError("character expected, got %s" %
+                                    type(x).__name__)
+                def __nonzero__(self):
+                    return ord(self._value) != 0
+            else:
+                def __nonzero__(self):
+                    return self._value != 0
+            __bool__ = __nonzero__
+
+            if kind == 'float':
+                @staticmethod
+                def _to_ctypes(x):
+                    if not isinstance(x, (int, long, float, CTypesData)):
+                        raise TypeError("float expected, got %s" %
+                                        type(x).__name__)
+                    return ctype(x).value
+
+            @staticmethod
+            def _from_ctypes(value):
+                return getattr(value, 'value', value)
+
+            @staticmethod
+            def _initialize(blob, init):
+                blob.value = CTypesPrimitive._to_ctypes(init)
+
+            if kind == 'char':
+                def _to_string(self, maxlen):
+                    return self._value
+            if kind == 'byte':
+                def _to_string(self, maxlen):
+                    return chr(self._value & 0xff)
+        #
+        CTypesPrimitive._fix_class()
+        return CTypesPrimitive
+
+    def new_pointer_type(self, BItem):
+        getbtype = self.ffi._get_cached_btype
+        if BItem is getbtype(model.PrimitiveType('char')):
+            kind = 'charp'
+        elif BItem in (getbtype(model.PrimitiveType('signed char')),
+                       getbtype(model.PrimitiveType('unsigned char'))):
+            kind = 'bytep'
+        elif BItem is getbtype(model.void_type):
+            kind = 'voidp'
+        else:
+            kind = 'generic'
+        #
+        class CTypesPtr(CTypesGenericPtr):
+            __slots__ = ['_own']
+            if kind == 'charp':
+                __slots__ += ['__as_strbuf']
+            _BItem = BItem
+            if hasattr(BItem, '_ctype'):
+                _ctype = ctypes.POINTER(BItem._ctype)
+                _bitem_size = ctypes.sizeof(BItem._ctype)
+            else:
+                _ctype = ctypes.c_void_p
+            if issubclass(BItem, CTypesGenericArray):
+                _reftypename = BItem._get_c_name('(* &)')
+            else:
+                _reftypename = BItem._get_c_name(' * &')
+
+            def __init__(self, init):
+                ctypeobj = BItem._create_ctype_obj(init)
+                if kind == 'charp':
+                    self.__as_strbuf = ctypes.create_string_buffer(
+                        ctypeobj.value + b'\x00')
+                    self._as_ctype_ptr = ctypes.cast(
+                        self.__as_strbuf, self._ctype)
+                else:
+                    self._as_ctype_ptr = ctypes.pointer(ctypeobj)
+                self._address = ctypes.cast(self._as_ctype_ptr,
+                                            ctypes.c_void_p).value
+                self._own = True
+
+            def __add__(self, other):
+                if isinstance(other, (int, long)):
+                    return self._new_pointer_at(self._address +
+                                                other * self._bitem_size)
+                else:
+                    return NotImplemented
+
+            def __sub__(self, other):
+                if isinstance(other, (int, long)):
+                    return self._new_pointer_at(self._address -
+                                                other * self._bitem_size)
+                elif type(self) is type(other):
+                    return (self._address - other._address) // self._bitem_size
+                else:
+                    return NotImplemented
+
+            def __getitem__(self, index):
+                if getattr(self, '_own', False) and index != 0:
+                    raise IndexError
+                return BItem._from_ctypes(self._as_ctype_ptr[index])
+
+            def __setitem__(self, index, value):
+                self._as_ctype_ptr[index] = BItem._to_ctypes(value)
+
+            if kind == 'charp' or kind == 'voidp':
+                @classmethod
+                def _arg_to_ctypes(cls, *value):
+                    if value and isinstance(value[0], bytes):
+                        return ctypes.c_char_p(value[0])
+                    else:
+                        return super(CTypesPtr, cls)._arg_to_ctypes(*value)
+
+            if kind == 'charp' or kind == 'bytep':
+                def _to_string(self, maxlen):
+                    if maxlen < 0:
+                        maxlen = sys.maxsize
+                    p = ctypes.cast(self._as_ctype_ptr,
+                                    ctypes.POINTER(ctypes.c_char))
+                    n = 0
+                    while n < maxlen and p[n] != b'\x00':
+                        n += 1
+                    return b''.join([p[i] for i in range(n)])
+
+            def _get_own_repr(self):
+                if getattr(self, '_own', False):
+                    return 'owning %d bytes' % (
+                        ctypes.sizeof(self._as_ctype_ptr.contents),)
+                return super(CTypesPtr, self)._get_own_repr()
+        #
+        if (BItem is self.ffi._get_cached_btype(model.void_type) or
+            BItem is self.ffi._get_cached_btype(model.PrimitiveType('char'))):
+            CTypesPtr._automatic_casts = True
+        #
+        CTypesPtr._fix_class()
+        return CTypesPtr
+
+    def new_array_type(self, CTypesPtr, length):
+        if length is None:
+            brackets = ' &[]'
+        else:
+            brackets = ' &[%d]' % length
+        BItem = CTypesPtr._BItem
+        getbtype = self.ffi._get_cached_btype
+        if BItem is getbtype(model.PrimitiveType('char')):
+            kind = 'char'
+        elif BItem in (getbtype(model.PrimitiveType('signed char')),
+                       getbtype(model.PrimitiveType('unsigned char'))):
+            kind = 'byte'
+        else:
+            kind = 'generic'
+        #
+        class CTypesArray(CTypesGenericArray):
+            __slots__ = ['_blob', '_own']
+            if length is not None:
+                _ctype = BItem._ctype * length
+            else:
+                __slots__.append('_ctype')
+            _reftypename = BItem._get_c_name(brackets)
+            _declared_length = length
+            _CTPtr = CTypesPtr
+
+            def __init__(self, init):
+                if length is None:
+                    if isinstance(init, (int, long)):
+                        len1 = init
+                        init = None
+                    elif kind == 'char' and isinstance(init, bytes):
+                        len1 = len(init) + 1    # extra null
+                    else:
+                        init = tuple(init)
+                        len1 = len(init)
+                    self._ctype = BItem._ctype * len1
+                self._blob = self._ctype()
+                self._own = True
+                if init is not None:
+                    self._initialize(self._blob, init)
+
+            @staticmethod
+            def _initialize(blob, init):
+                if isinstance(init, bytes):
+                    init = [init[i:i+1] for i in range(len(init))]
+                else:
+                    if isinstance(init, CTypesGenericArray):
+                        if (len(init) != len(blob) or
+                            not isinstance(init, CTypesArray)):
+                            raise TypeError("length/type mismatch: %s" % (init,))
+                    init = tuple(init)
+                if len(init) > len(blob):
+                    raise IndexError("too many initializers")
+                addr = ctypes.cast(blob, ctypes.c_void_p).value
+                PTR = ctypes.POINTER(BItem._ctype)
+                itemsize = ctypes.sizeof(BItem._ctype)
+                for i, value in enumerate(init):
+                    p = ctypes.cast(addr + i * itemsize, PTR)
+                    BItem._initialize(p.contents, value)
+
+            def __len__(self):
+                return len(self._blob)
+
+            def __getitem__(self, index):
+                if not (0 <= index < len(self._blob)):
+                    raise IndexError
+                return BItem._from_ctypes(self._blob[index])
+
+            def __setitem__(self, index, value):
+                if not (0 <= index < len(self._blob)):
+                    raise IndexError
+                self._blob[index] = BItem._to_ctypes(value)
+
+            if kind == 'char' or kind == 'byte':
+                def _to_string(self, maxlen):
+                    if maxlen < 0:
+                        maxlen = len(self._blob)
+                    p = ctypes.cast(self._blob,
+                                    ctypes.POINTER(ctypes.c_char))
+                    n = 0
+                    while n < maxlen and p[n] != b'\x00':
+                        n += 1
+                    return b''.join([p[i] for i in range(n)])
+
+            def _get_own_repr(self):
+                if getattr(self, '_own', False):
+                    return 'owning %d bytes' % (ctypes.sizeof(self._blob),)
+                return super(CTypesArray, self)._get_own_repr()
+
+            def _convert_to_address(self, BClass):
+                if BClass in (CTypesPtr, None) or BClass._automatic_casts:
+                    return ctypes.addressof(self._blob)
+                else:
+                    return CTypesData._convert_to_address(self, BClass)
+
+            @staticmethod
+            def _from_ctypes(ctypes_array):
+                self = CTypesArray.__new__(CTypesArray)
+                self._blob = ctypes_array
+                return self
+
+            @staticmethod
+            def _arg_to_ctypes(value):
+                return CTypesPtr._arg_to_ctypes(value)
+
+            def __add__(self, other):
+                if isinstance(other, (int, long)):
+                    return CTypesPtr._new_pointer_at(
+                        ctypes.addressof(self._blob) +
+                        other * ctypes.sizeof(BItem._ctype))
+                else:
+                    return NotImplemented
+
+            @classmethod
+            def _cast_from(cls, source):
+                raise NotImplementedError("casting to %r" % (
+                    cls._get_c_name(),))
+        #
+        CTypesArray._fix_class()
+        return CTypesArray
+
+    def _new_struct_or_union(self, kind, name, base_ctypes_class):
+        #
+        class struct_or_union(base_ctypes_class):
+            pass
+        struct_or_union.__name__ = '%s_%s' % (kind, name)
+        kind1 = kind
+        #
+        class CTypesStructOrUnion(CTypesBaseStructOrUnion):
+            __slots__ = ['_blob']
+            _ctype = struct_or_union
+            _reftypename = '%s &' % (name,)
+            _kind = kind = kind1
+        #
+        CTypesStructOrUnion._fix_class()
+        return CTypesStructOrUnion
+
+    def new_struct_type(self, name):
+        return self._new_struct_or_union('struct', name, ctypes.Structure)
+
+    def new_union_type(self, name):
+        return self._new_struct_or_union('union', name, ctypes.Union)
+
+    def complete_struct_or_union(self, CTypesStructOrUnion, fields, tp,
+                                 totalsize=-1, totalalignment=-1, sflags=0,
+                                 pack=0):
+        if totalsize >= 0 or totalalignment >= 0:
+            raise NotImplementedError("the ctypes backend of CFFI does not support "
+                                      "structures completed by verify(); please "
+                                      "compile and install the _cffi_backend module.")
+        struct_or_union = CTypesStructOrUnion._ctype
+        fnames = [fname for (fname, BField, bitsize) in fields]
+        btypes = [BField for (fname, BField, bitsize) in fields]
+        bitfields = [bitsize for (fname, BField, bitsize) in fields]
+        #
+        bfield_types = {}
+        cfields = []
+        for (fname, BField, bitsize) in fields:
+            if bitsize < 0:
+                cfields.append((fname, BField._ctype))
+                bfield_types[fname] = BField
+            else:
+                cfields.append((fname, BField._ctype, bitsize))
+                bfield_types[fname] = Ellipsis
+        if sflags & 8:
+            struct_or_union._pack_ = 1
+        elif pack:
+            struct_or_union._pack_ = pack
+        struct_or_union._fields_ = cfields
+        CTypesStructOrUnion._bfield_types = bfield_types
+        #
+        @staticmethod
+        def _create_ctype_obj(init):
+            result = struct_or_union()
+            if init is not None:
+                initialize(result, init)
+            return result
+        CTypesStructOrUnion._create_ctype_obj = _create_ctype_obj
+        #
+        def initialize(blob, init):
+            if is_union:
+                if len(init) > 1:
+                    raise ValueError("union initializer: %d items given, but "
+                                    "only one supported (use a dict if needed)"
+                                     % (len(init),))
+            if not isinstance(init, dict):
+                if isinstance(init, (bytes, unicode)):
+                    raise TypeError("union initializer: got a str")
+                init = tuple(init)
+                if len(init) > len(fnames):
+                    raise ValueError("too many values for %s initializer" %
+                                     CTypesStructOrUnion._get_c_name())
+                init = dict(zip(fnames, init))
+            addr = ctypes.addressof(blob)
+            for fname, value in init.items():
+                BField, bitsize = name2fieldtype[fname]
+                assert bitsize < 0, \
+                       "not implemented: initializer with bit fields"
+                offset = CTypesStructOrUnion._offsetof(fname)
+                PTR = ctypes.POINTER(BField._ctype)
+                p = ctypes.cast(addr + offset, PTR)
+                BField._initialize(p.contents, value)
+        is_union = CTypesStructOrUnion._kind == 'union'
+        name2fieldtype = dict(zip(fnames, zip(btypes, bitfields)))
+        #
+        for fname, BField, bitsize in fields:
+            if fname == '':
+                raise NotImplementedError("nested anonymous structs/unions")
+            if hasattr(CTypesStructOrUnion, fname):
+                raise ValueError("the field name %r conflicts in "
+                                 "the ctypes backend" % fname)
+            if bitsize < 0:
+                def getter(self, fname=fname, BField=BField,
+                           offset=CTypesStructOrUnion._offsetof(fname),
+                           PTR=ctypes.POINTER(BField._ctype)):
+                    addr = ctypes.addressof(self._blob)
+                    p = ctypes.cast(addr + offset, PTR)
+                    return BField._from_ctypes(p.contents)
+                def setter(self, value, fname=fname, BField=BField):
+                    setattr(self._blob, fname, BField._to_ctypes(value))
+                #
+                if issubclass(BField, CTypesGenericArray):
+                    setter = None
+                    if BField._declared_length == 0:
+                        def getter(self, fname=fname, BFieldPtr=BField._CTPtr,
+                                   offset=CTypesStructOrUnion._offsetof(fname),
+                                   PTR=ctypes.POINTER(BField._ctype)):
+                            addr = ctypes.addressof(self._blob)
+                            p = ctypes.cast(addr + offset, PTR)
+                            return BFieldPtr._from_ctypes(p)
+                #
+            else:
+                def getter(self, fname=fname, BField=BField):
+                    return BField._from_ctypes(getattr(self._blob, fname))
+                def setter(self, value, fname=fname, BField=BField):
+                    # xxx obscure workaround
+                    value = BField._to_ctypes(value)
+                    oldvalue = getattr(self._blob, fname)
+                    setattr(self._blob, fname, value)
+                    if value != getattr(self._blob, fname):
+                        setattr(self._blob, fname, oldvalue)
+                        raise OverflowError("value too large for bitfield")
+            setattr(CTypesStructOrUnion, fname, property(getter, setter))
+        #
+        CTypesPtr = self.ffi._get_cached_btype(model.PointerType(tp))
+        for fname in fnames:
+            if hasattr(CTypesPtr, fname):
+                raise ValueError("the field name %r conflicts in "
+                                 "the ctypes backend" % fname)
+            def getter(self, fname=fname):
+                return getattr(self[0], fname)
+            def setter(self, value, fname=fname):
+                setattr(self[0], fname, value)
+            setattr(CTypesPtr, fname, property(getter, setter))
+
+    def new_function_type(self, BArgs, BResult, has_varargs):
+        nameargs = [BArg._get_c_name() for BArg in BArgs]
+        if has_varargs:
+            nameargs.append('...')
+        nameargs = ', '.join(nameargs)
+        #
+        class CTypesFunctionPtr(CTypesGenericPtr):
+            __slots__ = ['_own_callback', '_name']
+            _ctype = ctypes.CFUNCTYPE(getattr(BResult, '_ctype', None),
+                                      *[BArg._ctype for BArg in BArgs],
+                                      use_errno=True)
+            _reftypename = BResult._get_c_name('(* &)(%s)' % (nameargs,))
+
+            def __init__(self, init, error=None):
+                # create a callback to the Python callable init()
+                import traceback
+                assert not has_varargs, "varargs not supported for callbacks"
+                if getattr(BResult, '_ctype', None) is not None:
+                    error = BResult._from_ctypes(
+                        BResult._create_ctype_obj(error))
+                else:
+                    error = None
+                def callback(*args):
+                    args2 = []
+                    for arg, BArg in zip(args, BArgs):
+                        args2.append(BArg._from_ctypes(arg))
+                    try:
+                        res2 = init(*args2)
+                        res2 = BResult._to_ctypes(res2)
+                    except:
+                        traceback.print_exc()
+                        res2 = error
+                    if issubclass(BResult, CTypesGenericPtr):
+                        if res2:
+                            res2 = ctypes.cast(res2, ctypes.c_void_p).value
+                                # .value: http://bugs.python.org/issue1574593
+                        else:
+                            res2 = None
+                    #print repr(res2)
+                    return res2
+                if issubclass(BResult, CTypesGenericPtr):
+                    # The only pointers callbacks can return are void*s:
+                    # http://bugs.python.org/issue5710
+                    callback_ctype = ctypes.CFUNCTYPE(
+                        ctypes.c_void_p,
+                        *[BArg._ctype for BArg in BArgs],
+                        use_errno=True)
+                else:
+                    callback_ctype = CTypesFunctionPtr._ctype
+                self._as_ctype_ptr = callback_ctype(callback)
+                self._address = ctypes.cast(self._as_ctype_ptr,
+                                            ctypes.c_void_p).value
+                self._own_callback = init
+
+            @staticmethod
+            def _initialize(ctypes_ptr, value):
+                if value:
+                    raise NotImplementedError("ctypes backend: not supported: "
+                                          "initializers for function pointers")
+
+            def __repr__(self):
+                c_name = getattr(self, '_name', None)
+                if c_name:
+                    i = self._reftypename.index('(* &)')
+                    if self._reftypename[i-1] not in ' )*':
+                        c_name = ' ' + c_name
+                    c_name = self._reftypename.replace('(* &)', c_name)
+                return CTypesData.__repr__(self, c_name)
+
+            def _get_own_repr(self):
+                if getattr(self, '_own_callback', None) is not None:
+                    return 'calling %r' % (self._own_callback,)
+                return super(CTypesFunctionPtr, self)._get_own_repr()
+
+            def __call__(self, *args):
+                if has_varargs:
+                    assert len(args) >= len(BArgs)
+                    extraargs = args[len(BArgs):]
+                    args = args[:len(BArgs)]
+                else:
+                    assert len(args) == len(BArgs)
+                ctypes_args = []
+                for arg, BArg in zip(args, BArgs):
+                    ctypes_args.append(BArg._arg_to_ctypes(arg))
+                if has_varargs:
+                    for i, arg in enumerate(extraargs):
+                        if arg is None:
+                            ctypes_args.append(ctypes.c_void_p(0))  # NULL
+                            continue
+                        if not isinstance(arg, CTypesData):
+                            raise TypeError(
+                                "argument %d passed in the variadic part "
+                                "needs to be a cdata object (got %s)" %
+                                (1 + len(BArgs) + i, type(arg).__name__))
+                        ctypes_args.append(arg._arg_to_ctypes(arg))
+                result = self._as_ctype_ptr(*ctypes_args)
+                return BResult._from_ctypes(result)
+        #
+        CTypesFunctionPtr._fix_class()
+        return CTypesFunctionPtr
+
+    def new_enum_type(self, name, enumerators, enumvalues, CTypesInt):
+        assert isinstance(name, str)
+        reverse_mapping = dict(zip(reversed(enumvalues),
+                                   reversed(enumerators)))
+        #
+        class CTypesEnum(CTypesInt):
+            __slots__ = []
+            _reftypename = '%s &' % name
+
+            def _get_own_repr(self):
+                value = self._value
+                try:
+                    return '%d: %s' % (value, reverse_mapping[value])
+                except KeyError:
+                    return str(value)
+
+            def _to_string(self, maxlen):
+                value = self._value
+                try:
+                    return reverse_mapping[value]
+                except KeyError:
+                    return str(value)
+        #
+        CTypesEnum._fix_class()
+        return CTypesEnum
+
+    def get_errno(self):
+        return ctypes.get_errno()
+
+    def set_errno(self, value):
+        ctypes.set_errno(value)
+
+    def string(self, b, maxlen=-1):
+        return b._to_string(maxlen)
+
+    def buffer(self, bptr, size=-1):
+        raise NotImplementedError("buffer() with ctypes backend")
+
+    def sizeof(self, cdata_or_BType):
+        if isinstance(cdata_or_BType, CTypesData):
+            return cdata_or_BType._get_size_of_instance()
+        else:
+            assert issubclass(cdata_or_BType, CTypesData)
+            return cdata_or_BType._get_size()
+
+    def alignof(self, BType):
+        assert issubclass(BType, CTypesData)
+        return BType._alignment()
+
+    def newp(self, BType, source):
+        if not issubclass(BType, CTypesData):
+            raise TypeError
+        return BType._newp(source)
+
+    def cast(self, BType, source):
+        return BType._cast_from(source)
+
+    def callback(self, BType, source, error, onerror):
+        assert onerror is None   # XXX not implemented
+        return BType(source, error)
+
+    _weakref_cache_ref = None
+
+    def gcp(self, cdata, destructor, size=0):
+        if self._weakref_cache_ref is None:
+            import weakref
+            class MyRef(weakref.ref):
+                def __eq__(self, other):
+                    myref = self()
+                    return self is other or (
+                        myref is not None and myref is other())
+                def __ne__(self, other):
+                    return not (self == other)
+                def __hash__(self):
+                    try:
+                        return self._hash
+                    except AttributeError:
+                        self._hash = hash(self())
+                        return self._hash
+            self._weakref_cache_ref = {}, MyRef
+        weak_cache, MyRef = self._weakref_cache_ref
+
+        if destructor is None:
+            try:
+                del weak_cache[MyRef(cdata)]
+            except KeyError:
+                raise TypeError("Can remove destructor only on a object "
+                                "previously returned by ffi.gc()")
+            return None
+
+        def remove(k):
+            cdata, destructor = weak_cache.pop(k, (None, None))
+            if destructor is not None:
+                destructor(cdata)
+
+        new_cdata = self.cast(self.typeof(cdata), cdata)
+        assert new_cdata is not cdata
+        weak_cache[MyRef(new_cdata, remove)] = (cdata, destructor)
+        return new_cdata
+
+    typeof = type
+
+    def getcname(self, BType, replace_with):
+        return BType._get_c_name(replace_with)
+
+    def typeoffsetof(self, BType, fieldname, num=0):
+        if isinstance(fieldname, str):
+            if num == 0 and issubclass(BType, CTypesGenericPtr):
+                BType = BType._BItem
+            if not issubclass(BType, CTypesBaseStructOrUnion):
+                raise TypeError("expected a struct or union ctype")
+            BField = BType._bfield_types[fieldname]
+            if BField is Ellipsis:
+                raise TypeError("not supported for bitfields")
+            return (BField, BType._offsetof(fieldname))
+        elif isinstance(fieldname, (int, long)):
+            if issubclass(BType, CTypesGenericArray):
+                BType = BType._CTPtr
+            if not issubclass(BType, CTypesGenericPtr):
+                raise TypeError("expected an array or ptr ctype")
+            BItem = BType._BItem
+            offset = BItem._get_size() * fieldname
+            if offset > sys.maxsize:
+                raise OverflowError
+            return (BItem, offset)
+        else:
+            raise TypeError(type(fieldname))
+
+    def rawaddressof(self, BTypePtr, cdata, offset=None):
+        if isinstance(cdata, CTypesBaseStructOrUnion):
+            ptr = ctypes.pointer(type(cdata)._to_ctypes(cdata))
+        elif isinstance(cdata, CTypesGenericPtr):
+            if offset is None or not issubclass(type(cdata)._BItem,
+                                                CTypesBaseStructOrUnion):
+                raise TypeError("unexpected cdata type")
+            ptr = type(cdata)._to_ctypes(cdata)
+        elif isinstance(cdata, CTypesGenericArray):
+            ptr = type(cdata)._to_ctypes(cdata)
+        else:
+            raise TypeError("expected a <cdata 'struct-or-union'>")
+        if offset:
+            ptr = ctypes.cast(
+                ctypes.c_void_p(
+                    ctypes.cast(ptr, ctypes.c_void_p).value + offset),
+                type(ptr))
+        return BTypePtr._from_ctypes(ptr)
+
+
+class CTypesLibrary(object):
+
+    def __init__(self, backend, cdll):
+        self.backend = backend
+        self.cdll = cdll
+
+    def load_function(self, BType, name):
+        c_func = getattr(self.cdll, name)
+        funcobj = BType._from_ctypes(c_func)
+        funcobj._name = name
+        return funcobj
+
+    def read_variable(self, BType, name):
+        try:
+            ctypes_obj = BType._ctype.in_dll(self.cdll, name)
+        except AttributeError as e:
+            raise NotImplementedError(e)
+        return BType._from_ctypes(ctypes_obj)
+
+    def write_variable(self, BType, name, value):
+        new_ctypes_obj = BType._to_ctypes(value)
+        ctypes_obj = BType._ctype.in_dll(self.cdll, name)
+        ctypes.memmove(ctypes.addressof(ctypes_obj),
+                       ctypes.addressof(new_ctypes_obj),
+                       ctypes.sizeof(BType._ctype))
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/cffi_opcode.py b/TP03/TP03/lib/python3.9/site-packages/cffi/cffi_opcode.py
new file mode 100644
index 0000000000000000000000000000000000000000..a0df98d1c743790f4047672abcae0d00f993a2ce
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/cffi_opcode.py
@@ -0,0 +1,187 @@
+from .error import VerificationError
+
+class CffiOp(object):
+    def __init__(self, op, arg):
+        self.op = op
+        self.arg = arg
+
+    def as_c_expr(self):
+        if self.op is None:
+            assert isinstance(self.arg, str)
+            return '(_cffi_opcode_t)(%s)' % (self.arg,)
+        classname = CLASS_NAME[self.op]
+        return '_CFFI_OP(_CFFI_OP_%s, %s)' % (classname, self.arg)
+
+    def as_python_bytes(self):
+        if self.op is None and self.arg.isdigit():
+            value = int(self.arg)     # non-negative: '-' not in self.arg
+            if value >= 2**31:
+                raise OverflowError("cannot emit %r: limited to 2**31-1"
+                                    % (self.arg,))
+            return format_four_bytes(value)
+        if isinstance(self.arg, str):
+            raise VerificationError("cannot emit to Python: %r" % (self.arg,))
+        return format_four_bytes((self.arg << 8) | self.op)
+
+    def __str__(self):
+        classname = CLASS_NAME.get(self.op, self.op)
+        return '(%s %s)' % (classname, self.arg)
+
+def format_four_bytes(num):
+    return '\\x%02X\\x%02X\\x%02X\\x%02X' % (
+        (num >> 24) & 0xFF,
+        (num >> 16) & 0xFF,
+        (num >>  8) & 0xFF,
+        (num      ) & 0xFF)
+
+OP_PRIMITIVE       = 1
+OP_POINTER         = 3
+OP_ARRAY           = 5
+OP_OPEN_ARRAY      = 7
+OP_STRUCT_UNION    = 9
+OP_ENUM            = 11
+OP_FUNCTION        = 13
+OP_FUNCTION_END    = 15
+OP_NOOP            = 17
+OP_BITFIELD        = 19
+OP_TYPENAME        = 21
+OP_CPYTHON_BLTN_V  = 23   # varargs
+OP_CPYTHON_BLTN_N  = 25   # noargs
+OP_CPYTHON_BLTN_O  = 27   # O  (i.e. a single arg)
+OP_CONSTANT        = 29
+OP_CONSTANT_INT    = 31
+OP_GLOBAL_VAR      = 33
+OP_DLOPEN_FUNC     = 35
+OP_DLOPEN_CONST    = 37
+OP_GLOBAL_VAR_F    = 39
+OP_EXTERN_PYTHON   = 41
+
+PRIM_VOID          = 0
+PRIM_BOOL          = 1
+PRIM_CHAR          = 2
+PRIM_SCHAR         = 3
+PRIM_UCHAR         = 4
+PRIM_SHORT         = 5
+PRIM_USHORT        = 6
+PRIM_INT           = 7
+PRIM_UINT          = 8
+PRIM_LONG          = 9
+PRIM_ULONG         = 10
+PRIM_LONGLONG      = 11
+PRIM_ULONGLONG     = 12
+PRIM_FLOAT         = 13
+PRIM_DOUBLE        = 14
+PRIM_LONGDOUBLE    = 15
+
+PRIM_WCHAR         = 16
+PRIM_INT8          = 17
+PRIM_UINT8         = 18
+PRIM_INT16         = 19
+PRIM_UINT16        = 20
+PRIM_INT32         = 21
+PRIM_UINT32        = 22
+PRIM_INT64         = 23
+PRIM_UINT64        = 24
+PRIM_INTPTR        = 25
+PRIM_UINTPTR       = 26
+PRIM_PTRDIFF       = 27
+PRIM_SIZE          = 28
+PRIM_SSIZE         = 29
+PRIM_INT_LEAST8    = 30
+PRIM_UINT_LEAST8   = 31
+PRIM_INT_LEAST16   = 32
+PRIM_UINT_LEAST16  = 33
+PRIM_INT_LEAST32   = 34
+PRIM_UINT_LEAST32  = 35
+PRIM_INT_LEAST64   = 36
+PRIM_UINT_LEAST64  = 37
+PRIM_INT_FAST8     = 38
+PRIM_UINT_FAST8    = 39
+PRIM_INT_FAST16    = 40
+PRIM_UINT_FAST16   = 41
+PRIM_INT_FAST32    = 42
+PRIM_UINT_FAST32   = 43
+PRIM_INT_FAST64    = 44
+PRIM_UINT_FAST64   = 45
+PRIM_INTMAX        = 46
+PRIM_UINTMAX       = 47
+PRIM_FLOATCOMPLEX  = 48
+PRIM_DOUBLECOMPLEX = 49
+PRIM_CHAR16        = 50
+PRIM_CHAR32        = 51
+
+_NUM_PRIM          = 52
+_UNKNOWN_PRIM          = -1
+_UNKNOWN_FLOAT_PRIM    = -2
+_UNKNOWN_LONG_DOUBLE   = -3
+
+_IO_FILE_STRUCT        = -1
+
+PRIMITIVE_TO_INDEX = {
+    'char':               PRIM_CHAR,
+    'short':              PRIM_SHORT,
+    'int':                PRIM_INT,
+    'long':               PRIM_LONG,
+    'long long':          PRIM_LONGLONG,
+    'signed char':        PRIM_SCHAR,
+    'unsigned char':      PRIM_UCHAR,
+    'unsigned short':     PRIM_USHORT,
+    'unsigned int':       PRIM_UINT,
+    'unsigned long':      PRIM_ULONG,
+    'unsigned long long': PRIM_ULONGLONG,
+    'float':              PRIM_FLOAT,
+    'double':             PRIM_DOUBLE,
+    'long double':        PRIM_LONGDOUBLE,
+    'float _Complex':     PRIM_FLOATCOMPLEX,
+    'double _Complex':    PRIM_DOUBLECOMPLEX,
+    '_Bool':              PRIM_BOOL,
+    'wchar_t':            PRIM_WCHAR,
+    'char16_t':           PRIM_CHAR16,
+    'char32_t':           PRIM_CHAR32,
+    'int8_t':             PRIM_INT8,
+    'uint8_t':            PRIM_UINT8,
+    'int16_t':            PRIM_INT16,
+    'uint16_t':           PRIM_UINT16,
+    'int32_t':            PRIM_INT32,
+    'uint32_t':           PRIM_UINT32,
+    'int64_t':            PRIM_INT64,
+    'uint64_t':           PRIM_UINT64,
+    'intptr_t':           PRIM_INTPTR,
+    'uintptr_t':          PRIM_UINTPTR,
+    'ptrdiff_t':          PRIM_PTRDIFF,
+    'size_t':             PRIM_SIZE,
+    'ssize_t':            PRIM_SSIZE,
+    'int_least8_t':       PRIM_INT_LEAST8,
+    'uint_least8_t':      PRIM_UINT_LEAST8,
+    'int_least16_t':      PRIM_INT_LEAST16,
+    'uint_least16_t':     PRIM_UINT_LEAST16,
+    'int_least32_t':      PRIM_INT_LEAST32,
+    'uint_least32_t':     PRIM_UINT_LEAST32,
+    'int_least64_t':      PRIM_INT_LEAST64,
+    'uint_least64_t':     PRIM_UINT_LEAST64,
+    'int_fast8_t':        PRIM_INT_FAST8,
+    'uint_fast8_t':       PRIM_UINT_FAST8,
+    'int_fast16_t':       PRIM_INT_FAST16,
+    'uint_fast16_t':      PRIM_UINT_FAST16,
+    'int_fast32_t':       PRIM_INT_FAST32,
+    'uint_fast32_t':      PRIM_UINT_FAST32,
+    'int_fast64_t':       PRIM_INT_FAST64,
+    'uint_fast64_t':      PRIM_UINT_FAST64,
+    'intmax_t':           PRIM_INTMAX,
+    'uintmax_t':          PRIM_UINTMAX,
+    }
+
+F_UNION         = 0x01
+F_CHECK_FIELDS  = 0x02
+F_PACKED        = 0x04
+F_EXTERNAL      = 0x08
+F_OPAQUE        = 0x10
+
+G_FLAGS = dict([('_CFFI_' + _key, globals()[_key])
+                for _key in ['F_UNION', 'F_CHECK_FIELDS', 'F_PACKED',
+                             'F_EXTERNAL', 'F_OPAQUE']])
+
+CLASS_NAME = {}
+for _name, _value in list(globals().items()):
+    if _name.startswith('OP_') and isinstance(_value, int):
+        CLASS_NAME[_value] = _name[3:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/commontypes.py b/TP03/TP03/lib/python3.9/site-packages/cffi/commontypes.py
new file mode 100644
index 0000000000000000000000000000000000000000..8ec97c756a4b1023fd3963dd39b706f7c0e34373
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/commontypes.py
@@ -0,0 +1,80 @@
+import sys
+from . import model
+from .error import FFIError
+
+
+COMMON_TYPES = {}
+
+try:
+    # fetch "bool" and all simple Windows types
+    from _cffi_backend import _get_common_types
+    _get_common_types(COMMON_TYPES)
+except ImportError:
+    pass
+
+COMMON_TYPES['FILE'] = model.unknown_type('FILE', '_IO_FILE')
+COMMON_TYPES['bool'] = '_Bool'    # in case we got ImportError above
+
+for _type in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
+    if _type.endswith('_t'):
+        COMMON_TYPES[_type] = _type
+del _type
+
+_CACHE = {}
+
+def resolve_common_type(parser, commontype):
+    try:
+        return _CACHE[commontype]
+    except KeyError:
+        cdecl = COMMON_TYPES.get(commontype, commontype)
+        if not isinstance(cdecl, str):
+            result, quals = cdecl, 0    # cdecl is already a BaseType
+        elif cdecl in model.PrimitiveType.ALL_PRIMITIVE_TYPES:
+            result, quals = model.PrimitiveType(cdecl), 0
+        elif cdecl == 'set-unicode-needed':
+            raise FFIError("The Windows type %r is only available after "
+                           "you call ffi.set_unicode()" % (commontype,))
+        else:
+            if commontype == cdecl:
+                raise FFIError(
+                    "Unsupported type: %r.  Please look at "
+        "http://cffi.readthedocs.io/en/latest/cdef.html#ffi-cdef-limitations "
+                    "and file an issue if you think this type should really "
+                    "be supported." % (commontype,))
+            result, quals = parser.parse_type_and_quals(cdecl)   # recursive
+
+        assert isinstance(result, model.BaseTypeByIdentity)
+        _CACHE[commontype] = result, quals
+        return result, quals
+
+
+# ____________________________________________________________
+# extra types for Windows (most of them are in commontypes.c)
+
+
+def win_common_types():
+    return {
+        "UNICODE_STRING": model.StructType(
+            "_UNICODE_STRING",
+            ["Length",
+             "MaximumLength",
+             "Buffer"],
+            [model.PrimitiveType("unsigned short"),
+             model.PrimitiveType("unsigned short"),
+             model.PointerType(model.PrimitiveType("wchar_t"))],
+            [-1, -1, -1]),
+        "PUNICODE_STRING": "UNICODE_STRING *",
+        "PCUNICODE_STRING": "const UNICODE_STRING *",
+
+        "TBYTE": "set-unicode-needed",
+        "TCHAR": "set-unicode-needed",
+        "LPCTSTR": "set-unicode-needed",
+        "PCTSTR": "set-unicode-needed",
+        "LPTSTR": "set-unicode-needed",
+        "PTSTR": "set-unicode-needed",
+        "PTBYTE": "set-unicode-needed",
+        "PTCHAR": "set-unicode-needed",
+        }
+
+if sys.platform == 'win32':
+    COMMON_TYPES.update(win_common_types())
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/cparser.py b/TP03/TP03/lib/python3.9/site-packages/cffi/cparser.py
new file mode 100644
index 0000000000000000000000000000000000000000..74830e913f21409f536febddae7769d0364cd24b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/cparser.py
@@ -0,0 +1,1006 @@
+from . import model
+from .commontypes import COMMON_TYPES, resolve_common_type
+from .error import FFIError, CDefError
+try:
+    from . import _pycparser as pycparser
+except ImportError:
+    import pycparser
+import weakref, re, sys
+
+try:
+    if sys.version_info < (3,):
+        import thread as _thread
+    else:
+        import _thread
+    lock = _thread.allocate_lock()
+except ImportError:
+    lock = None
+
+def _workaround_for_static_import_finders():
+    # Issue #392: packaging tools like cx_Freeze can not find these
+    # because pycparser uses exec dynamic import.  This is an obscure
+    # workaround.  This function is never called.
+    import pycparser.yacctab
+    import pycparser.lextab
+
+CDEF_SOURCE_STRING = "<cdef source string>"
+_r_comment = re.compile(r"/\*.*?\*/|//([^\n\\]|\\.)*?$",
+                        re.DOTALL | re.MULTILINE)
+_r_define  = re.compile(r"^\s*#\s*define\s+([A-Za-z_][A-Za-z_0-9]*)"
+                        r"\b((?:[^\n\\]|\\.)*?)$",
+                        re.DOTALL | re.MULTILINE)
+_r_line_directive = re.compile(r"^[ \t]*#[ \t]*(?:line|\d+)\b.*$", re.MULTILINE)
+_r_partial_enum = re.compile(r"=\s*\.\.\.\s*[,}]|\.\.\.\s*\}")
+_r_enum_dotdotdot = re.compile(r"__dotdotdot\d+__$")
+_r_partial_array = re.compile(r"\[\s*\.\.\.\s*\]")
+_r_words = re.compile(r"\w+|\S")
+_parser_cache = None
+_r_int_literal = re.compile(r"-?0?x?[0-9a-f]+[lu]*$", re.IGNORECASE)
+_r_stdcall1 = re.compile(r"\b(__stdcall|WINAPI)\b")
+_r_stdcall2 = re.compile(r"[(]\s*(__stdcall|WINAPI)\b")
+_r_cdecl = re.compile(r"\b__cdecl\b")
+_r_extern_python = re.compile(r'\bextern\s*"'
+                              r'(Python|Python\s*\+\s*C|C\s*\+\s*Python)"\s*.')
+_r_star_const_space = re.compile(       # matches "* const "
+    r"[*]\s*((const|volatile|restrict)\b\s*)+")
+_r_int_dotdotdot = re.compile(r"(\b(int|long|short|signed|unsigned|char)\s*)+"
+                              r"\.\.\.")
+_r_float_dotdotdot = re.compile(r"\b(double|float)\s*\.\.\.")
+
+def _get_parser():
+    global _parser_cache
+    if _parser_cache is None:
+        _parser_cache = pycparser.CParser()
+    return _parser_cache
+
+def _workaround_for_old_pycparser(csource):
+    # Workaround for a pycparser issue (fixed between pycparser 2.10 and
+    # 2.14): "char*const***" gives us a wrong syntax tree, the same as
+    # for "char***(*const)".  This means we can't tell the difference
+    # afterwards.  But "char(*const(***))" gives us the right syntax
+    # tree.  The issue only occurs if there are several stars in
+    # sequence with no parenthesis inbetween, just possibly qualifiers.
+    # Attempt to fix it by adding some parentheses in the source: each
+    # time we see "* const" or "* const *", we add an opening
+    # parenthesis before each star---the hard part is figuring out where
+    # to close them.
+    parts = []
+    while True:
+        match = _r_star_const_space.search(csource)
+        if not match:
+            break
+        #print repr(''.join(parts)+csource), '=>',
+        parts.append(csource[:match.start()])
+        parts.append('('); closing = ')'
+        parts.append(match.group())   # e.g. "* const "
+        endpos = match.end()
+        if csource.startswith('*', endpos):
+            parts.append('('); closing += ')'
+        level = 0
+        i = endpos
+        while i < len(csource):
+            c = csource[i]
+            if c == '(':
+                level += 1
+            elif c == ')':
+                if level == 0:
+                    break
+                level -= 1
+            elif c in ',;=':
+                if level == 0:
+                    break
+            i += 1
+        csource = csource[endpos:i] + closing + csource[i:]
+        #print repr(''.join(parts)+csource)
+    parts.append(csource)
+    return ''.join(parts)
+
+def _preprocess_extern_python(csource):
+    # input: `extern "Python" int foo(int);` or
+    #        `extern "Python" { int foo(int); }`
+    # output:
+    #     void __cffi_extern_python_start;
+    #     int foo(int);
+    #     void __cffi_extern_python_stop;
+    #
+    # input: `extern "Python+C" int foo(int);`
+    # output:
+    #     void __cffi_extern_python_plus_c_start;
+    #     int foo(int);
+    #     void __cffi_extern_python_stop;
+    parts = []
+    while True:
+        match = _r_extern_python.search(csource)
+        if not match:
+            break
+        endpos = match.end() - 1
+        #print
+        #print ''.join(parts)+csource
+        #print '=>'
+        parts.append(csource[:match.start()])
+        if 'C' in match.group(1):
+            parts.append('void __cffi_extern_python_plus_c_start; ')
+        else:
+            parts.append('void __cffi_extern_python_start; ')
+        if csource[endpos] == '{':
+            # grouping variant
+            closing = csource.find('}', endpos)
+            if closing < 0:
+                raise CDefError("'extern \"Python\" {': no '}' found")
+            if csource.find('{', endpos + 1, closing) >= 0:
+                raise NotImplementedError("cannot use { } inside a block "
+                                          "'extern \"Python\" { ... }'")
+            parts.append(csource[endpos+1:closing])
+            csource = csource[closing+1:]
+        else:
+            # non-grouping variant
+            semicolon = csource.find(';', endpos)
+            if semicolon < 0:
+                raise CDefError("'extern \"Python\": no ';' found")
+            parts.append(csource[endpos:semicolon+1])
+            csource = csource[semicolon+1:]
+        parts.append(' void __cffi_extern_python_stop;')
+        #print ''.join(parts)+csource
+        #print
+    parts.append(csource)
+    return ''.join(parts)
+
+def _warn_for_string_literal(csource):
+    if '"' not in csource:
+        return
+    for line in csource.splitlines():
+        if '"' in line and not line.lstrip().startswith('#'):
+            import warnings
+            warnings.warn("String literal found in cdef() or type source. "
+                          "String literals are ignored here, but you should "
+                          "remove them anyway because some character sequences "
+                          "confuse pre-parsing.")
+            break
+
+def _warn_for_non_extern_non_static_global_variable(decl):
+    if not decl.storage:
+        import warnings
+        warnings.warn("Global variable '%s' in cdef(): for consistency "
+                      "with C it should have a storage class specifier "
+                      "(usually 'extern')" % (decl.name,))
+
+def _remove_line_directives(csource):
+    # _r_line_directive matches whole lines, without the final \n, if they
+    # start with '#line' with some spacing allowed, or '#NUMBER'.  This
+    # function stores them away and replaces them with exactly the string
+    # '#line@N', where N is the index in the list 'line_directives'.
+    line_directives = []
+    def replace(m):
+        i = len(line_directives)
+        line_directives.append(m.group())
+        return '#line@%d' % i
+    csource = _r_line_directive.sub(replace, csource)
+    return csource, line_directives
+
+def _put_back_line_directives(csource, line_directives):
+    def replace(m):
+        s = m.group()
+        if not s.startswith('#line@'):
+            raise AssertionError("unexpected #line directive "
+                                 "(should have been processed and removed")
+        return line_directives[int(s[6:])]
+    return _r_line_directive.sub(replace, csource)
+
+def _preprocess(csource):
+    # First, remove the lines of the form '#line N "filename"' because
+    # the "filename" part could confuse the rest
+    csource, line_directives = _remove_line_directives(csource)
+    # Remove comments.  NOTE: this only work because the cdef() section
+    # should not contain any string literals (except in line directives)!
+    def replace_keeping_newlines(m):
+        return ' ' + m.group().count('\n') * '\n'
+    csource = _r_comment.sub(replace_keeping_newlines, csource)
+    # Remove the "#define FOO x" lines
+    macros = {}
+    for match in _r_define.finditer(csource):
+        macroname, macrovalue = match.groups()
+        macrovalue = macrovalue.replace('\\\n', '').strip()
+        macros[macroname] = macrovalue
+    csource = _r_define.sub('', csource)
+    #
+    if pycparser.__version__ < '2.14':
+        csource = _workaround_for_old_pycparser(csource)
+    #
+    # BIG HACK: replace WINAPI or __stdcall with "volatile const".
+    # It doesn't make sense for the return type of a function to be
+    # "volatile volatile const", so we abuse it to detect __stdcall...
+    # Hack number 2 is that "int(volatile *fptr)();" is not valid C
+    # syntax, so we place the "volatile" before the opening parenthesis.
+    csource = _r_stdcall2.sub(' volatile volatile const(', csource)
+    csource = _r_stdcall1.sub(' volatile volatile const ', csource)
+    csource = _r_cdecl.sub(' ', csource)
+    #
+    # Replace `extern "Python"` with start/end markers
+    csource = _preprocess_extern_python(csource)
+    #
+    # Now there should not be any string literal left; warn if we get one
+    _warn_for_string_literal(csource)
+    #
+    # Replace "[...]" with "[__dotdotdotarray__]"
+    csource = _r_partial_array.sub('[__dotdotdotarray__]', csource)
+    #
+    # Replace "...}" with "__dotdotdotNUM__}".  This construction should
+    # occur only at the end of enums; at the end of structs we have "...;}"
+    # and at the end of vararg functions "...);".  Also replace "=...[,}]"
+    # with ",__dotdotdotNUM__[,}]": this occurs in the enums too, when
+    # giving an unknown value.
+    matches = list(_r_partial_enum.finditer(csource))
+    for number, match in enumerate(reversed(matches)):
+        p = match.start()
+        if csource[p] == '=':
+            p2 = csource.find('...', p, match.end())
+            assert p2 > p
+            csource = '%s,__dotdotdot%d__ %s' % (csource[:p], number,
+                                                 csource[p2+3:])
+        else:
+            assert csource[p:p+3] == '...'
+            csource = '%s __dotdotdot%d__ %s' % (csource[:p], number,
+                                                 csource[p+3:])
+    # Replace "int ..." or "unsigned long int..." with "__dotdotdotint__"
+    csource = _r_int_dotdotdot.sub(' __dotdotdotint__ ', csource)
+    # Replace "float ..." or "double..." with "__dotdotdotfloat__"
+    csource = _r_float_dotdotdot.sub(' __dotdotdotfloat__ ', csource)
+    # Replace all remaining "..." with the same name, "__dotdotdot__",
+    # which is declared with a typedef for the purpose of C parsing.
+    csource = csource.replace('...', ' __dotdotdot__ ')
+    # Finally, put back the line directives
+    csource = _put_back_line_directives(csource, line_directives)
+    return csource, macros
+
+def _common_type_names(csource):
+    # Look in the source for what looks like usages of types from the
+    # list of common types.  A "usage" is approximated here as the
+    # appearance of the word, minus a "definition" of the type, which
+    # is the last word in a "typedef" statement.  Approximative only
+    # but should be fine for all the common types.
+    look_for_words = set(COMMON_TYPES)
+    look_for_words.add(';')
+    look_for_words.add(',')
+    look_for_words.add('(')
+    look_for_words.add(')')
+    look_for_words.add('typedef')
+    words_used = set()
+    is_typedef = False
+    paren = 0
+    previous_word = ''
+    for word in _r_words.findall(csource):
+        if word in look_for_words:
+            if word == ';':
+                if is_typedef:
+                    words_used.discard(previous_word)
+                    look_for_words.discard(previous_word)
+                    is_typedef = False
+            elif word == 'typedef':
+                is_typedef = True
+                paren = 0
+            elif word == '(':
+                paren += 1
+            elif word == ')':
+                paren -= 1
+            elif word == ',':
+                if is_typedef and paren == 0:
+                    words_used.discard(previous_word)
+                    look_for_words.discard(previous_word)
+            else:   # word in COMMON_TYPES
+                words_used.add(word)
+        previous_word = word
+    return words_used
+
+
+class Parser(object):
+
+    def __init__(self):
+        self._declarations = {}
+        self._included_declarations = set()
+        self._anonymous_counter = 0
+        self._structnode2type = weakref.WeakKeyDictionary()
+        self._options = {}
+        self._int_constants = {}
+        self._recomplete = []
+        self._uses_new_feature = None
+
+    def _parse(self, csource):
+        csource, macros = _preprocess(csource)
+        # XXX: for more efficiency we would need to poke into the
+        # internals of CParser...  the following registers the
+        # typedefs, because their presence or absence influences the
+        # parsing itself (but what they are typedef'ed to plays no role)
+        ctn = _common_type_names(csource)
+        typenames = []
+        for name in sorted(self._declarations):
+            if name.startswith('typedef '):
+                name = name[8:]
+                typenames.append(name)
+                ctn.discard(name)
+        typenames += sorted(ctn)
+        #
+        csourcelines = []
+        csourcelines.append('# 1 "<cdef automatic initialization code>"')
+        for typename in typenames:
+            csourcelines.append('typedef int %s;' % typename)
+        csourcelines.append('typedef int __dotdotdotint__, __dotdotdotfloat__,'
+                            ' __dotdotdot__;')
+        # this forces pycparser to consider the following in the file
+        # called <cdef source string> from line 1
+        csourcelines.append('# 1 "%s"' % (CDEF_SOURCE_STRING,))
+        csourcelines.append(csource)
+        fullcsource = '\n'.join(csourcelines)
+        if lock is not None:
+            lock.acquire()     # pycparser is not thread-safe...
+        try:
+            ast = _get_parser().parse(fullcsource)
+        except pycparser.c_parser.ParseError as e:
+            self.convert_pycparser_error(e, csource)
+        finally:
+            if lock is not None:
+                lock.release()
+        # csource will be used to find buggy source text
+        return ast, macros, csource
+
+    def _convert_pycparser_error(self, e, csource):
+        # xxx look for "<cdef source string>:NUM:" at the start of str(e)
+        # and interpret that as a line number.  This will not work if
+        # the user gives explicit ``# NUM "FILE"`` directives.
+        line = None
+        msg = str(e)
+        match = re.match(r"%s:(\d+):" % (CDEF_SOURCE_STRING,), msg)
+        if match:
+            linenum = int(match.group(1), 10)
+            csourcelines = csource.splitlines()
+            if 1 <= linenum <= len(csourcelines):
+                line = csourcelines[linenum-1]
+        return line
+
+    def convert_pycparser_error(self, e, csource):
+        line = self._convert_pycparser_error(e, csource)
+
+        msg = str(e)
+        if line:
+            msg = 'cannot parse "%s"\n%s' % (line.strip(), msg)
+        else:
+            msg = 'parse error\n%s' % (msg,)
+        raise CDefError(msg)
+
+    def parse(self, csource, override=False, packed=False, pack=None,
+                    dllexport=False):
+        if packed:
+            if packed != True:
+                raise ValueError("'packed' should be False or True; use "
+                                 "'pack' to give another value")
+            if pack:
+                raise ValueError("cannot give both 'pack' and 'packed'")
+            pack = 1
+        elif pack:
+            if pack & (pack - 1):
+                raise ValueError("'pack' must be a power of two, not %r" %
+                    (pack,))
+        else:
+            pack = 0
+        prev_options = self._options
+        try:
+            self._options = {'override': override,
+                             'packed': pack,
+                             'dllexport': dllexport}
+            self._internal_parse(csource)
+        finally:
+            self._options = prev_options
+
+    def _internal_parse(self, csource):
+        ast, macros, csource = self._parse(csource)
+        # add the macros
+        self._process_macros(macros)
+        # find the first "__dotdotdot__" and use that as a separator
+        # between the repeated typedefs and the real csource
+        iterator = iter(ast.ext)
+        for decl in iterator:
+            if decl.name == '__dotdotdot__':
+                break
+        else:
+            assert 0
+        current_decl = None
+        #
+        try:
+            self._inside_extern_python = '__cffi_extern_python_stop'
+            for decl in iterator:
+                current_decl = decl
+                if isinstance(decl, pycparser.c_ast.Decl):
+                    self._parse_decl(decl)
+                elif isinstance(decl, pycparser.c_ast.Typedef):
+                    if not decl.name:
+                        raise CDefError("typedef does not declare any name",
+                                        decl)
+                    quals = 0
+                    if (isinstance(decl.type.type, pycparser.c_ast.IdentifierType) and
+                            decl.type.type.names[-1].startswith('__dotdotdot')):
+                        realtype = self._get_unknown_type(decl)
+                    elif (isinstance(decl.type, pycparser.c_ast.PtrDecl) and
+                          isinstance(decl.type.type, pycparser.c_ast.TypeDecl) and
+                          isinstance(decl.type.type.type,
+                                     pycparser.c_ast.IdentifierType) and
+                          decl.type.type.type.names[-1].startswith('__dotdotdot')):
+                        realtype = self._get_unknown_ptr_type(decl)
+                    else:
+                        realtype, quals = self._get_type_and_quals(
+                            decl.type, name=decl.name, partial_length_ok=True,
+                            typedef_example="*(%s *)0" % (decl.name,))
+                    self._declare('typedef ' + decl.name, realtype, quals=quals)
+                elif decl.__class__.__name__ == 'Pragma':
+                    pass    # skip pragma, only in pycparser 2.15
+                else:
+                    raise CDefError("unexpected <%s>: this construct is valid "
+                                    "C but not valid in cdef()" %
+                                    decl.__class__.__name__, decl)
+        except CDefError as e:
+            if len(e.args) == 1:
+                e.args = e.args + (current_decl,)
+            raise
+        except FFIError as e:
+            msg = self._convert_pycparser_error(e, csource)
+            if msg:
+                e.args = (e.args[0] + "\n    *** Err: %s" % msg,)
+            raise
+
+    def _add_constants(self, key, val):
+        if key in self._int_constants:
+            if self._int_constants[key] == val:
+                return     # ignore identical double declarations
+            raise FFIError(
+                "multiple declarations of constant: %s" % (key,))
+        self._int_constants[key] = val
+
+    def _add_integer_constant(self, name, int_str):
+        int_str = int_str.lower().rstrip("ul")
+        neg = int_str.startswith('-')
+        if neg:
+            int_str = int_str[1:]
+        # "010" is not valid oct in py3
+        if (int_str.startswith("0") and int_str != '0'
+                and not int_str.startswith("0x")):
+            int_str = "0o" + int_str[1:]
+        pyvalue = int(int_str, 0)
+        if neg:
+            pyvalue = -pyvalue
+        self._add_constants(name, pyvalue)
+        self._declare('macro ' + name, pyvalue)
+
+    def _process_macros(self, macros):
+        for key, value in macros.items():
+            value = value.strip()
+            if _r_int_literal.match(value):
+                self._add_integer_constant(key, value)
+            elif value == '...':
+                self._declare('macro ' + key, value)
+            else:
+                raise CDefError(
+                    'only supports one of the following syntax:\n'
+                    '  #define %s ...     (literally dot-dot-dot)\n'
+                    '  #define %s NUMBER  (with NUMBER an integer'
+                                    ' constant, decimal/hex/octal)\n'
+                    'got:\n'
+                    '  #define %s %s'
+                    % (key, key, key, value))
+
+    def _declare_function(self, tp, quals, decl):
+        tp = self._get_type_pointer(tp, quals)
+        if self._options.get('dllexport'):
+            tag = 'dllexport_python '
+        elif self._inside_extern_python == '__cffi_extern_python_start':
+            tag = 'extern_python '
+        elif self._inside_extern_python == '__cffi_extern_python_plus_c_start':
+            tag = 'extern_python_plus_c '
+        else:
+            tag = 'function '
+        self._declare(tag + decl.name, tp)
+
+    def _parse_decl(self, decl):
+        node = decl.type
+        if isinstance(node, pycparser.c_ast.FuncDecl):
+            tp, quals = self._get_type_and_quals(node, name=decl.name)
+            assert isinstance(tp, model.RawFunctionType)
+            self._declare_function(tp, quals, decl)
+        else:
+            if isinstance(node, pycparser.c_ast.Struct):
+                self._get_struct_union_enum_type('struct', node)
+            elif isinstance(node, pycparser.c_ast.Union):
+                self._get_struct_union_enum_type('union', node)
+            elif isinstance(node, pycparser.c_ast.Enum):
+                self._get_struct_union_enum_type('enum', node)
+            elif not decl.name:
+                raise CDefError("construct does not declare any variable",
+                                decl)
+            #
+            if decl.name:
+                tp, quals = self._get_type_and_quals(node,
+                                                     partial_length_ok=True)
+                if tp.is_raw_function:
+                    self._declare_function(tp, quals, decl)
+                elif (tp.is_integer_type() and
+                        hasattr(decl, 'init') and
+                        hasattr(decl.init, 'value') and
+                        _r_int_literal.match(decl.init.value)):
+                    self._add_integer_constant(decl.name, decl.init.value)
+                elif (tp.is_integer_type() and
+                        isinstance(decl.init, pycparser.c_ast.UnaryOp) and
+                        decl.init.op == '-' and
+                        hasattr(decl.init.expr, 'value') and
+                        _r_int_literal.match(decl.init.expr.value)):
+                    self._add_integer_constant(decl.name,
+                                               '-' + decl.init.expr.value)
+                elif (tp is model.void_type and
+                      decl.name.startswith('__cffi_extern_python_')):
+                    # hack: `extern "Python"` in the C source is replaced
+                    # with "void __cffi_extern_python_start;" and
+                    # "void __cffi_extern_python_stop;"
+                    self._inside_extern_python = decl.name
+                else:
+                    if self._inside_extern_python !='__cffi_extern_python_stop':
+                        raise CDefError(
+                            "cannot declare constants or "
+                            "variables with 'extern \"Python\"'")
+                    if (quals & model.Q_CONST) and not tp.is_array_type:
+                        self._declare('constant ' + decl.name, tp, quals=quals)
+                    else:
+                        _warn_for_non_extern_non_static_global_variable(decl)
+                        self._declare('variable ' + decl.name, tp, quals=quals)
+
+    def parse_type(self, cdecl):
+        return self.parse_type_and_quals(cdecl)[0]
+
+    def parse_type_and_quals(self, cdecl):
+        ast, macros = self._parse('void __dummy(\n%s\n);' % cdecl)[:2]
+        assert not macros
+        exprnode = ast.ext[-1].type.args.params[0]
+        if isinstance(exprnode, pycparser.c_ast.ID):
+            raise CDefError("unknown identifier '%s'" % (exprnode.name,))
+        return self._get_type_and_quals(exprnode.type)
+
+    def _declare(self, name, obj, included=False, quals=0):
+        if name in self._declarations:
+            prevobj, prevquals = self._declarations[name]
+            if prevobj is obj and prevquals == quals:
+                return
+            if not self._options.get('override'):
+                raise FFIError(
+                    "multiple declarations of %s (for interactive usage, "
+                    "try cdef(xx, override=True))" % (name,))
+        assert '__dotdotdot__' not in name.split()
+        self._declarations[name] = (obj, quals)
+        if included:
+            self._included_declarations.add(obj)
+
+    def _extract_quals(self, type):
+        quals = 0
+        if isinstance(type, (pycparser.c_ast.TypeDecl,
+                             pycparser.c_ast.PtrDecl)):
+            if 'const' in type.quals:
+                quals |= model.Q_CONST
+            if 'volatile' in type.quals:
+                quals |= model.Q_VOLATILE
+            if 'restrict' in type.quals:
+                quals |= model.Q_RESTRICT
+        return quals
+
+    def _get_type_pointer(self, type, quals, declname=None):
+        if isinstance(type, model.RawFunctionType):
+            return type.as_function_pointer()
+        if (isinstance(type, model.StructOrUnionOrEnum) and
+                type.name.startswith('$') and type.name[1:].isdigit() and
+                type.forcename is None and declname is not None):
+            return model.NamedPointerType(type, declname, quals)
+        return model.PointerType(type, quals)
+
+    def _get_type_and_quals(self, typenode, name=None, partial_length_ok=False,
+                            typedef_example=None):
+        # first, dereference typedefs, if we have it already parsed, we're good
+        if (isinstance(typenode, pycparser.c_ast.TypeDecl) and
+            isinstance(typenode.type, pycparser.c_ast.IdentifierType) and
+            len(typenode.type.names) == 1 and
+            ('typedef ' + typenode.type.names[0]) in self._declarations):
+            tp, quals = self._declarations['typedef ' + typenode.type.names[0]]
+            quals |= self._extract_quals(typenode)
+            return tp, quals
+        #
+        if isinstance(typenode, pycparser.c_ast.ArrayDecl):
+            # array type
+            if typenode.dim is None:
+                length = None
+            else:
+                length = self._parse_constant(
+                    typenode.dim, partial_length_ok=partial_length_ok)
+            # a hack: in 'typedef int foo_t[...][...];', don't use '...' as
+            # the length but use directly the C expression that would be
+            # generated by recompiler.py.  This lets the typedef be used in
+            # many more places within recompiler.py
+            if typedef_example is not None:
+                if length == '...':
+                    length = '_cffi_array_len(%s)' % (typedef_example,)
+                typedef_example = "*" + typedef_example
+            #
+            tp, quals = self._get_type_and_quals(typenode.type,
+                                partial_length_ok=partial_length_ok,
+                                typedef_example=typedef_example)
+            return model.ArrayType(tp, length), quals
+        #
+        if isinstance(typenode, pycparser.c_ast.PtrDecl):
+            # pointer type
+            itemtype, itemquals = self._get_type_and_quals(typenode.type)
+            tp = self._get_type_pointer(itemtype, itemquals, declname=name)
+            quals = self._extract_quals(typenode)
+            return tp, quals
+        #
+        if isinstance(typenode, pycparser.c_ast.TypeDecl):
+            quals = self._extract_quals(typenode)
+            type = typenode.type
+            if isinstance(type, pycparser.c_ast.IdentifierType):
+                # assume a primitive type.  get it from .names, but reduce
+                # synonyms to a single chosen combination
+                names = list(type.names)
+                if names != ['signed', 'char']:    # keep this unmodified
+                    prefixes = {}
+                    while names:
+                        name = names[0]
+                        if name in ('short', 'long', 'signed', 'unsigned'):
+                            prefixes[name] = prefixes.get(name, 0) + 1
+                            del names[0]
+                        else:
+                            break
+                    # ignore the 'signed' prefix below, and reorder the others
+                    newnames = []
+                    for prefix in ('unsigned', 'short', 'long'):
+                        for i in range(prefixes.get(prefix, 0)):
+                            newnames.append(prefix)
+                    if not names:
+                        names = ['int']    # implicitly
+                    if names == ['int']:   # but kill it if 'short' or 'long'
+                        if 'short' in prefixes or 'long' in prefixes:
+                            names = []
+                    names = newnames + names
+                ident = ' '.join(names)
+                if ident == 'void':
+                    return model.void_type, quals
+                if ident == '__dotdotdot__':
+                    raise FFIError(':%d: bad usage of "..."' %
+                            typenode.coord.line)
+                tp0, quals0 = resolve_common_type(self, ident)
+                return tp0, (quals | quals0)
+            #
+            if isinstance(type, pycparser.c_ast.Struct):
+                # 'struct foobar'
+                tp = self._get_struct_union_enum_type('struct', type, name)
+                return tp, quals
+            #
+            if isinstance(type, pycparser.c_ast.Union):
+                # 'union foobar'
+                tp = self._get_struct_union_enum_type('union', type, name)
+                return tp, quals
+            #
+            if isinstance(type, pycparser.c_ast.Enum):
+                # 'enum foobar'
+                tp = self._get_struct_union_enum_type('enum', type, name)
+                return tp, quals
+        #
+        if isinstance(typenode, pycparser.c_ast.FuncDecl):
+            # a function type
+            return self._parse_function_type(typenode, name), 0
+        #
+        # nested anonymous structs or unions end up here
+        if isinstance(typenode, pycparser.c_ast.Struct):
+            return self._get_struct_union_enum_type('struct', typenode, name,
+                                                    nested=True), 0
+        if isinstance(typenode, pycparser.c_ast.Union):
+            return self._get_struct_union_enum_type('union', typenode, name,
+                                                    nested=True), 0
+        #
+        raise FFIError(":%d: bad or unsupported type declaration" %
+                typenode.coord.line)
+
+    def _parse_function_type(self, typenode, funcname=None):
+        params = list(getattr(typenode.args, 'params', []))
+        for i, arg in enumerate(params):
+            if not hasattr(arg, 'type'):
+                raise CDefError("%s arg %d: unknown type '%s'"
+                    " (if you meant to use the old C syntax of giving"
+                    " untyped arguments, it is not supported)"
+                    % (funcname or 'in expression', i + 1,
+                       getattr(arg, 'name', '?')))
+        ellipsis = (
+            len(params) > 0 and
+            isinstance(params[-1].type, pycparser.c_ast.TypeDecl) and
+            isinstance(params[-1].type.type,
+                       pycparser.c_ast.IdentifierType) and
+            params[-1].type.type.names == ['__dotdotdot__'])
+        if ellipsis:
+            params.pop()
+            if not params:
+                raise CDefError(
+                    "%s: a function with only '(...)' as argument"
+                    " is not correct C" % (funcname or 'in expression'))
+        args = [self._as_func_arg(*self._get_type_and_quals(argdeclnode.type))
+                for argdeclnode in params]
+        if not ellipsis and args == [model.void_type]:
+            args = []
+        result, quals = self._get_type_and_quals(typenode.type)
+        # the 'quals' on the result type are ignored.  HACK: we absure them
+        # to detect __stdcall functions: we textually replace "__stdcall"
+        # with "volatile volatile const" above.
+        abi = None
+        if hasattr(typenode.type, 'quals'): # else, probable syntax error anyway
+            if typenode.type.quals[-3:] == ['volatile', 'volatile', 'const']:
+                abi = '__stdcall'
+        return model.RawFunctionType(tuple(args), result, ellipsis, abi)
+
+    def _as_func_arg(self, type, quals):
+        if isinstance(type, model.ArrayType):
+            return model.PointerType(type.item, quals)
+        elif isinstance(type, model.RawFunctionType):
+            return type.as_function_pointer()
+        else:
+            return type
+
+    def _get_struct_union_enum_type(self, kind, type, name=None, nested=False):
+        # First, a level of caching on the exact 'type' node of the AST.
+        # This is obscure, but needed because pycparser "unrolls" declarations
+        # such as "typedef struct { } foo_t, *foo_p" and we end up with
+        # an AST that is not a tree, but a DAG, with the "type" node of the
+        # two branches foo_t and foo_p of the trees being the same node.
+        # It's a bit silly but detecting "DAG-ness" in the AST tree seems
+        # to be the only way to distinguish this case from two independent
+        # structs.  See test_struct_with_two_usages.
+        try:
+            return self._structnode2type[type]
+        except KeyError:
+            pass
+        #
+        # Note that this must handle parsing "struct foo" any number of
+        # times and always return the same StructType object.  Additionally,
+        # one of these times (not necessarily the first), the fields of
+        # the struct can be specified with "struct foo { ...fields... }".
+        # If no name is given, then we have to create a new anonymous struct
+        # with no caching; in this case, the fields are either specified
+        # right now or never.
+        #
+        force_name = name
+        name = type.name
+        #
+        # get the type or create it if needed
+        if name is None:
+            # 'force_name' is used to guess a more readable name for
+            # anonymous structs, for the common case "typedef struct { } foo".
+            if force_name is not None:
+                explicit_name = '$%s' % force_name
+            else:
+                self._anonymous_counter += 1
+                explicit_name = '$%d' % self._anonymous_counter
+            tp = None
+        else:
+            explicit_name = name
+            key = '%s %s' % (kind, name)
+            tp, _ = self._declarations.get(key, (None, None))
+        #
+        if tp is None:
+            if kind == 'struct':
+                tp = model.StructType(explicit_name, None, None, None)
+            elif kind == 'union':
+                tp = model.UnionType(explicit_name, None, None, None)
+            elif kind == 'enum':
+                if explicit_name == '__dotdotdot__':
+                    raise CDefError("Enums cannot be declared with ...")
+                tp = self._build_enum_type(explicit_name, type.values)
+            else:
+                raise AssertionError("kind = %r" % (kind,))
+            if name is not None:
+                self._declare(key, tp)
+        else:
+            if kind == 'enum' and type.values is not None:
+                raise NotImplementedError(
+                    "enum %s: the '{}' declaration should appear on the first "
+                    "time the enum is mentioned, not later" % explicit_name)
+        if not tp.forcename:
+            tp.force_the_name(force_name)
+        if tp.forcename and '$' in tp.name:
+            self._declare('anonymous %s' % tp.forcename, tp)
+        #
+        self._structnode2type[type] = tp
+        #
+        # enums: done here
+        if kind == 'enum':
+            return tp
+        #
+        # is there a 'type.decls'?  If yes, then this is the place in the
+        # C sources that declare the fields.  If no, then just return the
+        # existing type, possibly still incomplete.
+        if type.decls is None:
+            return tp
+        #
+        if tp.fldnames is not None:
+            raise CDefError("duplicate declaration of struct %s" % name)
+        fldnames = []
+        fldtypes = []
+        fldbitsize = []
+        fldquals = []
+        for decl in type.decls:
+            if (isinstance(decl.type, pycparser.c_ast.IdentifierType) and
+                    ''.join(decl.type.names) == '__dotdotdot__'):
+                # XXX pycparser is inconsistent: 'names' should be a list
+                # of strings, but is sometimes just one string.  Use
+                # str.join() as a way to cope with both.
+                self._make_partial(tp, nested)
+                continue
+            if decl.bitsize is None:
+                bitsize = -1
+            else:
+                bitsize = self._parse_constant(decl.bitsize)
+            self._partial_length = False
+            type, fqual = self._get_type_and_quals(decl.type,
+                                                   partial_length_ok=True)
+            if self._partial_length:
+                self._make_partial(tp, nested)
+            if isinstance(type, model.StructType) and type.partial:
+                self._make_partial(tp, nested)
+            fldnames.append(decl.name or '')
+            fldtypes.append(type)
+            fldbitsize.append(bitsize)
+            fldquals.append(fqual)
+        tp.fldnames = tuple(fldnames)
+        tp.fldtypes = tuple(fldtypes)
+        tp.fldbitsize = tuple(fldbitsize)
+        tp.fldquals = tuple(fldquals)
+        if fldbitsize != [-1] * len(fldbitsize):
+            if isinstance(tp, model.StructType) and tp.partial:
+                raise NotImplementedError("%s: using both bitfields and '...;'"
+                                          % (tp,))
+        tp.packed = self._options.get('packed')
+        if tp.completed:    # must be re-completed: it is not opaque any more
+            tp.completed = 0
+            self._recomplete.append(tp)
+        return tp
+
+    def _make_partial(self, tp, nested):
+        if not isinstance(tp, model.StructOrUnion):
+            raise CDefError("%s cannot be partial" % (tp,))
+        if not tp.has_c_name() and not nested:
+            raise NotImplementedError("%s is partial but has no C name" %(tp,))
+        tp.partial = True
+
+    def _parse_constant(self, exprnode, partial_length_ok=False):
+        # for now, limited to expressions that are an immediate number
+        # or positive/negative number
+        if isinstance(exprnode, pycparser.c_ast.Constant):
+            s = exprnode.value
+            if '0' <= s[0] <= '9':
+                s = s.rstrip('uUlL')
+                try:
+                    if s.startswith('0'):
+                        return int(s, 8)
+                    else:
+                        return int(s, 10)
+                except ValueError:
+                    if len(s) > 1:
+                        if s.lower()[0:2] == '0x':
+                            return int(s, 16)
+                        elif s.lower()[0:2] == '0b':
+                            return int(s, 2)
+                raise CDefError("invalid constant %r" % (s,))
+            elif s[0] == "'" and s[-1] == "'" and (
+                    len(s) == 3 or (len(s) == 4 and s[1] == "\\")):
+                return ord(s[-2])
+            else:
+                raise CDefError("invalid constant %r" % (s,))
+        #
+        if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and
+                exprnode.op == '+'):
+            return self._parse_constant(exprnode.expr)
+        #
+        if (isinstance(exprnode, pycparser.c_ast.UnaryOp) and
+                exprnode.op == '-'):
+            return -self._parse_constant(exprnode.expr)
+        # load previously defined int constant
+        if (isinstance(exprnode, pycparser.c_ast.ID) and
+                exprnode.name in self._int_constants):
+            return self._int_constants[exprnode.name]
+        #
+        if (isinstance(exprnode, pycparser.c_ast.ID) and
+                    exprnode.name == '__dotdotdotarray__'):
+            if partial_length_ok:
+                self._partial_length = True
+                return '...'
+            raise FFIError(":%d: unsupported '[...]' here, cannot derive "
+                           "the actual array length in this context"
+                           % exprnode.coord.line)
+        #
+        if isinstance(exprnode, pycparser.c_ast.BinaryOp):
+            left = self._parse_constant(exprnode.left)
+            right = self._parse_constant(exprnode.right)
+            if exprnode.op == '+':
+                return left + right
+            elif exprnode.op == '-':
+                return left - right
+            elif exprnode.op == '*':
+                return left * right
+            elif exprnode.op == '/':
+                return self._c_div(left, right)
+            elif exprnode.op == '%':
+                return left - self._c_div(left, right) * right
+            elif exprnode.op == '<<':
+                return left << right
+            elif exprnode.op == '>>':
+                return left >> right
+            elif exprnode.op == '&':
+                return left & right
+            elif exprnode.op == '|':
+                return left | right
+            elif exprnode.op == '^':
+                return left ^ right
+        #
+        raise FFIError(":%d: unsupported expression: expected a "
+                       "simple numeric constant" % exprnode.coord.line)
+
+    def _c_div(self, a, b):
+        result = a // b
+        if ((a < 0) ^ (b < 0)) and (a % b) != 0:
+            result += 1
+        return result
+
+    def _build_enum_type(self, explicit_name, decls):
+        if decls is not None:
+            partial = False
+            enumerators = []
+            enumvalues = []
+            nextenumvalue = 0
+            for enum in decls.enumerators:
+                if _r_enum_dotdotdot.match(enum.name):
+                    partial = True
+                    continue
+                if enum.value is not None:
+                    nextenumvalue = self._parse_constant(enum.value)
+                enumerators.append(enum.name)
+                enumvalues.append(nextenumvalue)
+                self._add_constants(enum.name, nextenumvalue)
+                nextenumvalue += 1
+            enumerators = tuple(enumerators)
+            enumvalues = tuple(enumvalues)
+            tp = model.EnumType(explicit_name, enumerators, enumvalues)
+            tp.partial = partial
+        else:   # opaque enum
+            tp = model.EnumType(explicit_name, (), ())
+        return tp
+
+    def include(self, other):
+        for name, (tp, quals) in other._declarations.items():
+            if name.startswith('anonymous $enum_$'):
+                continue   # fix for test_anonymous_enum_include
+            kind = name.split(' ', 1)[0]
+            if kind in ('struct', 'union', 'enum', 'anonymous', 'typedef'):
+                self._declare(name, tp, included=True, quals=quals)
+        for k, v in other._int_constants.items():
+            self._add_constants(k, v)
+
+    def _get_unknown_type(self, decl):
+        typenames = decl.type.type.names
+        if typenames == ['__dotdotdot__']:
+            return model.unknown_type(decl.name)
+
+        if typenames == ['__dotdotdotint__']:
+            if self._uses_new_feature is None:
+                self._uses_new_feature = "'typedef int... %s'" % decl.name
+            return model.UnknownIntegerType(decl.name)
+
+        if typenames == ['__dotdotdotfloat__']:
+            # note: not for 'long double' so far
+            if self._uses_new_feature is None:
+                self._uses_new_feature = "'typedef float... %s'" % decl.name
+            return model.UnknownFloatType(decl.name)
+
+        raise FFIError(':%d: unsupported usage of "..." in typedef'
+                       % decl.coord.line)
+
+    def _get_unknown_ptr_type(self, decl):
+        if decl.type.type.type.names == ['__dotdotdot__']:
+            return model.unknown_ptr_type(decl.name)
+        raise FFIError(':%d: unsupported usage of "..." in typedef'
+                       % decl.coord.line)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/error.py b/TP03/TP03/lib/python3.9/site-packages/cffi/error.py
new file mode 100644
index 0000000000000000000000000000000000000000..0a27247c32a381ab7cecedd0f985b781619c1ea5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/error.py
@@ -0,0 +1,31 @@
+
+class FFIError(Exception):
+    __module__ = 'cffi'
+
+class CDefError(Exception):
+    __module__ = 'cffi'
+    def __str__(self):
+        try:
+            current_decl = self.args[1]
+            filename = current_decl.coord.file
+            linenum = current_decl.coord.line
+            prefix = '%s:%d: ' % (filename, linenum)
+        except (AttributeError, TypeError, IndexError):
+            prefix = ''
+        return '%s%s' % (prefix, self.args[0])
+
+class VerificationError(Exception):
+    """ An error raised when verification fails
+    """
+    __module__ = 'cffi'
+
+class VerificationMissing(Exception):
+    """ An error raised when incomplete structures are passed into
+    cdef, but no verification has been done
+    """
+    __module__ = 'cffi'
+
+class PkgConfigError(Exception):
+    """ An error raised for missing modules in pkg-config
+    """
+    __module__ = 'cffi'
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/ffiplatform.py b/TP03/TP03/lib/python3.9/site-packages/cffi/ffiplatform.py
new file mode 100644
index 0000000000000000000000000000000000000000..adca28f1a480bb04a11977d26457fe8886139043
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/ffiplatform.py
@@ -0,0 +1,113 @@
+import sys, os
+from .error import VerificationError
+
+
+LIST_OF_FILE_NAMES = ['sources', 'include_dirs', 'library_dirs',
+                      'extra_objects', 'depends']
+
+def get_extension(srcfilename, modname, sources=(), **kwds):
+    from cffi._shimmed_dist_utils import Extension
+    allsources = [srcfilename]
+    for src in sources:
+        allsources.append(os.path.normpath(src))
+    return Extension(name=modname, sources=allsources, **kwds)
+
+def compile(tmpdir, ext, compiler_verbose=0, debug=None):
+    """Compile a C extension module using distutils."""
+
+    saved_environ = os.environ.copy()
+    try:
+        outputfilename = _build(tmpdir, ext, compiler_verbose, debug)
+        outputfilename = os.path.abspath(outputfilename)
+    finally:
+        # workaround for a distutils bugs where some env vars can
+        # become longer and longer every time it is used
+        for key, value in saved_environ.items():
+            if os.environ.get(key) != value:
+                os.environ[key] = value
+    return outputfilename
+
+def _build(tmpdir, ext, compiler_verbose=0, debug=None):
+    # XXX compact but horrible :-(
+    from cffi._shimmed_dist_utils import Distribution, CompileError, LinkError, set_threshold, set_verbosity
+
+    dist = Distribution({'ext_modules': [ext]})
+    dist.parse_config_files()
+    options = dist.get_option_dict('build_ext')
+    if debug is None:
+        debug = sys.flags.debug
+    options['debug'] = ('ffiplatform', debug)
+    options['force'] = ('ffiplatform', True)
+    options['build_lib'] = ('ffiplatform', tmpdir)
+    options['build_temp'] = ('ffiplatform', tmpdir)
+    #
+    try:
+        old_level = set_threshold(0) or 0
+        try:
+            set_verbosity(compiler_verbose)
+            dist.run_command('build_ext')
+            cmd_obj = dist.get_command_obj('build_ext')
+            [soname] = cmd_obj.get_outputs()
+        finally:
+            set_threshold(old_level)
+    except (CompileError, LinkError) as e:
+        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
+    #
+    return soname
+
+try:
+    from os.path import samefile
+except ImportError:
+    def samefile(f1, f2):
+        return os.path.abspath(f1) == os.path.abspath(f2)
+
+def maybe_relative_path(path):
+    if not os.path.isabs(path):
+        return path      # already relative
+    dir = path
+    names = []
+    while True:
+        prevdir = dir
+        dir, name = os.path.split(prevdir)
+        if dir == prevdir or not dir:
+            return path     # failed to make it relative
+        names.append(name)
+        try:
+            if samefile(dir, os.curdir):
+                names.reverse()
+                return os.path.join(*names)
+        except OSError:
+            pass
+
+# ____________________________________________________________
+
+try:
+    int_or_long = (int, long)
+    import cStringIO
+except NameError:
+    int_or_long = int      # Python 3
+    import io as cStringIO
+
+def _flatten(x, f):
+    if isinstance(x, str):
+        f.write('%ds%s' % (len(x), x))
+    elif isinstance(x, dict):
+        keys = sorted(x.keys())
+        f.write('%dd' % len(keys))
+        for key in keys:
+            _flatten(key, f)
+            _flatten(x[key], f)
+    elif isinstance(x, (list, tuple)):
+        f.write('%dl' % len(x))
+        for value in x:
+            _flatten(value, f)
+    elif isinstance(x, int_or_long):
+        f.write('%di' % (x,))
+    else:
+        raise TypeError(
+            "the keywords to verify() contains unsupported object %r" % (x,))
+
+def flatten(x):
+    f = cStringIO.StringIO()
+    _flatten(x, f)
+    return f.getvalue()
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/lock.py b/TP03/TP03/lib/python3.9/site-packages/cffi/lock.py
new file mode 100644
index 0000000000000000000000000000000000000000..db91b7158c4ee9aa653462fe38e79ed1b553db87
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/lock.py
@@ -0,0 +1,30 @@
+import sys
+
+if sys.version_info < (3,):
+    try:
+        from thread import allocate_lock
+    except ImportError:
+        from dummy_thread import allocate_lock
+else:
+    try:
+        from _thread import allocate_lock
+    except ImportError:
+        from _dummy_thread import allocate_lock
+
+
+##import sys
+##l1 = allocate_lock
+
+##class allocate_lock(object):
+##    def __init__(self):
+##        self._real = l1()
+##    def __enter__(self):
+##        for i in range(4, 0, -1):
+##            print sys._getframe(i).f_code
+##        print
+##        return self._real.__enter__()
+##    def __exit__(self, *args):
+##        return self._real.__exit__(*args)
+##    def acquire(self, f):
+##        assert f is False
+##        return self._real.acquire(f)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/model.py b/TP03/TP03/lib/python3.9/site-packages/cffi/model.py
new file mode 100644
index 0000000000000000000000000000000000000000..1708f43df3cceef9a1fbd9fcf159c59f523b393e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/model.py
@@ -0,0 +1,618 @@
+import types
+import weakref
+
+from .lock import allocate_lock
+from .error import CDefError, VerificationError, VerificationMissing
+
+# type qualifiers
+Q_CONST    = 0x01
+Q_RESTRICT = 0x02
+Q_VOLATILE = 0x04
+
+def qualify(quals, replace_with):
+    if quals & Q_CONST:
+        replace_with = ' const ' + replace_with.lstrip()
+    if quals & Q_VOLATILE:
+        replace_with = ' volatile ' + replace_with.lstrip()
+    if quals & Q_RESTRICT:
+        # It seems that __restrict is supported by gcc and msvc.
+        # If you hit some different compiler, add a #define in
+        # _cffi_include.h for it (and in its copies, documented there)
+        replace_with = ' __restrict ' + replace_with.lstrip()
+    return replace_with
+
+
+class BaseTypeByIdentity(object):
+    is_array_type = False
+    is_raw_function = False
+
+    def get_c_name(self, replace_with='', context='a C file', quals=0):
+        result = self.c_name_with_marker
+        assert result.count('&') == 1
+        # some logic duplication with ffi.getctype()... :-(
+        replace_with = replace_with.strip()
+        if replace_with:
+            if replace_with.startswith('*') and '&[' in result:
+                replace_with = '(%s)' % replace_with
+            elif not replace_with[0] in '[(':
+                replace_with = ' ' + replace_with
+        replace_with = qualify(quals, replace_with)
+        result = result.replace('&', replace_with)
+        if '$' in result:
+            raise VerificationError(
+                "cannot generate '%s' in %s: unknown type name"
+                % (self._get_c_name(), context))
+        return result
+
+    def _get_c_name(self):
+        return self.c_name_with_marker.replace('&', '')
+
+    def has_c_name(self):
+        return '$' not in self._get_c_name()
+
+    def is_integer_type(self):
+        return False
+
+    def get_cached_btype(self, ffi, finishlist, can_delay=False):
+        try:
+            BType = ffi._cached_btypes[self]
+        except KeyError:
+            BType = self.build_backend_type(ffi, finishlist)
+            BType2 = ffi._cached_btypes.setdefault(self, BType)
+            assert BType2 is BType
+        return BType
+
+    def __repr__(self):
+        return '<%s>' % (self._get_c_name(),)
+
+    def _get_items(self):
+        return [(name, getattr(self, name)) for name in self._attrs_]
+
+
+class BaseType(BaseTypeByIdentity):
+
+    def __eq__(self, other):
+        return (self.__class__ == other.__class__ and
+                self._get_items() == other._get_items())
+
+    def __ne__(self, other):
+        return not self == other
+
+    def __hash__(self):
+        return hash((self.__class__, tuple(self._get_items())))
+
+
+class VoidType(BaseType):
+    _attrs_ = ()
+
+    def __init__(self):
+        self.c_name_with_marker = 'void&'
+
+    def build_backend_type(self, ffi, finishlist):
+        return global_cache(self, ffi, 'new_void_type')
+
+void_type = VoidType()
+
+
+class BasePrimitiveType(BaseType):
+    def is_complex_type(self):
+        return False
+
+
+class PrimitiveType(BasePrimitiveType):
+    _attrs_ = ('name',)
+
+    ALL_PRIMITIVE_TYPES = {
+        'char':               'c',
+        'short':              'i',
+        'int':                'i',
+        'long':               'i',
+        'long long':          'i',
+        'signed char':        'i',
+        'unsigned char':      'i',
+        'unsigned short':     'i',
+        'unsigned int':       'i',
+        'unsigned long':      'i',
+        'unsigned long long': 'i',
+        'float':              'f',
+        'double':             'f',
+        'long double':        'f',
+        'float _Complex':     'j',
+        'double _Complex':    'j',
+        '_Bool':              'i',
+        # the following types are not primitive in the C sense
+        'wchar_t':            'c',
+        'char16_t':           'c',
+        'char32_t':           'c',
+        'int8_t':             'i',
+        'uint8_t':            'i',
+        'int16_t':            'i',
+        'uint16_t':           'i',
+        'int32_t':            'i',
+        'uint32_t':           'i',
+        'int64_t':            'i',
+        'uint64_t':           'i',
+        'int_least8_t':       'i',
+        'uint_least8_t':      'i',
+        'int_least16_t':      'i',
+        'uint_least16_t':     'i',
+        'int_least32_t':      'i',
+        'uint_least32_t':     'i',
+        'int_least64_t':      'i',
+        'uint_least64_t':     'i',
+        'int_fast8_t':        'i',
+        'uint_fast8_t':       'i',
+        'int_fast16_t':       'i',
+        'uint_fast16_t':      'i',
+        'int_fast32_t':       'i',
+        'uint_fast32_t':      'i',
+        'int_fast64_t':       'i',
+        'uint_fast64_t':      'i',
+        'intptr_t':           'i',
+        'uintptr_t':          'i',
+        'intmax_t':           'i',
+        'uintmax_t':          'i',
+        'ptrdiff_t':          'i',
+        'size_t':             'i',
+        'ssize_t':            'i',
+        }
+
+    def __init__(self, name):
+        assert name in self.ALL_PRIMITIVE_TYPES
+        self.name = name
+        self.c_name_with_marker = name + '&'
+
+    def is_char_type(self):
+        return self.ALL_PRIMITIVE_TYPES[self.name] == 'c'
+    def is_integer_type(self):
+        return self.ALL_PRIMITIVE_TYPES[self.name] == 'i'
+    def is_float_type(self):
+        return self.ALL_PRIMITIVE_TYPES[self.name] == 'f'
+    def is_complex_type(self):
+        return self.ALL_PRIMITIVE_TYPES[self.name] == 'j'
+
+    def build_backend_type(self, ffi, finishlist):
+        return global_cache(self, ffi, 'new_primitive_type', self.name)
+
+
+class UnknownIntegerType(BasePrimitiveType):
+    _attrs_ = ('name',)
+
+    def __init__(self, name):
+        self.name = name
+        self.c_name_with_marker = name + '&'
+
+    def is_integer_type(self):
+        return True
+
+    def build_backend_type(self, ffi, finishlist):
+        raise NotImplementedError("integer type '%s' can only be used after "
+                                  "compilation" % self.name)
+
+class UnknownFloatType(BasePrimitiveType):
+    _attrs_ = ('name', )
+
+    def __init__(self, name):
+        self.name = name
+        self.c_name_with_marker = name + '&'
+
+    def build_backend_type(self, ffi, finishlist):
+        raise NotImplementedError("float type '%s' can only be used after "
+                                  "compilation" % self.name)
+
+
+class BaseFunctionType(BaseType):
+    _attrs_ = ('args', 'result', 'ellipsis', 'abi')
+
+    def __init__(self, args, result, ellipsis, abi=None):
+        self.args = args
+        self.result = result
+        self.ellipsis = ellipsis
+        self.abi = abi
+        #
+        reprargs = [arg._get_c_name() for arg in self.args]
+        if self.ellipsis:
+            reprargs.append('...')
+        reprargs = reprargs or ['void']
+        replace_with = self._base_pattern % (', '.join(reprargs),)
+        if abi is not None:
+            replace_with = replace_with[:1] + abi + ' ' + replace_with[1:]
+        self.c_name_with_marker = (
+            self.result.c_name_with_marker.replace('&', replace_with))
+
+
+class RawFunctionType(BaseFunctionType):
+    # Corresponds to a C type like 'int(int)', which is the C type of
+    # a function, but not a pointer-to-function.  The backend has no
+    # notion of such a type; it's used temporarily by parsing.
+    _base_pattern = '(&)(%s)'
+    is_raw_function = True
+
+    def build_backend_type(self, ffi, finishlist):
+        raise CDefError("cannot render the type %r: it is a function "
+                        "type, not a pointer-to-function type" % (self,))
+
+    def as_function_pointer(self):
+        return FunctionPtrType(self.args, self.result, self.ellipsis, self.abi)
+
+
+class FunctionPtrType(BaseFunctionType):
+    _base_pattern = '(*&)(%s)'
+
+    def build_backend_type(self, ffi, finishlist):
+        result = self.result.get_cached_btype(ffi, finishlist)
+        args = []
+        for tp in self.args:
+            args.append(tp.get_cached_btype(ffi, finishlist))
+        abi_args = ()
+        if self.abi == "__stdcall":
+            if not self.ellipsis:    # __stdcall ignored for variadic funcs
+                try:
+                    abi_args = (ffi._backend.FFI_STDCALL,)
+                except AttributeError:
+                    pass
+        return global_cache(self, ffi, 'new_function_type',
+                            tuple(args), result, self.ellipsis, *abi_args)
+
+    def as_raw_function(self):
+        return RawFunctionType(self.args, self.result, self.ellipsis, self.abi)
+
+
+class PointerType(BaseType):
+    _attrs_ = ('totype', 'quals')
+
+    def __init__(self, totype, quals=0):
+        self.totype = totype
+        self.quals = quals
+        extra = " *&"
+        if totype.is_array_type:
+            extra = "(%s)" % (extra.lstrip(),)
+        extra = qualify(quals, extra)
+        self.c_name_with_marker = totype.c_name_with_marker.replace('&', extra)
+
+    def build_backend_type(self, ffi, finishlist):
+        BItem = self.totype.get_cached_btype(ffi, finishlist, can_delay=True)
+        return global_cache(self, ffi, 'new_pointer_type', BItem)
+
+voidp_type = PointerType(void_type)
+
+def ConstPointerType(totype):
+    return PointerType(totype, Q_CONST)
+
+const_voidp_type = ConstPointerType(void_type)
+
+
+class NamedPointerType(PointerType):
+    _attrs_ = ('totype', 'name')
+
+    def __init__(self, totype, name, quals=0):
+        PointerType.__init__(self, totype, quals)
+        self.name = name
+        self.c_name_with_marker = name + '&'
+
+
+class ArrayType(BaseType):
+    _attrs_ = ('item', 'length')
+    is_array_type = True
+
+    def __init__(self, item, length):
+        self.item = item
+        self.length = length
+        #
+        if length is None:
+            brackets = '&[]'
+        elif length == '...':
+            brackets = '&[/*...*/]'
+        else:
+            brackets = '&[%s]' % length
+        self.c_name_with_marker = (
+            self.item.c_name_with_marker.replace('&', brackets))
+
+    def length_is_unknown(self):
+        return isinstance(self.length, str)
+
+    def resolve_length(self, newlength):
+        return ArrayType(self.item, newlength)
+
+    def build_backend_type(self, ffi, finishlist):
+        if self.length_is_unknown():
+            raise CDefError("cannot render the type %r: unknown length" %
+                            (self,))
+        self.item.get_cached_btype(ffi, finishlist)   # force the item BType
+        BPtrItem = PointerType(self.item).get_cached_btype(ffi, finishlist)
+        return global_cache(self, ffi, 'new_array_type', BPtrItem, self.length)
+
+char_array_type = ArrayType(PrimitiveType('char'), None)
+
+
+class StructOrUnionOrEnum(BaseTypeByIdentity):
+    _attrs_ = ('name',)
+    forcename = None
+
+    def build_c_name_with_marker(self):
+        name = self.forcename or '%s %s' % (self.kind, self.name)
+        self.c_name_with_marker = name + '&'
+
+    def force_the_name(self, forcename):
+        self.forcename = forcename
+        self.build_c_name_with_marker()
+
+    def get_official_name(self):
+        assert self.c_name_with_marker.endswith('&')
+        return self.c_name_with_marker[:-1]
+
+
+class StructOrUnion(StructOrUnionOrEnum):
+    fixedlayout = None
+    completed = 0
+    partial = False
+    packed = 0
+
+    def __init__(self, name, fldnames, fldtypes, fldbitsize, fldquals=None):
+        self.name = name
+        self.fldnames = fldnames
+        self.fldtypes = fldtypes
+        self.fldbitsize = fldbitsize
+        self.fldquals = fldquals
+        self.build_c_name_with_marker()
+
+    def anonymous_struct_fields(self):
+        if self.fldtypes is not None:
+            for name, type in zip(self.fldnames, self.fldtypes):
+                if name == '' and isinstance(type, StructOrUnion):
+                    yield type
+
+    def enumfields(self, expand_anonymous_struct_union=True):
+        fldquals = self.fldquals
+        if fldquals is None:
+            fldquals = (0,) * len(self.fldnames)
+        for name, type, bitsize, quals in zip(self.fldnames, self.fldtypes,
+                                              self.fldbitsize, fldquals):
+            if (name == '' and isinstance(type, StructOrUnion)
+                    and expand_anonymous_struct_union):
+                # nested anonymous struct/union
+                for result in type.enumfields():
+                    yield result
+            else:
+                yield (name, type, bitsize, quals)
+
+    def force_flatten(self):
+        # force the struct or union to have a declaration that lists
+        # directly all fields returned by enumfields(), flattening
+        # nested anonymous structs/unions.
+        names = []
+        types = []
+        bitsizes = []
+        fldquals = []
+        for name, type, bitsize, quals in self.enumfields():
+            names.append(name)
+            types.append(type)
+            bitsizes.append(bitsize)
+            fldquals.append(quals)
+        self.fldnames = tuple(names)
+        self.fldtypes = tuple(types)
+        self.fldbitsize = tuple(bitsizes)
+        self.fldquals = tuple(fldquals)
+
+    def get_cached_btype(self, ffi, finishlist, can_delay=False):
+        BType = StructOrUnionOrEnum.get_cached_btype(self, ffi, finishlist,
+                                                     can_delay)
+        if not can_delay:
+            self.finish_backend_type(ffi, finishlist)
+        return BType
+
+    def finish_backend_type(self, ffi, finishlist):
+        if self.completed:
+            if self.completed != 2:
+                raise NotImplementedError("recursive structure declaration "
+                                          "for '%s'" % (self.name,))
+            return
+        BType = ffi._cached_btypes[self]
+        #
+        self.completed = 1
+        #
+        if self.fldtypes is None:
+            pass    # not completing it: it's an opaque struct
+            #
+        elif self.fixedlayout is None:
+            fldtypes = [tp.get_cached_btype(ffi, finishlist)
+                        for tp in self.fldtypes]
+            lst = list(zip(self.fldnames, fldtypes, self.fldbitsize))
+            extra_flags = ()
+            if self.packed:
+                if self.packed == 1:
+                    extra_flags = (8,)    # SF_PACKED
+                else:
+                    extra_flags = (0, self.packed)
+            ffi._backend.complete_struct_or_union(BType, lst, self,
+                                                  -1, -1, *extra_flags)
+            #
+        else:
+            fldtypes = []
+            fieldofs, fieldsize, totalsize, totalalignment = self.fixedlayout
+            for i in range(len(self.fldnames)):
+                fsize = fieldsize[i]
+                ftype = self.fldtypes[i]
+                #
+                if isinstance(ftype, ArrayType) and ftype.length_is_unknown():
+                    # fix the length to match the total size
+                    BItemType = ftype.item.get_cached_btype(ffi, finishlist)
+                    nlen, nrest = divmod(fsize, ffi.sizeof(BItemType))
+                    if nrest != 0:
+                        self._verification_error(
+                            "field '%s.%s' has a bogus size?" % (
+                            self.name, self.fldnames[i] or '{}'))
+                    ftype = ftype.resolve_length(nlen)
+                    self.fldtypes = (self.fldtypes[:i] + (ftype,) +
+                                     self.fldtypes[i+1:])
+                #
+                BFieldType = ftype.get_cached_btype(ffi, finishlist)
+                if isinstance(ftype, ArrayType) and ftype.length is None:
+                    assert fsize == 0
+                else:
+                    bitemsize = ffi.sizeof(BFieldType)
+                    if bitemsize != fsize:
+                        self._verification_error(
+                            "field '%s.%s' is declared as %d bytes, but is "
+                            "really %d bytes" % (self.name,
+                                                 self.fldnames[i] or '{}',
+                                                 bitemsize, fsize))
+                fldtypes.append(BFieldType)
+            #
+            lst = list(zip(self.fldnames, fldtypes, self.fldbitsize, fieldofs))
+            ffi._backend.complete_struct_or_union(BType, lst, self,
+                                                  totalsize, totalalignment)
+        self.completed = 2
+
+    def _verification_error(self, msg):
+        raise VerificationError(msg)
+
+    def check_not_partial(self):
+        if self.partial and self.fixedlayout is None:
+            raise VerificationMissing(self._get_c_name())
+
+    def build_backend_type(self, ffi, finishlist):
+        self.check_not_partial()
+        finishlist.append(self)
+        #
+        return global_cache(self, ffi, 'new_%s_type' % self.kind,
+                            self.get_official_name(), key=self)
+
+
+class StructType(StructOrUnion):
+    kind = 'struct'
+
+
+class UnionType(StructOrUnion):
+    kind = 'union'
+
+
+class EnumType(StructOrUnionOrEnum):
+    kind = 'enum'
+    partial = False
+    partial_resolved = False
+
+    def __init__(self, name, enumerators, enumvalues, baseinttype=None):
+        self.name = name
+        self.enumerators = enumerators
+        self.enumvalues = enumvalues
+        self.baseinttype = baseinttype
+        self.build_c_name_with_marker()
+
+    def force_the_name(self, forcename):
+        StructOrUnionOrEnum.force_the_name(self, forcename)
+        if self.forcename is None:
+            name = self.get_official_name()
+            self.forcename = '$' + name.replace(' ', '_')
+
+    def check_not_partial(self):
+        if self.partial and not self.partial_resolved:
+            raise VerificationMissing(self._get_c_name())
+
+    def build_backend_type(self, ffi, finishlist):
+        self.check_not_partial()
+        base_btype = self.build_baseinttype(ffi, finishlist)
+        return global_cache(self, ffi, 'new_enum_type',
+                            self.get_official_name(),
+                            self.enumerators, self.enumvalues,
+                            base_btype, key=self)
+
+    def build_baseinttype(self, ffi, finishlist):
+        if self.baseinttype is not None:
+            return self.baseinttype.get_cached_btype(ffi, finishlist)
+        #
+        if self.enumvalues:
+            smallest_value = min(self.enumvalues)
+            largest_value = max(self.enumvalues)
+        else:
+            import warnings
+            try:
+                # XXX!  The goal is to ensure that the warnings.warn()
+                # will not suppress the warning.  We want to get it
+                # several times if we reach this point several times.
+                __warningregistry__.clear()
+            except NameError:
+                pass
+            warnings.warn("%r has no values explicitly defined; "
+                          "guessing that it is equivalent to 'unsigned int'"
+                          % self._get_c_name())
+            smallest_value = largest_value = 0
+        if smallest_value < 0:   # needs a signed type
+            sign = 1
+            candidate1 = PrimitiveType("int")
+            candidate2 = PrimitiveType("long")
+        else:
+            sign = 0
+            candidate1 = PrimitiveType("unsigned int")
+            candidate2 = PrimitiveType("unsigned long")
+        btype1 = candidate1.get_cached_btype(ffi, finishlist)
+        btype2 = candidate2.get_cached_btype(ffi, finishlist)
+        size1 = ffi.sizeof(btype1)
+        size2 = ffi.sizeof(btype2)
+        if (smallest_value >= ((-1) << (8*size1-1)) and
+            largest_value < (1 << (8*size1-sign))):
+            return btype1
+        if (smallest_value >= ((-1) << (8*size2-1)) and
+            largest_value < (1 << (8*size2-sign))):
+            return btype2
+        raise CDefError("%s values don't all fit into either 'long' "
+                        "or 'unsigned long'" % self._get_c_name())
+
+def unknown_type(name, structname=None):
+    if structname is None:
+        structname = '$%s' % name
+    tp = StructType(structname, None, None, None)
+    tp.force_the_name(name)
+    tp.origin = "unknown_type"
+    return tp
+
+def unknown_ptr_type(name, structname=None):
+    if structname is None:
+        structname = '$$%s' % name
+    tp = StructType(structname, None, None, None)
+    return NamedPointerType(tp, name)
+
+
+global_lock = allocate_lock()
+_typecache_cffi_backend = weakref.WeakValueDictionary()
+
+def get_typecache(backend):
+    # returns _typecache_cffi_backend if backend is the _cffi_backend
+    # module, or type(backend).__typecache if backend is an instance of
+    # CTypesBackend (or some FakeBackend class during tests)
+    if isinstance(backend, types.ModuleType):
+        return _typecache_cffi_backend
+    with global_lock:
+        if not hasattr(type(backend), '__typecache'):
+            type(backend).__typecache = weakref.WeakValueDictionary()
+        return type(backend).__typecache
+
+def global_cache(srctype, ffi, funcname, *args, **kwds):
+    key = kwds.pop('key', (funcname, args))
+    assert not kwds
+    try:
+        return ffi._typecache[key]
+    except KeyError:
+        pass
+    try:
+        res = getattr(ffi._backend, funcname)(*args)
+    except NotImplementedError as e:
+        raise NotImplementedError("%s: %r: %s" % (funcname, srctype, e))
+    # note that setdefault() on WeakValueDictionary is not atomic
+    # and contains a rare bug (http://bugs.python.org/issue19542);
+    # we have to use a lock and do it ourselves
+    cache = ffi._typecache
+    with global_lock:
+        res1 = cache.get(key)
+        if res1 is None:
+            cache[key] = res
+            return res
+        else:
+            return res1
+
+def pointer_cache(ffi, BType):
+    return global_cache('?', ffi, 'new_pointer_type', BType)
+
+def attach_exception_info(e, name):
+    if e.args and type(e.args[0]) is str:
+        e.args = ('%s: %s' % (name, e.args[0]),) + e.args[1:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/parse_c_type.h b/TP03/TP03/lib/python3.9/site-packages/cffi/parse_c_type.h
new file mode 100644
index 0000000000000000000000000000000000000000..84e4ef85659eb63e6453d8af9f024f1866182342
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/parse_c_type.h
@@ -0,0 +1,181 @@
+
+/* This part is from file 'cffi/parse_c_type.h'.  It is copied at the
+   beginning of C sources generated by CFFI's ffi.set_source(). */
+
+typedef void *_cffi_opcode_t;
+
+#define _CFFI_OP(opcode, arg)   (_cffi_opcode_t)(opcode | (((uintptr_t)(arg)) << 8))
+#define _CFFI_GETOP(cffi_opcode)    ((unsigned char)(uintptr_t)cffi_opcode)
+#define _CFFI_GETARG(cffi_opcode)   (((intptr_t)cffi_opcode) >> 8)
+
+#define _CFFI_OP_PRIMITIVE       1
+#define _CFFI_OP_POINTER         3
+#define _CFFI_OP_ARRAY           5
+#define _CFFI_OP_OPEN_ARRAY      7
+#define _CFFI_OP_STRUCT_UNION    9
+#define _CFFI_OP_ENUM           11
+#define _CFFI_OP_FUNCTION       13
+#define _CFFI_OP_FUNCTION_END   15
+#define _CFFI_OP_NOOP           17
+#define _CFFI_OP_BITFIELD       19
+#define _CFFI_OP_TYPENAME       21
+#define _CFFI_OP_CPYTHON_BLTN_V 23   // varargs
+#define _CFFI_OP_CPYTHON_BLTN_N 25   // noargs
+#define _CFFI_OP_CPYTHON_BLTN_O 27   // O  (i.e. a single arg)
+#define _CFFI_OP_CONSTANT       29
+#define _CFFI_OP_CONSTANT_INT   31
+#define _CFFI_OP_GLOBAL_VAR     33
+#define _CFFI_OP_DLOPEN_FUNC    35
+#define _CFFI_OP_DLOPEN_CONST   37
+#define _CFFI_OP_GLOBAL_VAR_F   39
+#define _CFFI_OP_EXTERN_PYTHON  41
+
+#define _CFFI_PRIM_VOID          0
+#define _CFFI_PRIM_BOOL          1
+#define _CFFI_PRIM_CHAR          2
+#define _CFFI_PRIM_SCHAR         3
+#define _CFFI_PRIM_UCHAR         4
+#define _CFFI_PRIM_SHORT         5
+#define _CFFI_PRIM_USHORT        6
+#define _CFFI_PRIM_INT           7
+#define _CFFI_PRIM_UINT          8
+#define _CFFI_PRIM_LONG          9
+#define _CFFI_PRIM_ULONG        10
+#define _CFFI_PRIM_LONGLONG     11
+#define _CFFI_PRIM_ULONGLONG    12
+#define _CFFI_PRIM_FLOAT        13
+#define _CFFI_PRIM_DOUBLE       14
+#define _CFFI_PRIM_LONGDOUBLE   15
+
+#define _CFFI_PRIM_WCHAR        16
+#define _CFFI_PRIM_INT8         17
+#define _CFFI_PRIM_UINT8        18
+#define _CFFI_PRIM_INT16        19
+#define _CFFI_PRIM_UINT16       20
+#define _CFFI_PRIM_INT32        21
+#define _CFFI_PRIM_UINT32       22
+#define _CFFI_PRIM_INT64        23
+#define _CFFI_PRIM_UINT64       24
+#define _CFFI_PRIM_INTPTR       25
+#define _CFFI_PRIM_UINTPTR      26
+#define _CFFI_PRIM_PTRDIFF      27
+#define _CFFI_PRIM_SIZE         28
+#define _CFFI_PRIM_SSIZE        29
+#define _CFFI_PRIM_INT_LEAST8   30
+#define _CFFI_PRIM_UINT_LEAST8  31
+#define _CFFI_PRIM_INT_LEAST16  32
+#define _CFFI_PRIM_UINT_LEAST16 33
+#define _CFFI_PRIM_INT_LEAST32  34
+#define _CFFI_PRIM_UINT_LEAST32 35
+#define _CFFI_PRIM_INT_LEAST64  36
+#define _CFFI_PRIM_UINT_LEAST64 37
+#define _CFFI_PRIM_INT_FAST8    38
+#define _CFFI_PRIM_UINT_FAST8   39
+#define _CFFI_PRIM_INT_FAST16   40
+#define _CFFI_PRIM_UINT_FAST16  41
+#define _CFFI_PRIM_INT_FAST32   42
+#define _CFFI_PRIM_UINT_FAST32  43
+#define _CFFI_PRIM_INT_FAST64   44
+#define _CFFI_PRIM_UINT_FAST64  45
+#define _CFFI_PRIM_INTMAX       46
+#define _CFFI_PRIM_UINTMAX      47
+#define _CFFI_PRIM_FLOATCOMPLEX 48
+#define _CFFI_PRIM_DOUBLECOMPLEX 49
+#define _CFFI_PRIM_CHAR16       50
+#define _CFFI_PRIM_CHAR32       51
+
+#define _CFFI__NUM_PRIM         52
+#define _CFFI__UNKNOWN_PRIM           (-1)
+#define _CFFI__UNKNOWN_FLOAT_PRIM     (-2)
+#define _CFFI__UNKNOWN_LONG_DOUBLE    (-3)
+
+#define _CFFI__IO_FILE_STRUCT         (-1)
+
+
+struct _cffi_global_s {
+    const char *name;
+    void *address;
+    _cffi_opcode_t type_op;
+    void *size_or_direct_fn;  // OP_GLOBAL_VAR: size, or 0 if unknown
+                              // OP_CPYTHON_BLTN_*: addr of direct function
+};
+
+struct _cffi_getconst_s {
+    unsigned long long value;
+    const struct _cffi_type_context_s *ctx;
+    int gindex;
+};
+
+struct _cffi_struct_union_s {
+    const char *name;
+    int type_index;          // -> _cffi_types, on a OP_STRUCT_UNION
+    int flags;               // _CFFI_F_* flags below
+    size_t size;
+    int alignment;
+    int first_field_index;   // -> _cffi_fields array
+    int num_fields;
+};
+#define _CFFI_F_UNION         0x01   // is a union, not a struct
+#define _CFFI_F_CHECK_FIELDS  0x02   // complain if fields are not in the
+                                     // "standard layout" or if some are missing
+#define _CFFI_F_PACKED        0x04   // for CHECK_FIELDS, assume a packed struct
+#define _CFFI_F_EXTERNAL      0x08   // in some other ffi.include()
+#define _CFFI_F_OPAQUE        0x10   // opaque
+
+struct _cffi_field_s {
+    const char *name;
+    size_t field_offset;
+    size_t field_size;
+    _cffi_opcode_t field_type_op;
+};
+
+struct _cffi_enum_s {
+    const char *name;
+    int type_index;          // -> _cffi_types, on a OP_ENUM
+    int type_prim;           // _CFFI_PRIM_xxx
+    const char *enumerators; // comma-delimited string
+};
+
+struct _cffi_typename_s {
+    const char *name;
+    int type_index;   /* if opaque, points to a possibly artificial
+                         OP_STRUCT which is itself opaque */
+};
+
+struct _cffi_type_context_s {
+    _cffi_opcode_t *types;
+    const struct _cffi_global_s *globals;
+    const struct _cffi_field_s *fields;
+    const struct _cffi_struct_union_s *struct_unions;
+    const struct _cffi_enum_s *enums;
+    const struct _cffi_typename_s *typenames;
+    int num_globals;
+    int num_struct_unions;
+    int num_enums;
+    int num_typenames;
+    const char *const *includes;
+    int num_types;
+    int flags;      /* future extension */
+};
+
+struct _cffi_parse_info_s {
+    const struct _cffi_type_context_s *ctx;
+    _cffi_opcode_t *output;
+    unsigned int output_size;
+    size_t error_location;
+    const char *error_message;
+};
+
+struct _cffi_externpy_s {
+    const char *name;
+    size_t size_of_result;
+    void *reserved1, *reserved2;
+};
+
+#ifdef _CFFI_INTERNAL
+static int parse_c_type(struct _cffi_parse_info_s *info, const char *input);
+static int search_in_globals(const struct _cffi_type_context_s *ctx,
+                             const char *search, size_t search_len);
+static int search_in_struct_unions(const struct _cffi_type_context_s *ctx,
+                                   const char *search, size_t search_len);
+#endif
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/pkgconfig.py b/TP03/TP03/lib/python3.9/site-packages/cffi/pkgconfig.py
new file mode 100644
index 0000000000000000000000000000000000000000..5c93f15a60e6f904b2dd108d6e22044a5890bcb4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/pkgconfig.py
@@ -0,0 +1,121 @@
+# pkg-config, https://www.freedesktop.org/wiki/Software/pkg-config/ integration for cffi
+import sys, os, subprocess
+
+from .error import PkgConfigError
+
+
+def merge_flags(cfg1, cfg2):
+    """Merge values from cffi config flags cfg2 to cf1
+
+    Example:
+        merge_flags({"libraries": ["one"]}, {"libraries": ["two"]})
+        {"libraries": ["one", "two"]}
+    """
+    for key, value in cfg2.items():
+        if key not in cfg1:
+            cfg1[key] = value
+        else:
+            if not isinstance(cfg1[key], list):
+                raise TypeError("cfg1[%r] should be a list of strings" % (key,))
+            if not isinstance(value, list):
+                raise TypeError("cfg2[%r] should be a list of strings" % (key,))
+            cfg1[key].extend(value)
+    return cfg1
+
+
+def call(libname, flag, encoding=sys.getfilesystemencoding()):
+    """Calls pkg-config and returns the output if found
+    """
+    a = ["pkg-config", "--print-errors"]
+    a.append(flag)
+    a.append(libname)
+    try:
+        pc = subprocess.Popen(a, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+    except EnvironmentError as e:
+        raise PkgConfigError("cannot run pkg-config: %s" % (str(e).strip(),))
+
+    bout, berr = pc.communicate()
+    if pc.returncode != 0:
+        try:
+            berr = berr.decode(encoding)
+        except Exception:
+            pass
+        raise PkgConfigError(berr.strip())
+
+    if sys.version_info >= (3,) and not isinstance(bout, str):   # Python 3.x
+        try:
+            bout = bout.decode(encoding)
+        except UnicodeDecodeError:
+            raise PkgConfigError("pkg-config %s %s returned bytes that cannot "
+                                 "be decoded with encoding %r:\n%r" %
+                                 (flag, libname, encoding, bout))
+
+    if os.altsep != '\\' and '\\' in bout:
+        raise PkgConfigError("pkg-config %s %s returned an unsupported "
+                             "backslash-escaped output:\n%r" %
+                             (flag, libname, bout))
+    return bout
+
+
+def flags_from_pkgconfig(libs):
+    r"""Return compiler line flags for FFI.set_source based on pkg-config output
+
+    Usage
+        ...
+        ffibuilder.set_source("_foo", pkgconfig = ["libfoo", "libbar >= 1.8.3"])
+
+    If pkg-config is installed on build machine, then arguments include_dirs,
+    library_dirs, libraries, define_macros, extra_compile_args and
+    extra_link_args are extended with an output of pkg-config for libfoo and
+    libbar.
+
+    Raises PkgConfigError in case the pkg-config call fails.
+    """
+
+    def get_include_dirs(string):
+        return [x[2:] for x in string.split() if x.startswith("-I")]
+
+    def get_library_dirs(string):
+        return [x[2:] for x in string.split() if x.startswith("-L")]
+
+    def get_libraries(string):
+        return [x[2:] for x in string.split() if x.startswith("-l")]
+
+    # convert -Dfoo=bar to list of tuples [("foo", "bar")] expected by distutils
+    def get_macros(string):
+        def _macro(x):
+            x = x[2:]    # drop "-D"
+            if '=' in x:
+                return tuple(x.split("=", 1))  # "-Dfoo=bar" => ("foo", "bar")
+            else:
+                return (x, None)               # "-Dfoo" => ("foo", None)
+        return [_macro(x) for x in string.split() if x.startswith("-D")]
+
+    def get_other_cflags(string):
+        return [x for x in string.split() if not x.startswith("-I") and
+                                             not x.startswith("-D")]
+
+    def get_other_libs(string):
+        return [x for x in string.split() if not x.startswith("-L") and
+                                             not x.startswith("-l")]
+
+    # return kwargs for given libname
+    def kwargs(libname):
+        fse = sys.getfilesystemencoding()
+        all_cflags = call(libname, "--cflags")
+        all_libs = call(libname, "--libs")
+        return {
+            "include_dirs": get_include_dirs(all_cflags),
+            "library_dirs": get_library_dirs(all_libs),
+            "libraries": get_libraries(all_libs),
+            "define_macros": get_macros(all_cflags),
+            "extra_compile_args": get_other_cflags(all_cflags),
+            "extra_link_args": get_other_libs(all_libs),
+            }
+
+    # merge all arguments together
+    ret = {}
+    for libname in libs:
+        lib_flags = kwargs(libname)
+        merge_flags(ret, lib_flags)
+    return ret
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/recompiler.py b/TP03/TP03/lib/python3.9/site-packages/cffi/recompiler.py
new file mode 100644
index 0000000000000000000000000000000000000000..4167bc05f97826f9452fdd2dd04eaf94f55034b2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/recompiler.py
@@ -0,0 +1,1581 @@
+import os, sys, io
+from . import ffiplatform, model
+from .error import VerificationError
+from .cffi_opcode import *
+
+VERSION_BASE = 0x2601
+VERSION_EMBEDDED = 0x2701
+VERSION_CHAR16CHAR32 = 0x2801
+
+USE_LIMITED_API = (sys.platform != 'win32' or sys.version_info < (3, 0) or
+                   sys.version_info >= (3, 5))
+
+
+class GlobalExpr:
+    def __init__(self, name, address, type_op, size=0, check_value=0):
+        self.name = name
+        self.address = address
+        self.type_op = type_op
+        self.size = size
+        self.check_value = check_value
+
+    def as_c_expr(self):
+        return '  { "%s", (void *)%s, %s, (void *)%s },' % (
+            self.name, self.address, self.type_op.as_c_expr(), self.size)
+
+    def as_python_expr(self):
+        return "b'%s%s',%d" % (self.type_op.as_python_bytes(), self.name,
+                               self.check_value)
+
+class FieldExpr:
+    def __init__(self, name, field_offset, field_size, fbitsize, field_type_op):
+        self.name = name
+        self.field_offset = field_offset
+        self.field_size = field_size
+        self.fbitsize = fbitsize
+        self.field_type_op = field_type_op
+
+    def as_c_expr(self):
+        spaces = " " * len(self.name)
+        return ('  { "%s", %s,\n' % (self.name, self.field_offset) +
+                '     %s   %s,\n' % (spaces, self.field_size) +
+                '     %s   %s },' % (spaces, self.field_type_op.as_c_expr()))
+
+    def as_python_expr(self):
+        raise NotImplementedError
+
+    def as_field_python_expr(self):
+        if self.field_type_op.op == OP_NOOP:
+            size_expr = ''
+        elif self.field_type_op.op == OP_BITFIELD:
+            size_expr = format_four_bytes(self.fbitsize)
+        else:
+            raise NotImplementedError
+        return "b'%s%s%s'" % (self.field_type_op.as_python_bytes(),
+                              size_expr,
+                              self.name)
+
+class StructUnionExpr:
+    def __init__(self, name, type_index, flags, size, alignment, comment,
+                 first_field_index, c_fields):
+        self.name = name
+        self.type_index = type_index
+        self.flags = flags
+        self.size = size
+        self.alignment = alignment
+        self.comment = comment
+        self.first_field_index = first_field_index
+        self.c_fields = c_fields
+
+    def as_c_expr(self):
+        return ('  { "%s", %d, %s,' % (self.name, self.type_index, self.flags)
+                + '\n    %s, %s, ' % (self.size, self.alignment)
+                + '%d, %d ' % (self.first_field_index, len(self.c_fields))
+                + ('/* %s */ ' % self.comment if self.comment else '')
+                + '},')
+
+    def as_python_expr(self):
+        flags = eval(self.flags, G_FLAGS)
+        fields_expr = [c_field.as_field_python_expr()
+                       for c_field in self.c_fields]
+        return "(b'%s%s%s',%s)" % (
+            format_four_bytes(self.type_index),
+            format_four_bytes(flags),
+            self.name,
+            ','.join(fields_expr))
+
+class EnumExpr:
+    def __init__(self, name, type_index, size, signed, allenums):
+        self.name = name
+        self.type_index = type_index
+        self.size = size
+        self.signed = signed
+        self.allenums = allenums
+
+    def as_c_expr(self):
+        return ('  { "%s", %d, _cffi_prim_int(%s, %s),\n'
+                '    "%s" },' % (self.name, self.type_index,
+                                 self.size, self.signed, self.allenums))
+
+    def as_python_expr(self):
+        prim_index = {
+            (1, 0): PRIM_UINT8,  (1, 1):  PRIM_INT8,
+            (2, 0): PRIM_UINT16, (2, 1):  PRIM_INT16,
+            (4, 0): PRIM_UINT32, (4, 1):  PRIM_INT32,
+            (8, 0): PRIM_UINT64, (8, 1):  PRIM_INT64,
+            }[self.size, self.signed]
+        return "b'%s%s%s\\x00%s'" % (format_four_bytes(self.type_index),
+                                     format_four_bytes(prim_index),
+                                     self.name, self.allenums)
+
+class TypenameExpr:
+    def __init__(self, name, type_index):
+        self.name = name
+        self.type_index = type_index
+
+    def as_c_expr(self):
+        return '  { "%s", %d },' % (self.name, self.type_index)
+
+    def as_python_expr(self):
+        return "b'%s%s'" % (format_four_bytes(self.type_index), self.name)
+
+
+# ____________________________________________________________
+
+
+class Recompiler:
+    _num_externpy = 0
+
+    def __init__(self, ffi, module_name, target_is_python=False):
+        self.ffi = ffi
+        self.module_name = module_name
+        self.target_is_python = target_is_python
+        self._version = VERSION_BASE
+
+    def needs_version(self, ver):
+        self._version = max(self._version, ver)
+
+    def collect_type_table(self):
+        self._typesdict = {}
+        self._generate("collecttype")
+        #
+        all_decls = sorted(self._typesdict, key=str)
+        #
+        # prepare all FUNCTION bytecode sequences first
+        self.cffi_types = []
+        for tp in all_decls:
+            if tp.is_raw_function:
+                assert self._typesdict[tp] is None
+                self._typesdict[tp] = len(self.cffi_types)
+                self.cffi_types.append(tp)     # placeholder
+                for tp1 in tp.args:
+                    assert isinstance(tp1, (model.VoidType,
+                                            model.BasePrimitiveType,
+                                            model.PointerType,
+                                            model.StructOrUnionOrEnum,
+                                            model.FunctionPtrType))
+                    if self._typesdict[tp1] is None:
+                        self._typesdict[tp1] = len(self.cffi_types)
+                    self.cffi_types.append(tp1)   # placeholder
+                self.cffi_types.append('END')     # placeholder
+        #
+        # prepare all OTHER bytecode sequences
+        for tp in all_decls:
+            if not tp.is_raw_function and self._typesdict[tp] is None:
+                self._typesdict[tp] = len(self.cffi_types)
+                self.cffi_types.append(tp)        # placeholder
+                if tp.is_array_type and tp.length is not None:
+                    self.cffi_types.append('LEN') # placeholder
+        assert None not in self._typesdict.values()
+        #
+        # collect all structs and unions and enums
+        self._struct_unions = {}
+        self._enums = {}
+        for tp in all_decls:
+            if isinstance(tp, model.StructOrUnion):
+                self._struct_unions[tp] = None
+            elif isinstance(tp, model.EnumType):
+                self._enums[tp] = None
+        for i, tp in enumerate(sorted(self._struct_unions,
+                                      key=lambda tp: tp.name)):
+            self._struct_unions[tp] = i
+        for i, tp in enumerate(sorted(self._enums,
+                                      key=lambda tp: tp.name)):
+            self._enums[tp] = i
+        #
+        # emit all bytecode sequences now
+        for tp in all_decls:
+            method = getattr(self, '_emit_bytecode_' + tp.__class__.__name__)
+            method(tp, self._typesdict[tp])
+        #
+        # consistency check
+        for op in self.cffi_types:
+            assert isinstance(op, CffiOp)
+        self.cffi_types = tuple(self.cffi_types)    # don't change any more
+
+    def _enum_fields(self, tp):
+        # When producing C, expand all anonymous struct/union fields.
+        # That's necessary to have C code checking the offsets of the
+        # individual fields contained in them.  When producing Python,
+        # don't do it and instead write it like it is, with the
+        # corresponding fields having an empty name.  Empty names are
+        # recognized at runtime when we import the generated Python
+        # file.
+        expand_anonymous_struct_union = not self.target_is_python
+        return tp.enumfields(expand_anonymous_struct_union)
+
+    def _do_collect_type(self, tp):
+        if not isinstance(tp, model.BaseTypeByIdentity):
+            if isinstance(tp, tuple):
+                for x in tp:
+                    self._do_collect_type(x)
+            return
+        if tp not in self._typesdict:
+            self._typesdict[tp] = None
+            if isinstance(tp, model.FunctionPtrType):
+                self._do_collect_type(tp.as_raw_function())
+            elif isinstance(tp, model.StructOrUnion):
+                if tp.fldtypes is not None and (
+                        tp not in self.ffi._parser._included_declarations):
+                    for name1, tp1, _, _ in self._enum_fields(tp):
+                        self._do_collect_type(self._field_type(tp, name1, tp1))
+            else:
+                for _, x in tp._get_items():
+                    self._do_collect_type(x)
+
+    def _generate(self, step_name):
+        lst = self.ffi._parser._declarations.items()
+        for name, (tp, quals) in sorted(lst):
+            kind, realname = name.split(' ', 1)
+            try:
+                method = getattr(self, '_generate_cpy_%s_%s' % (kind,
+                                                                step_name))
+            except AttributeError:
+                raise VerificationError(
+                    "not implemented in recompile(): %r" % name)
+            try:
+                self._current_quals = quals
+                method(tp, realname)
+            except Exception as e:
+                model.attach_exception_info(e, name)
+                raise
+
+    # ----------
+
+    ALL_STEPS = ["global", "field", "struct_union", "enum", "typename"]
+
+    def collect_step_tables(self):
+        # collect the declarations for '_cffi_globals', '_cffi_typenames', etc.
+        self._lsts = {}
+        for step_name in self.ALL_STEPS:
+            self._lsts[step_name] = []
+        self._seen_struct_unions = set()
+        self._generate("ctx")
+        self._add_missing_struct_unions()
+        #
+        for step_name in self.ALL_STEPS:
+            lst = self._lsts[step_name]
+            if step_name != "field":
+                lst.sort(key=lambda entry: entry.name)
+            self._lsts[step_name] = tuple(lst)    # don't change any more
+        #
+        # check for a possible internal inconsistency: _cffi_struct_unions
+        # should have been generated with exactly self._struct_unions
+        lst = self._lsts["struct_union"]
+        for tp, i in self._struct_unions.items():
+            assert i < len(lst)
+            assert lst[i].name == tp.name
+        assert len(lst) == len(self._struct_unions)
+        # same with enums
+        lst = self._lsts["enum"]
+        for tp, i in self._enums.items():
+            assert i < len(lst)
+            assert lst[i].name == tp.name
+        assert len(lst) == len(self._enums)
+
+    # ----------
+
+    def _prnt(self, what=''):
+        self._f.write(what + '\n')
+
+    def write_source_to_f(self, f, preamble):
+        if self.target_is_python:
+            assert preamble is None
+            self.write_py_source_to_f(f)
+        else:
+            assert preamble is not None
+            self.write_c_source_to_f(f, preamble)
+
+    def _rel_readlines(self, filename):
+        g = open(os.path.join(os.path.dirname(__file__), filename), 'r')
+        lines = g.readlines()
+        g.close()
+        return lines
+
+    def write_c_source_to_f(self, f, preamble):
+        self._f = f
+        prnt = self._prnt
+        if self.ffi._embedding is not None:
+            prnt('#define _CFFI_USE_EMBEDDING')
+        if not USE_LIMITED_API:
+            prnt('#define _CFFI_NO_LIMITED_API')
+        #
+        # first the '#include' (actually done by inlining the file's content)
+        lines = self._rel_readlines('_cffi_include.h')
+        i = lines.index('#include "parse_c_type.h"\n')
+        lines[i:i+1] = self._rel_readlines('parse_c_type.h')
+        prnt(''.join(lines))
+        #
+        # if we have ffi._embedding != None, we give it here as a macro
+        # and include an extra file
+        base_module_name = self.module_name.split('.')[-1]
+        if self.ffi._embedding is not None:
+            prnt('#define _CFFI_MODULE_NAME  "%s"' % (self.module_name,))
+            prnt('static const char _CFFI_PYTHON_STARTUP_CODE[] = {')
+            self._print_string_literal_in_array(self.ffi._embedding)
+            prnt('0 };')
+            prnt('#ifdef PYPY_VERSION')
+            prnt('# define _CFFI_PYTHON_STARTUP_FUNC  _cffi_pypyinit_%s' % (
+                base_module_name,))
+            prnt('#elif PY_MAJOR_VERSION >= 3')
+            prnt('# define _CFFI_PYTHON_STARTUP_FUNC  PyInit_%s' % (
+                base_module_name,))
+            prnt('#else')
+            prnt('# define _CFFI_PYTHON_STARTUP_FUNC  init%s' % (
+                base_module_name,))
+            prnt('#endif')
+            lines = self._rel_readlines('_embedding.h')
+            i = lines.index('#include "_cffi_errors.h"\n')
+            lines[i:i+1] = self._rel_readlines('_cffi_errors.h')
+            prnt(''.join(lines))
+            self.needs_version(VERSION_EMBEDDED)
+        #
+        # then paste the C source given by the user, verbatim.
+        prnt('/************************************************************/')
+        prnt()
+        prnt(preamble)
+        prnt()
+        prnt('/************************************************************/')
+        prnt()
+        #
+        # the declaration of '_cffi_types'
+        prnt('static void *_cffi_types[] = {')
+        typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()])
+        for i, op in enumerate(self.cffi_types):
+            comment = ''
+            if i in typeindex2type:
+                comment = ' // ' + typeindex2type[i]._get_c_name()
+            prnt('/* %2d */ %s,%s' % (i, op.as_c_expr(), comment))
+        if not self.cffi_types:
+            prnt('  0')
+        prnt('};')
+        prnt()
+        #
+        # call generate_cpy_xxx_decl(), for every xxx found from
+        # ffi._parser._declarations.  This generates all the functions.
+        self._seen_constants = set()
+        self._generate("decl")
+        #
+        # the declaration of '_cffi_globals' and '_cffi_typenames'
+        nums = {}
+        for step_name in self.ALL_STEPS:
+            lst = self._lsts[step_name]
+            nums[step_name] = len(lst)
+            if nums[step_name] > 0:
+                prnt('static const struct _cffi_%s_s _cffi_%ss[] = {' % (
+                    step_name, step_name))
+                for entry in lst:
+                    prnt(entry.as_c_expr())
+                prnt('};')
+                prnt()
+        #
+        # the declaration of '_cffi_includes'
+        if self.ffi._included_ffis:
+            prnt('static const char * const _cffi_includes[] = {')
+            for ffi_to_include in self.ffi._included_ffis:
+                try:
+                    included_module_name, included_source = (
+                        ffi_to_include._assigned_source[:2])
+                except AttributeError:
+                    raise VerificationError(
+                        "ffi object %r includes %r, but the latter has not "
+                        "been prepared with set_source()" % (
+                            self.ffi, ffi_to_include,))
+                if included_source is None:
+                    raise VerificationError(
+                        "not implemented yet: ffi.include() of a Python-based "
+                        "ffi inside a C-based ffi")
+                prnt('  "%s",' % (included_module_name,))
+            prnt('  NULL')
+            prnt('};')
+            prnt()
+        #
+        # the declaration of '_cffi_type_context'
+        prnt('static const struct _cffi_type_context_s _cffi_type_context = {')
+        prnt('  _cffi_types,')
+        for step_name in self.ALL_STEPS:
+            if nums[step_name] > 0:
+                prnt('  _cffi_%ss,' % step_name)
+            else:
+                prnt('  NULL,  /* no %ss */' % step_name)
+        for step_name in self.ALL_STEPS:
+            if step_name != "field":
+                prnt('  %d,  /* num_%ss */' % (nums[step_name], step_name))
+        if self.ffi._included_ffis:
+            prnt('  _cffi_includes,')
+        else:
+            prnt('  NULL,  /* no includes */')
+        prnt('  %d,  /* num_types */' % (len(self.cffi_types),))
+        flags = 0
+        if self._num_externpy > 0 or self.ffi._embedding is not None:
+            flags |= 1     # set to mean that we use extern "Python"
+        prnt('  %d,  /* flags */' % flags)
+        prnt('};')
+        prnt()
+        #
+        # the init function
+        prnt('#ifdef __GNUC__')
+        prnt('#  pragma GCC visibility push(default)  /* for -fvisibility= */')
+        prnt('#endif')
+        prnt()
+        prnt('#ifdef PYPY_VERSION')
+        prnt('PyMODINIT_FUNC')
+        prnt('_cffi_pypyinit_%s(const void *p[])' % (base_module_name,))
+        prnt('{')
+        if flags & 1:
+            prnt('    if (((intptr_t)p[0]) >= 0x0A03) {')
+            prnt('        _cffi_call_python_org = '
+                 '(void(*)(struct _cffi_externpy_s *, char *))p[1];')
+            prnt('    }')
+        prnt('    p[0] = (const void *)0x%x;' % self._version)
+        prnt('    p[1] = &_cffi_type_context;')
+        prnt('#if PY_MAJOR_VERSION >= 3')
+        prnt('    return NULL;')
+        prnt('#endif')
+        prnt('}')
+        # on Windows, distutils insists on putting init_cffi_xyz in
+        # 'export_symbols', so instead of fighting it, just give up and
+        # give it one
+        prnt('#  ifdef _MSC_VER')
+        prnt('     PyMODINIT_FUNC')
+        prnt('#  if PY_MAJOR_VERSION >= 3')
+        prnt('     PyInit_%s(void) { return NULL; }' % (base_module_name,))
+        prnt('#  else')
+        prnt('     init%s(void) { }' % (base_module_name,))
+        prnt('#  endif')
+        prnt('#  endif')
+        prnt('#elif PY_MAJOR_VERSION >= 3')
+        prnt('PyMODINIT_FUNC')
+        prnt('PyInit_%s(void)' % (base_module_name,))
+        prnt('{')
+        prnt('  return _cffi_init("%s", 0x%x, &_cffi_type_context);' % (
+            self.module_name, self._version))
+        prnt('}')
+        prnt('#else')
+        prnt('PyMODINIT_FUNC')
+        prnt('init%s(void)' % (base_module_name,))
+        prnt('{')
+        prnt('  _cffi_init("%s", 0x%x, &_cffi_type_context);' % (
+            self.module_name, self._version))
+        prnt('}')
+        prnt('#endif')
+        prnt()
+        prnt('#ifdef __GNUC__')
+        prnt('#  pragma GCC visibility pop')
+        prnt('#endif')
+        self._version = None
+
+    def _to_py(self, x):
+        if isinstance(x, str):
+            return "b'%s'" % (x,)
+        if isinstance(x, (list, tuple)):
+            rep = [self._to_py(item) for item in x]
+            if len(rep) == 1:
+                rep.append('')
+            return "(%s)" % (','.join(rep),)
+        return x.as_python_expr()  # Py2: unicode unexpected; Py3: bytes unexp.
+
+    def write_py_source_to_f(self, f):
+        self._f = f
+        prnt = self._prnt
+        #
+        # header
+        prnt("# auto-generated file")
+        prnt("import _cffi_backend")
+        #
+        # the 'import' of the included ffis
+        num_includes = len(self.ffi._included_ffis or ())
+        for i in range(num_includes):
+            ffi_to_include = self.ffi._included_ffis[i]
+            try:
+                included_module_name, included_source = (
+                    ffi_to_include._assigned_source[:2])
+            except AttributeError:
+                raise VerificationError(
+                    "ffi object %r includes %r, but the latter has not "
+                    "been prepared with set_source()" % (
+                        self.ffi, ffi_to_include,))
+            if included_source is not None:
+                raise VerificationError(
+                    "not implemented yet: ffi.include() of a C-based "
+                    "ffi inside a Python-based ffi")
+            prnt('from %s import ffi as _ffi%d' % (included_module_name, i))
+        prnt()
+        prnt("ffi = _cffi_backend.FFI('%s'," % (self.module_name,))
+        prnt("    _version = 0x%x," % (self._version,))
+        self._version = None
+        #
+        # the '_types' keyword argument
+        self.cffi_types = tuple(self.cffi_types)    # don't change any more
+        types_lst = [op.as_python_bytes() for op in self.cffi_types]
+        prnt('    _types = %s,' % (self._to_py(''.join(types_lst)),))
+        typeindex2type = dict([(i, tp) for (tp, i) in self._typesdict.items()])
+        #
+        # the keyword arguments from ALL_STEPS
+        for step_name in self.ALL_STEPS:
+            lst = self._lsts[step_name]
+            if len(lst) > 0 and step_name != "field":
+                prnt('    _%ss = %s,' % (step_name, self._to_py(lst)))
+        #
+        # the '_includes' keyword argument
+        if num_includes > 0:
+            prnt('    _includes = (%s,),' % (
+                ', '.join(['_ffi%d' % i for i in range(num_includes)]),))
+        #
+        # the footer
+        prnt(')')
+
+    # ----------
+
+    def _gettypenum(self, type):
+        # a KeyError here is a bug.  please report it! :-)
+        return self._typesdict[type]
+
+    def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode):
+        extraarg = ''
+        if isinstance(tp, model.BasePrimitiveType) and not tp.is_complex_type():
+            if tp.is_integer_type() and tp.name != '_Bool':
+                converter = '_cffi_to_c_int'
+                extraarg = ', %s' % tp.name
+            elif isinstance(tp, model.UnknownFloatType):
+                # don't check with is_float_type(): it may be a 'long
+                # double' here, and _cffi_to_c_double would loose precision
+                converter = '(%s)_cffi_to_c_double' % (tp.get_c_name(''),)
+            else:
+                cname = tp.get_c_name('')
+                converter = '(%s)_cffi_to_c_%s' % (cname,
+                                                   tp.name.replace(' ', '_'))
+                if cname in ('char16_t', 'char32_t'):
+                    self.needs_version(VERSION_CHAR16CHAR32)
+            errvalue = '-1'
+        #
+        elif isinstance(tp, model.PointerType):
+            self._convert_funcarg_to_c_ptr_or_array(tp, fromvar,
+                                                    tovar, errcode)
+            return
+        #
+        elif (isinstance(tp, model.StructOrUnionOrEnum) or
+              isinstance(tp, model.BasePrimitiveType)):
+            # a struct (not a struct pointer) as a function argument;
+            # or, a complex (the same code works)
+            self._prnt('  if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)'
+                      % (tovar, self._gettypenum(tp), fromvar))
+            self._prnt('    %s;' % errcode)
+            return
+        #
+        elif isinstance(tp, model.FunctionPtrType):
+            converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('')
+            extraarg = ', _cffi_type(%d)' % self._gettypenum(tp)
+            errvalue = 'NULL'
+        #
+        else:
+            raise NotImplementedError(tp)
+        #
+        self._prnt('  %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg))
+        self._prnt('  if (%s == (%s)%s && PyErr_Occurred())' % (
+            tovar, tp.get_c_name(''), errvalue))
+        self._prnt('    %s;' % errcode)
+
+    def _extra_local_variables(self, tp, localvars, freelines):
+        if isinstance(tp, model.PointerType):
+            localvars.add('Py_ssize_t datasize')
+            localvars.add('struct _cffi_freeme_s *large_args_free = NULL')
+            freelines.add('if (large_args_free != NULL)'
+                          ' _cffi_free_array_arguments(large_args_free);')
+
+    def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode):
+        self._prnt('  datasize = _cffi_prepare_pointer_call_argument(')
+        self._prnt('      _cffi_type(%d), %s, (char **)&%s);' % (
+            self._gettypenum(tp), fromvar, tovar))
+        self._prnt('  if (datasize != 0) {')
+        self._prnt('    %s = ((size_t)datasize) <= 640 ? '
+                   '(%s)alloca((size_t)datasize) : NULL;' % (
+            tovar, tp.get_c_name('')))
+        self._prnt('    if (_cffi_convert_array_argument(_cffi_type(%d), %s, '
+                   '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar))
+        self._prnt('            datasize, &large_args_free) < 0)')
+        self._prnt('      %s;' % errcode)
+        self._prnt('  }')
+
+    def _convert_expr_from_c(self, tp, var, context):
+        if isinstance(tp, model.BasePrimitiveType):
+            if tp.is_integer_type() and tp.name != '_Bool':
+                return '_cffi_from_c_int(%s, %s)' % (var, tp.name)
+            elif isinstance(tp, model.UnknownFloatType):
+                return '_cffi_from_c_double(%s)' % (var,)
+            elif tp.name != 'long double' and not tp.is_complex_type():
+                cname = tp.name.replace(' ', '_')
+                if cname in ('char16_t', 'char32_t'):
+                    self.needs_version(VERSION_CHAR16CHAR32)
+                return '_cffi_from_c_%s(%s)' % (cname, var)
+            else:
+                return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % (
+                    var, self._gettypenum(tp))
+        elif isinstance(tp, (model.PointerType, model.FunctionPtrType)):
+            return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        elif isinstance(tp, model.ArrayType):
+            return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
+                var, self._gettypenum(model.PointerType(tp.item)))
+        elif isinstance(tp, model.StructOrUnion):
+            if tp.fldnames is None:
+                raise TypeError("'%s' is used as %s, but is opaque" % (
+                    tp._get_c_name(), context))
+            return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        elif isinstance(tp, model.EnumType):
+            return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        else:
+            raise NotImplementedError(tp)
+
+    # ----------
+    # typedefs
+
+    def _typedef_type(self, tp, name):
+        return self._global_type(tp, "(*(%s *)0)" % (name,))
+
+    def _generate_cpy_typedef_collecttype(self, tp, name):
+        self._do_collect_type(self._typedef_type(tp, name))
+
+    def _generate_cpy_typedef_decl(self, tp, name):
+        pass
+
+    def _typedef_ctx(self, tp, name):
+        type_index = self._typesdict[tp]
+        self._lsts["typename"].append(TypenameExpr(name, type_index))
+
+    def _generate_cpy_typedef_ctx(self, tp, name):
+        tp = self._typedef_type(tp, name)
+        self._typedef_ctx(tp, name)
+        if getattr(tp, "origin", None) == "unknown_type":
+            self._struct_ctx(tp, tp.name, approxname=None)
+        elif isinstance(tp, model.NamedPointerType):
+            self._struct_ctx(tp.totype, tp.totype.name, approxname=tp.name,
+                             named_ptr=tp)
+
+    # ----------
+    # function declarations
+
+    def _generate_cpy_function_collecttype(self, tp, name):
+        self._do_collect_type(tp.as_raw_function())
+        if tp.ellipsis and not self.target_is_python:
+            self._do_collect_type(tp)
+
+    def _generate_cpy_function_decl(self, tp, name):
+        assert not self.target_is_python
+        assert isinstance(tp, model.FunctionPtrType)
+        if tp.ellipsis:
+            # cannot support vararg functions better than this: check for its
+            # exact type (including the fixed arguments), and build it as a
+            # constant function pointer (no CPython wrapper)
+            self._generate_cpy_constant_decl(tp, name)
+            return
+        prnt = self._prnt
+        numargs = len(tp.args)
+        if numargs == 0:
+            argname = 'noarg'
+        elif numargs == 1:
+            argname = 'arg0'
+        else:
+            argname = 'args'
+        #
+        # ------------------------------
+        # the 'd' version of the function, only for addressof(lib, 'func')
+        arguments = []
+        call_arguments = []
+        context = 'argument of %s' % name
+        for i, type in enumerate(tp.args):
+            arguments.append(type.get_c_name(' x%d' % i, context))
+            call_arguments.append('x%d' % i)
+        repr_arguments = ', '.join(arguments)
+        repr_arguments = repr_arguments or 'void'
+        if tp.abi:
+            abi = tp.abi + ' '
+        else:
+            abi = ''
+        name_and_arguments = '%s_cffi_d_%s(%s)' % (abi, name, repr_arguments)
+        prnt('static %s' % (tp.result.get_c_name(name_and_arguments),))
+        prnt('{')
+        call_arguments = ', '.join(call_arguments)
+        result_code = 'return '
+        if isinstance(tp.result, model.VoidType):
+            result_code = ''
+        prnt('  %s%s(%s);' % (result_code, name, call_arguments))
+        prnt('}')
+        #
+        prnt('#ifndef PYPY_VERSION')        # ------------------------------
+        #
+        prnt('static PyObject *')
+        prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname))
+        prnt('{')
+        #
+        context = 'argument of %s' % name
+        for i, type in enumerate(tp.args):
+            arg = type.get_c_name(' x%d' % i, context)
+            prnt('  %s;' % arg)
+        #
+        localvars = set()
+        freelines = set()
+        for type in tp.args:
+            self._extra_local_variables(type, localvars, freelines)
+        for decl in sorted(localvars):
+            prnt('  %s;' % (decl,))
+        #
+        if not isinstance(tp.result, model.VoidType):
+            result_code = 'result = '
+            context = 'result of %s' % name
+            result_decl = '  %s;' % tp.result.get_c_name(' result', context)
+            prnt(result_decl)
+            prnt('  PyObject *pyresult;')
+        else:
+            result_decl = None
+            result_code = ''
+        #
+        if len(tp.args) > 1:
+            rng = range(len(tp.args))
+            for i in rng:
+                prnt('  PyObject *arg%d;' % i)
+            prnt()
+            prnt('  if (!PyArg_UnpackTuple(args, "%s", %d, %d, %s))' % (
+                name, len(rng), len(rng),
+                ', '.join(['&arg%d' % i for i in rng])))
+            prnt('    return NULL;')
+        prnt()
+        #
+        for i, type in enumerate(tp.args):
+            self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i,
+                                       'return NULL')
+            prnt()
+        #
+        prnt('  Py_BEGIN_ALLOW_THREADS')
+        prnt('  _cffi_restore_errno();')
+        call_arguments = ['x%d' % i for i in range(len(tp.args))]
+        call_arguments = ', '.join(call_arguments)
+        prnt('  { %s%s(%s); }' % (result_code, name, call_arguments))
+        prnt('  _cffi_save_errno();')
+        prnt('  Py_END_ALLOW_THREADS')
+        prnt()
+        #
+        prnt('  (void)self; /* unused */')
+        if numargs == 0:
+            prnt('  (void)noarg; /* unused */')
+        if result_code:
+            prnt('  pyresult = %s;' %
+                 self._convert_expr_from_c(tp.result, 'result', 'result type'))
+            for freeline in freelines:
+                prnt('  ' + freeline)
+            prnt('  return pyresult;')
+        else:
+            for freeline in freelines:
+                prnt('  ' + freeline)
+            prnt('  Py_INCREF(Py_None);')
+            prnt('  return Py_None;')
+        prnt('}')
+        #
+        prnt('#else')        # ------------------------------
+        #
+        # the PyPy version: need to replace struct/union arguments with
+        # pointers, and if the result is a struct/union, insert a first
+        # arg that is a pointer to the result.  We also do that for
+        # complex args and return type.
+        def need_indirection(type):
+            return (isinstance(type, model.StructOrUnion) or
+                    (isinstance(type, model.PrimitiveType) and
+                     type.is_complex_type()))
+        difference = False
+        arguments = []
+        call_arguments = []
+        context = 'argument of %s' % name
+        for i, type in enumerate(tp.args):
+            indirection = ''
+            if need_indirection(type):
+                indirection = '*'
+                difference = True
+            arg = type.get_c_name(' %sx%d' % (indirection, i), context)
+            arguments.append(arg)
+            call_arguments.append('%sx%d' % (indirection, i))
+        tp_result = tp.result
+        if need_indirection(tp_result):
+            context = 'result of %s' % name
+            arg = tp_result.get_c_name(' *result', context)
+            arguments.insert(0, arg)
+            tp_result = model.void_type
+            result_decl = None
+            result_code = '*result = '
+            difference = True
+        if difference:
+            repr_arguments = ', '.join(arguments)
+            repr_arguments = repr_arguments or 'void'
+            name_and_arguments = '%s_cffi_f_%s(%s)' % (abi, name,
+                                                       repr_arguments)
+            prnt('static %s' % (tp_result.get_c_name(name_and_arguments),))
+            prnt('{')
+            if result_decl:
+                prnt(result_decl)
+            call_arguments = ', '.join(call_arguments)
+            prnt('  { %s%s(%s); }' % (result_code, name, call_arguments))
+            if result_decl:
+                prnt('  return result;')
+            prnt('}')
+        else:
+            prnt('#  define _cffi_f_%s _cffi_d_%s' % (name, name))
+        #
+        prnt('#endif')        # ------------------------------
+        prnt()
+
+    def _generate_cpy_function_ctx(self, tp, name):
+        if tp.ellipsis and not self.target_is_python:
+            self._generate_cpy_constant_ctx(tp, name)
+            return
+        type_index = self._typesdict[tp.as_raw_function()]
+        numargs = len(tp.args)
+        if self.target_is_python:
+            meth_kind = OP_DLOPEN_FUNC
+        elif numargs == 0:
+            meth_kind = OP_CPYTHON_BLTN_N   # 'METH_NOARGS'
+        elif numargs == 1:
+            meth_kind = OP_CPYTHON_BLTN_O   # 'METH_O'
+        else:
+            meth_kind = OP_CPYTHON_BLTN_V   # 'METH_VARARGS'
+        self._lsts["global"].append(
+            GlobalExpr(name, '_cffi_f_%s' % name,
+                       CffiOp(meth_kind, type_index),
+                       size='_cffi_d_%s' % name))
+
+    # ----------
+    # named structs or unions
+
+    def _field_type(self, tp_struct, field_name, tp_field):
+        if isinstance(tp_field, model.ArrayType):
+            actual_length = tp_field.length
+            if actual_length == '...':
+                ptr_struct_name = tp_struct.get_c_name('*')
+                actual_length = '_cffi_array_len(((%s)0)->%s)' % (
+                    ptr_struct_name, field_name)
+            tp_item = self._field_type(tp_struct, '%s[0]' % field_name,
+                                       tp_field.item)
+            tp_field = model.ArrayType(tp_item, actual_length)
+        return tp_field
+
+    def _struct_collecttype(self, tp):
+        self._do_collect_type(tp)
+        if self.target_is_python:
+            # also requires nested anon struct/unions in ABI mode, recursively
+            for fldtype in tp.anonymous_struct_fields():
+                self._struct_collecttype(fldtype)
+
+    def _struct_decl(self, tp, cname, approxname):
+        if tp.fldtypes is None:
+            return
+        prnt = self._prnt
+        checkfuncname = '_cffi_checkfld_%s' % (approxname,)
+        prnt('_CFFI_UNUSED_FN')
+        prnt('static void %s(%s *p)' % (checkfuncname, cname))
+        prnt('{')
+        prnt('  /* only to generate compile-time warnings or errors */')
+        prnt('  (void)p;')
+        for fname, ftype, fbitsize, fqual in self._enum_fields(tp):
+            try:
+                if ftype.is_integer_type() or fbitsize >= 0:
+                    # accept all integers, but complain on float or double
+                    if fname != '':
+                        prnt("  (void)((p->%s) | 0);  /* check that '%s.%s' is "
+                             "an integer */" % (fname, cname, fname))
+                    continue
+                # only accept exactly the type declared, except that '[]'
+                # is interpreted as a '*' and so will match any array length.
+                # (It would also match '*', but that's harder to detect...)
+                while (isinstance(ftype, model.ArrayType)
+                       and (ftype.length is None or ftype.length == '...')):
+                    ftype = ftype.item
+                    fname = fname + '[0]'
+                prnt('  { %s = &p->%s; (void)tmp; }' % (
+                    ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual),
+                    fname))
+            except VerificationError as e:
+                prnt('  /* %s */' % str(e))   # cannot verify it, ignore
+        prnt('}')
+        prnt('struct _cffi_align_%s { char x; %s y; };' % (approxname, cname))
+        prnt()
+
+    def _struct_ctx(self, tp, cname, approxname, named_ptr=None):
+        type_index = self._typesdict[tp]
+        reason_for_not_expanding = None
+        flags = []
+        if isinstance(tp, model.UnionType):
+            flags.append("_CFFI_F_UNION")
+        if tp.fldtypes is None:
+            flags.append("_CFFI_F_OPAQUE")
+            reason_for_not_expanding = "opaque"
+        if (tp not in self.ffi._parser._included_declarations and
+                (named_ptr is None or
+                 named_ptr not in self.ffi._parser._included_declarations)):
+            if tp.fldtypes is None:
+                pass    # opaque
+            elif tp.partial or any(tp.anonymous_struct_fields()):
+                pass    # field layout obtained silently from the C compiler
+            else:
+                flags.append("_CFFI_F_CHECK_FIELDS")
+            if tp.packed:
+                if tp.packed > 1:
+                    raise NotImplementedError(
+                        "%r is declared with 'pack=%r'; only 0 or 1 are "
+                        "supported in API mode (try to use \"...;\", which "
+                        "does not require a 'pack' declaration)" %
+                        (tp, tp.packed))
+                flags.append("_CFFI_F_PACKED")
+        else:
+            flags.append("_CFFI_F_EXTERNAL")
+            reason_for_not_expanding = "external"
+        flags = '|'.join(flags) or '0'
+        c_fields = []
+        if reason_for_not_expanding is None:
+            enumfields = list(self._enum_fields(tp))
+            for fldname, fldtype, fbitsize, fqual in enumfields:
+                fldtype = self._field_type(tp, fldname, fldtype)
+                self._check_not_opaque(fldtype,
+                                       "field '%s.%s'" % (tp.name, fldname))
+                # cname is None for _add_missing_struct_unions() only
+                op = OP_NOOP
+                if fbitsize >= 0:
+                    op = OP_BITFIELD
+                    size = '%d /* bits */' % fbitsize
+                elif cname is None or (
+                        isinstance(fldtype, model.ArrayType) and
+                        fldtype.length is None):
+                    size = '(size_t)-1'
+                else:
+                    size = 'sizeof(((%s)0)->%s)' % (
+                        tp.get_c_name('*') if named_ptr is None
+                                           else named_ptr.name,
+                        fldname)
+                if cname is None or fbitsize >= 0:
+                    offset = '(size_t)-1'
+                elif named_ptr is not None:
+                    offset = '((char *)&((%s)0)->%s) - (char *)0' % (
+                        named_ptr.name, fldname)
+                else:
+                    offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname)
+                c_fields.append(
+                    FieldExpr(fldname, offset, size, fbitsize,
+                              CffiOp(op, self._typesdict[fldtype])))
+            first_field_index = len(self._lsts["field"])
+            self._lsts["field"].extend(c_fields)
+            #
+            if cname is None:  # unknown name, for _add_missing_struct_unions
+                size = '(size_t)-2'
+                align = -2
+                comment = "unnamed"
+            else:
+                if named_ptr is not None:
+                    size = 'sizeof(*(%s)0)' % (named_ptr.name,)
+                    align = '-1 /* unknown alignment */'
+                else:
+                    size = 'sizeof(%s)' % (cname,)
+                    align = 'offsetof(struct _cffi_align_%s, y)' % (approxname,)
+                comment = None
+        else:
+            size = '(size_t)-1'
+            align = -1
+            first_field_index = -1
+            comment = reason_for_not_expanding
+        self._lsts["struct_union"].append(
+            StructUnionExpr(tp.name, type_index, flags, size, align, comment,
+                            first_field_index, c_fields))
+        self._seen_struct_unions.add(tp)
+
+    def _check_not_opaque(self, tp, location):
+        while isinstance(tp, model.ArrayType):
+            tp = tp.item
+        if isinstance(tp, model.StructOrUnion) and tp.fldtypes is None:
+            raise TypeError(
+                "%s is of an opaque type (not declared in cdef())" % location)
+
+    def _add_missing_struct_unions(self):
+        # not very nice, but some struct declarations might be missing
+        # because they don't have any known C name.  Check that they are
+        # not partial (we can't complete or verify them!) and emit them
+        # anonymously.
+        lst = list(self._struct_unions.items())
+        lst.sort(key=lambda tp_order: tp_order[1])
+        for tp, order in lst:
+            if tp not in self._seen_struct_unions:
+                if tp.partial:
+                    raise NotImplementedError("internal inconsistency: %r is "
+                                              "partial but was not seen at "
+                                              "this point" % (tp,))
+                if tp.name.startswith('$') and tp.name[1:].isdigit():
+                    approxname = tp.name[1:]
+                elif tp.name == '_IO_FILE' and tp.forcename == 'FILE':
+                    approxname = 'FILE'
+                    self._typedef_ctx(tp, 'FILE')
+                else:
+                    raise NotImplementedError("internal inconsistency: %r" %
+                                              (tp,))
+                self._struct_ctx(tp, None, approxname)
+
+    def _generate_cpy_struct_collecttype(self, tp, name):
+        self._struct_collecttype(tp)
+    _generate_cpy_union_collecttype = _generate_cpy_struct_collecttype
+
+    def _struct_names(self, tp):
+        cname = tp.get_c_name('')
+        if ' ' in cname:
+            return cname, cname.replace(' ', '_')
+        else:
+            return cname, '_' + cname
+
+    def _generate_cpy_struct_decl(self, tp, name):
+        self._struct_decl(tp, *self._struct_names(tp))
+    _generate_cpy_union_decl = _generate_cpy_struct_decl
+
+    def _generate_cpy_struct_ctx(self, tp, name):
+        self._struct_ctx(tp, *self._struct_names(tp))
+    _generate_cpy_union_ctx = _generate_cpy_struct_ctx
+
+    # ----------
+    # 'anonymous' declarations.  These are produced for anonymous structs
+    # or unions; the 'name' is obtained by a typedef.
+
+    def _generate_cpy_anonymous_collecttype(self, tp, name):
+        if isinstance(tp, model.EnumType):
+            self._generate_cpy_enum_collecttype(tp, name)
+        else:
+            self._struct_collecttype(tp)
+
+    def _generate_cpy_anonymous_decl(self, tp, name):
+        if isinstance(tp, model.EnumType):
+            self._generate_cpy_enum_decl(tp)
+        else:
+            self._struct_decl(tp, name, 'typedef_' + name)
+
+    def _generate_cpy_anonymous_ctx(self, tp, name):
+        if isinstance(tp, model.EnumType):
+            self._enum_ctx(tp, name)
+        else:
+            self._struct_ctx(tp, name, 'typedef_' + name)
+
+    # ----------
+    # constants, declared with "static const ..."
+
+    def _generate_cpy_const(self, is_int, name, tp=None, category='const',
+                            check_value=None):
+        if (category, name) in self._seen_constants:
+            raise VerificationError(
+                "duplicate declaration of %s '%s'" % (category, name))
+        self._seen_constants.add((category, name))
+        #
+        prnt = self._prnt
+        funcname = '_cffi_%s_%s' % (category, name)
+        if is_int:
+            prnt('static int %s(unsigned long long *o)' % funcname)
+            prnt('{')
+            prnt('  int n = (%s) <= 0;' % (name,))
+            prnt('  *o = (unsigned long long)((%s) | 0);'
+                 '  /* check that %s is an integer */' % (name, name))
+            if check_value is not None:
+                if check_value > 0:
+                    check_value = '%dU' % (check_value,)
+                prnt('  if (!_cffi_check_int(*o, n, %s))' % (check_value,))
+                prnt('    n |= 2;')
+            prnt('  return n;')
+            prnt('}')
+        else:
+            assert check_value is None
+            prnt('static void %s(char *o)' % funcname)
+            prnt('{')
+            prnt('  *(%s)o = %s;' % (tp.get_c_name('*'), name))
+            prnt('}')
+        prnt()
+
+    def _generate_cpy_constant_collecttype(self, tp, name):
+        is_int = tp.is_integer_type()
+        if not is_int or self.target_is_python:
+            self._do_collect_type(tp)
+
+    def _generate_cpy_constant_decl(self, tp, name):
+        is_int = tp.is_integer_type()
+        self._generate_cpy_const(is_int, name, tp)
+
+    def _generate_cpy_constant_ctx(self, tp, name):
+        if not self.target_is_python and tp.is_integer_type():
+            type_op = CffiOp(OP_CONSTANT_INT, -1)
+        else:
+            if self.target_is_python:
+                const_kind = OP_DLOPEN_CONST
+            else:
+                const_kind = OP_CONSTANT
+            type_index = self._typesdict[tp]
+            type_op = CffiOp(const_kind, type_index)
+        self._lsts["global"].append(
+            GlobalExpr(name, '_cffi_const_%s' % name, type_op))
+
+    # ----------
+    # enums
+
+    def _generate_cpy_enum_collecttype(self, tp, name):
+        self._do_collect_type(tp)
+
+    def _generate_cpy_enum_decl(self, tp, name=None):
+        for enumerator in tp.enumerators:
+            self._generate_cpy_const(True, enumerator)
+
+    def _enum_ctx(self, tp, cname):
+        type_index = self._typesdict[tp]
+        type_op = CffiOp(OP_ENUM, -1)
+        if self.target_is_python:
+            tp.check_not_partial()
+        for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
+            self._lsts["global"].append(
+                GlobalExpr(enumerator, '_cffi_const_%s' % enumerator, type_op,
+                           check_value=enumvalue))
+        #
+        if cname is not None and '$' not in cname and not self.target_is_python:
+            size = "sizeof(%s)" % cname
+            signed = "((%s)-1) <= 0" % cname
+        else:
+            basetp = tp.build_baseinttype(self.ffi, [])
+            size = self.ffi.sizeof(basetp)
+            signed = int(int(self.ffi.cast(basetp, -1)) < 0)
+        allenums = ",".join(tp.enumerators)
+        self._lsts["enum"].append(
+            EnumExpr(tp.name, type_index, size, signed, allenums))
+
+    def _generate_cpy_enum_ctx(self, tp, name):
+        self._enum_ctx(tp, tp._get_c_name())
+
+    # ----------
+    # macros: for now only for integers
+
+    def _generate_cpy_macro_collecttype(self, tp, name):
+        pass
+
+    def _generate_cpy_macro_decl(self, tp, name):
+        if tp == '...':
+            check_value = None
+        else:
+            check_value = tp     # an integer
+        self._generate_cpy_const(True, name, check_value=check_value)
+
+    def _generate_cpy_macro_ctx(self, tp, name):
+        if tp == '...':
+            if self.target_is_python:
+                raise VerificationError(
+                    "cannot use the syntax '...' in '#define %s ...' when "
+                    "using the ABI mode" % (name,))
+            check_value = None
+        else:
+            check_value = tp     # an integer
+        type_op = CffiOp(OP_CONSTANT_INT, -1)
+        self._lsts["global"].append(
+            GlobalExpr(name, '_cffi_const_%s' % name, type_op,
+                       check_value=check_value))
+
+    # ----------
+    # global variables
+
+    def _global_type(self, tp, global_name):
+        if isinstance(tp, model.ArrayType):
+            actual_length = tp.length
+            if actual_length == '...':
+                actual_length = '_cffi_array_len(%s)' % (global_name,)
+            tp_item = self._global_type(tp.item, '%s[0]' % global_name)
+            tp = model.ArrayType(tp_item, actual_length)
+        return tp
+
+    def _generate_cpy_variable_collecttype(self, tp, name):
+        self._do_collect_type(self._global_type(tp, name))
+
+    def _generate_cpy_variable_decl(self, tp, name):
+        prnt = self._prnt
+        tp = self._global_type(tp, name)
+        if isinstance(tp, model.ArrayType) and tp.length is None:
+            tp = tp.item
+            ampersand = ''
+        else:
+            ampersand = '&'
+        # This code assumes that casts from "tp *" to "void *" is a
+        # no-op, i.e. a function that returns a "tp *" can be called
+        # as if it returned a "void *".  This should be generally true
+        # on any modern machine.  The only exception to that rule (on
+        # uncommon architectures, and as far as I can tell) might be
+        # if 'tp' were a function type, but that is not possible here.
+        # (If 'tp' is a function _pointer_ type, then casts from "fn_t
+        # **" to "void *" are again no-ops, as far as I can tell.)
+        decl = '*_cffi_var_%s(void)' % (name,)
+        prnt('static ' + tp.get_c_name(decl, quals=self._current_quals))
+        prnt('{')
+        prnt('  return %s(%s);' % (ampersand, name))
+        prnt('}')
+        prnt()
+
+    def _generate_cpy_variable_ctx(self, tp, name):
+        tp = self._global_type(tp, name)
+        type_index = self._typesdict[tp]
+        if self.target_is_python:
+            op = OP_GLOBAL_VAR
+        else:
+            op = OP_GLOBAL_VAR_F
+        self._lsts["global"].append(
+            GlobalExpr(name, '_cffi_var_%s' % name, CffiOp(op, type_index)))
+
+    # ----------
+    # extern "Python"
+
+    def _generate_cpy_extern_python_collecttype(self, tp, name):
+        assert isinstance(tp, model.FunctionPtrType)
+        self._do_collect_type(tp)
+    _generate_cpy_dllexport_python_collecttype = \
+      _generate_cpy_extern_python_plus_c_collecttype = \
+      _generate_cpy_extern_python_collecttype
+
+    def _extern_python_decl(self, tp, name, tag_and_space):
+        prnt = self._prnt
+        if isinstance(tp.result, model.VoidType):
+            size_of_result = '0'
+        else:
+            context = 'result of %s' % name
+            size_of_result = '(int)sizeof(%s)' % (
+                tp.result.get_c_name('', context),)
+        prnt('static struct _cffi_externpy_s _cffi_externpy__%s =' % name)
+        prnt('  { "%s.%s", %s, 0, 0 };' % (
+            self.module_name, name, size_of_result))
+        prnt()
+        #
+        arguments = []
+        context = 'argument of %s' % name
+        for i, type in enumerate(tp.args):
+            arg = type.get_c_name(' a%d' % i, context)
+            arguments.append(arg)
+        #
+        repr_arguments = ', '.join(arguments)
+        repr_arguments = repr_arguments or 'void'
+        name_and_arguments = '%s(%s)' % (name, repr_arguments)
+        if tp.abi == "__stdcall":
+            name_and_arguments = '_cffi_stdcall ' + name_and_arguments
+        #
+        def may_need_128_bits(tp):
+            return (isinstance(tp, model.PrimitiveType) and
+                    tp.name == 'long double')
+        #
+        size_of_a = max(len(tp.args)*8, 8)
+        if may_need_128_bits(tp.result):
+            size_of_a = max(size_of_a, 16)
+        if isinstance(tp.result, model.StructOrUnion):
+            size_of_a = 'sizeof(%s) > %d ? sizeof(%s) : %d' % (
+                tp.result.get_c_name(''), size_of_a,
+                tp.result.get_c_name(''), size_of_a)
+        prnt('%s%s' % (tag_and_space, tp.result.get_c_name(name_and_arguments)))
+        prnt('{')
+        prnt('  char a[%s];' % size_of_a)
+        prnt('  char *p = a;')
+        for i, type in enumerate(tp.args):
+            arg = 'a%d' % i
+            if (isinstance(type, model.StructOrUnion) or
+                    may_need_128_bits(type)):
+                arg = '&' + arg
+                type = model.PointerType(type)
+            prnt('  *(%s)(p + %d) = %s;' % (type.get_c_name('*'), i*8, arg))
+        prnt('  _cffi_call_python(&_cffi_externpy__%s, p);' % name)
+        if not isinstance(tp.result, model.VoidType):
+            prnt('  return *(%s)p;' % (tp.result.get_c_name('*'),))
+        prnt('}')
+        prnt()
+        self._num_externpy += 1
+
+    def _generate_cpy_extern_python_decl(self, tp, name):
+        self._extern_python_decl(tp, name, 'static ')
+
+    def _generate_cpy_dllexport_python_decl(self, tp, name):
+        self._extern_python_decl(tp, name, 'CFFI_DLLEXPORT ')
+
+    def _generate_cpy_extern_python_plus_c_decl(self, tp, name):
+        self._extern_python_decl(tp, name, '')
+
+    def _generate_cpy_extern_python_ctx(self, tp, name):
+        if self.target_is_python:
+            raise VerificationError(
+                "cannot use 'extern \"Python\"' in the ABI mode")
+        if tp.ellipsis:
+            raise NotImplementedError("a vararg function is extern \"Python\"")
+        type_index = self._typesdict[tp]
+        type_op = CffiOp(OP_EXTERN_PYTHON, type_index)
+        self._lsts["global"].append(
+            GlobalExpr(name, '&_cffi_externpy__%s' % name, type_op, name))
+
+    _generate_cpy_dllexport_python_ctx = \
+      _generate_cpy_extern_python_plus_c_ctx = \
+      _generate_cpy_extern_python_ctx
+
+    def _print_string_literal_in_array(self, s):
+        prnt = self._prnt
+        prnt('// # NB. this is not a string because of a size limit in MSVC')
+        if not isinstance(s, bytes):    # unicode
+            s = s.encode('utf-8')       # -> bytes
+        else:
+            s.decode('utf-8')           # got bytes, check for valid utf-8
+        try:
+            s.decode('ascii')
+        except UnicodeDecodeError:
+            s = b'# -*- encoding: utf8 -*-\n' + s
+        for line in s.splitlines(True):
+            comment = line
+            if type('//') is bytes:     # python2
+                line = map(ord, line)   #     make a list of integers
+            else:                       # python3
+                # type(line) is bytes, which enumerates like a list of integers
+                comment = ascii(comment)[1:-1]
+            prnt(('// ' + comment).rstrip())
+            printed_line = ''
+            for c in line:
+                if len(printed_line) >= 76:
+                    prnt(printed_line)
+                    printed_line = ''
+                printed_line += '%d,' % (c,)
+            prnt(printed_line)
+
+    # ----------
+    # emitting the opcodes for individual types
+
+    def _emit_bytecode_VoidType(self, tp, index):
+        self.cffi_types[index] = CffiOp(OP_PRIMITIVE, PRIM_VOID)
+
+    def _emit_bytecode_PrimitiveType(self, tp, index):
+        prim_index = PRIMITIVE_TO_INDEX[tp.name]
+        self.cffi_types[index] = CffiOp(OP_PRIMITIVE, prim_index)
+
+    def _emit_bytecode_UnknownIntegerType(self, tp, index):
+        s = ('_cffi_prim_int(sizeof(%s), (\n'
+             '           ((%s)-1) | 0 /* check that %s is an integer type */\n'
+             '         ) <= 0)' % (tp.name, tp.name, tp.name))
+        self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)
+
+    def _emit_bytecode_UnknownFloatType(self, tp, index):
+        s = ('_cffi_prim_float(sizeof(%s) *\n'
+             '           (((%s)1) / 2) * 2 /* integer => 0, float => 1 */\n'
+             '         )' % (tp.name, tp.name))
+        self.cffi_types[index] = CffiOp(OP_PRIMITIVE, s)
+
+    def _emit_bytecode_RawFunctionType(self, tp, index):
+        self.cffi_types[index] = CffiOp(OP_FUNCTION, self._typesdict[tp.result])
+        index += 1
+        for tp1 in tp.args:
+            realindex = self._typesdict[tp1]
+            if index != realindex:
+                if isinstance(tp1, model.PrimitiveType):
+                    self._emit_bytecode_PrimitiveType(tp1, index)
+                else:
+                    self.cffi_types[index] = CffiOp(OP_NOOP, realindex)
+            index += 1
+        flags = int(tp.ellipsis)
+        if tp.abi is not None:
+            if tp.abi == '__stdcall':
+                flags |= 2
+            else:
+                raise NotImplementedError("abi=%r" % (tp.abi,))
+        self.cffi_types[index] = CffiOp(OP_FUNCTION_END, flags)
+
+    def _emit_bytecode_PointerType(self, tp, index):
+        self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[tp.totype])
+
+    _emit_bytecode_ConstPointerType = _emit_bytecode_PointerType
+    _emit_bytecode_NamedPointerType = _emit_bytecode_PointerType
+
+    def _emit_bytecode_FunctionPtrType(self, tp, index):
+        raw = tp.as_raw_function()
+        self.cffi_types[index] = CffiOp(OP_POINTER, self._typesdict[raw])
+
+    def _emit_bytecode_ArrayType(self, tp, index):
+        item_index = self._typesdict[tp.item]
+        if tp.length is None:
+            self.cffi_types[index] = CffiOp(OP_OPEN_ARRAY, item_index)
+        elif tp.length == '...':
+            raise VerificationError(
+                "type %s badly placed: the '...' array length can only be "
+                "used on global arrays or on fields of structures" % (
+                    str(tp).replace('/*...*/', '...'),))
+        else:
+            assert self.cffi_types[index + 1] == 'LEN'
+            self.cffi_types[index] = CffiOp(OP_ARRAY, item_index)
+            self.cffi_types[index + 1] = CffiOp(None, str(tp.length))
+
+    def _emit_bytecode_StructType(self, tp, index):
+        struct_index = self._struct_unions[tp]
+        self.cffi_types[index] = CffiOp(OP_STRUCT_UNION, struct_index)
+    _emit_bytecode_UnionType = _emit_bytecode_StructType
+
+    def _emit_bytecode_EnumType(self, tp, index):
+        enum_index = self._enums[tp]
+        self.cffi_types[index] = CffiOp(OP_ENUM, enum_index)
+
+
+if sys.version_info >= (3,):
+    NativeIO = io.StringIO
+else:
+    class NativeIO(io.BytesIO):
+        def write(self, s):
+            if isinstance(s, unicode):
+                s = s.encode('ascii')
+            super(NativeIO, self).write(s)
+
+def _make_c_or_py_source(ffi, module_name, preamble, target_file, verbose):
+    if verbose:
+        print("generating %s" % (target_file,))
+    recompiler = Recompiler(ffi, module_name,
+                            target_is_python=(preamble is None))
+    recompiler.collect_type_table()
+    recompiler.collect_step_tables()
+    f = NativeIO()
+    recompiler.write_source_to_f(f, preamble)
+    output = f.getvalue()
+    try:
+        with open(target_file, 'r') as f1:
+            if f1.read(len(output) + 1) != output:
+                raise IOError
+        if verbose:
+            print("(already up-to-date)")
+        return False     # already up-to-date
+    except IOError:
+        tmp_file = '%s.~%d' % (target_file, os.getpid())
+        with open(tmp_file, 'w') as f1:
+            f1.write(output)
+        try:
+            os.rename(tmp_file, target_file)
+        except OSError:
+            os.unlink(target_file)
+            os.rename(tmp_file, target_file)
+        return True
+
+def make_c_source(ffi, module_name, preamble, target_c_file, verbose=False):
+    assert preamble is not None
+    return _make_c_or_py_source(ffi, module_name, preamble, target_c_file,
+                                verbose)
+
+def make_py_source(ffi, module_name, target_py_file, verbose=False):
+    return _make_c_or_py_source(ffi, module_name, None, target_py_file,
+                                verbose)
+
+def _modname_to_file(outputdir, modname, extension):
+    parts = modname.split('.')
+    try:
+        os.makedirs(os.path.join(outputdir, *parts[:-1]))
+    except OSError:
+        pass
+    parts[-1] += extension
+    return os.path.join(outputdir, *parts), parts
+
+
+# Aaargh.  Distutils is not tested at all for the purpose of compiling
+# DLLs that are not extension modules.  Here are some hacks to work
+# around that, in the _patch_for_*() functions...
+
+def _patch_meth(patchlist, cls, name, new_meth):
+    old = getattr(cls, name)
+    patchlist.append((cls, name, old))
+    setattr(cls, name, new_meth)
+    return old
+
+def _unpatch_meths(patchlist):
+    for cls, name, old_meth in reversed(patchlist):
+        setattr(cls, name, old_meth)
+
+def _patch_for_embedding(patchlist):
+    if sys.platform == 'win32':
+        # we must not remove the manifest when building for embedding!
+        from cffi._shimmed_dist_utils import MSVCCompiler
+        _patch_meth(patchlist, MSVCCompiler, '_remove_visual_c_ref',
+                    lambda self, manifest_file: manifest_file)
+
+    if sys.platform == 'darwin':
+        # we must not make a '-bundle', but a '-dynamiclib' instead
+        from cffi._shimmed_dist_utils import CCompiler
+        def my_link_shared_object(self, *args, **kwds):
+            if '-bundle' in self.linker_so:
+                self.linker_so = list(self.linker_so)
+                i = self.linker_so.index('-bundle')
+                self.linker_so[i] = '-dynamiclib'
+            return old_link_shared_object(self, *args, **kwds)
+        old_link_shared_object = _patch_meth(patchlist, CCompiler,
+                                             'link_shared_object',
+                                             my_link_shared_object)
+
+def _patch_for_target(patchlist, target):
+    from cffi._shimmed_dist_utils import build_ext
+    # if 'target' is different from '*', we need to patch some internal
+    # method to just return this 'target' value, instead of having it
+    # built from module_name
+    if target.endswith('.*'):
+        target = target[:-2]
+        if sys.platform == 'win32':
+            target += '.dll'
+        elif sys.platform == 'darwin':
+            target += '.dylib'
+        else:
+            target += '.so'
+    _patch_meth(patchlist, build_ext, 'get_ext_filename',
+                lambda self, ext_name: target)
+
+
+def recompile(ffi, module_name, preamble, tmpdir='.', call_c_compiler=True,
+              c_file=None, source_extension='.c', extradir=None,
+              compiler_verbose=1, target=None, debug=None, **kwds):
+    if not isinstance(module_name, str):
+        module_name = module_name.encode('ascii')
+    if ffi._windows_unicode:
+        ffi._apply_windows_unicode(kwds)
+    if preamble is not None:
+        embedding = (ffi._embedding is not None)
+        if embedding:
+            ffi._apply_embedding_fix(kwds)
+        if c_file is None:
+            c_file, parts = _modname_to_file(tmpdir, module_name,
+                                             source_extension)
+            if extradir:
+                parts = [extradir] + parts
+            ext_c_file = os.path.join(*parts)
+        else:
+            ext_c_file = c_file
+        #
+        if target is None:
+            if embedding:
+                target = '%s.*' % module_name
+            else:
+                target = '*'
+        #
+        ext = ffiplatform.get_extension(ext_c_file, module_name, **kwds)
+        updated = make_c_source(ffi, module_name, preamble, c_file,
+                                verbose=compiler_verbose)
+        if call_c_compiler:
+            patchlist = []
+            cwd = os.getcwd()
+            try:
+                if embedding:
+                    _patch_for_embedding(patchlist)
+                if target != '*':
+                    _patch_for_target(patchlist, target)
+                if compiler_verbose:
+                    if tmpdir == '.':
+                        msg = 'the current directory is'
+                    else:
+                        msg = 'setting the current directory to'
+                    print('%s %r' % (msg, os.path.abspath(tmpdir)))
+                os.chdir(tmpdir)
+                outputfilename = ffiplatform.compile('.', ext,
+                                                     compiler_verbose, debug)
+            finally:
+                os.chdir(cwd)
+                _unpatch_meths(patchlist)
+            return outputfilename
+        else:
+            return ext, updated
+    else:
+        if c_file is None:
+            c_file, _ = _modname_to_file(tmpdir, module_name, '.py')
+        updated = make_py_source(ffi, module_name, c_file,
+                                 verbose=compiler_verbose)
+        if call_c_compiler:
+            return c_file
+        else:
+            return None, updated
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/setuptools_ext.py b/TP03/TP03/lib/python3.9/site-packages/cffi/setuptools_ext.py
new file mode 100644
index 0000000000000000000000000000000000000000..681b49d7ad964d9de4b6b32a24eec6fcebddf7ed
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/setuptools_ext.py
@@ -0,0 +1,216 @@
+import os
+import sys
+
+try:
+    basestring
+except NameError:
+    # Python 3.x
+    basestring = str
+
+def error(msg):
+    from cffi._shimmed_dist_utils import DistutilsSetupError
+    raise DistutilsSetupError(msg)
+
+
+def execfile(filename, glob):
+    # We use execfile() (here rewritten for Python 3) instead of
+    # __import__() to load the build script.  The problem with
+    # a normal import is that in some packages, the intermediate
+    # __init__.py files may already try to import the file that
+    # we are generating.
+    with open(filename) as f:
+        src = f.read()
+    src += '\n'      # Python 2.6 compatibility
+    code = compile(src, filename, 'exec')
+    exec(code, glob, glob)
+
+
+def add_cffi_module(dist, mod_spec):
+    from cffi.api import FFI
+
+    if not isinstance(mod_spec, basestring):
+        error("argument to 'cffi_modules=...' must be a str or a list of str,"
+              " not %r" % (type(mod_spec).__name__,))
+    mod_spec = str(mod_spec)
+    try:
+        build_file_name, ffi_var_name = mod_spec.split(':')
+    except ValueError:
+        error("%r must be of the form 'path/build.py:ffi_variable'" %
+              (mod_spec,))
+    if not os.path.exists(build_file_name):
+        ext = ''
+        rewritten = build_file_name.replace('.', '/') + '.py'
+        if os.path.exists(rewritten):
+            ext = ' (rewrite cffi_modules to [%r])' % (
+                rewritten + ':' + ffi_var_name,)
+        error("%r does not name an existing file%s" % (build_file_name, ext))
+
+    mod_vars = {'__name__': '__cffi__', '__file__': build_file_name}
+    execfile(build_file_name, mod_vars)
+
+    try:
+        ffi = mod_vars[ffi_var_name]
+    except KeyError:
+        error("%r: object %r not found in module" % (mod_spec,
+                                                     ffi_var_name))
+    if not isinstance(ffi, FFI):
+        ffi = ffi()      # maybe it's a function instead of directly an ffi
+    if not isinstance(ffi, FFI):
+        error("%r is not an FFI instance (got %r)" % (mod_spec,
+                                                      type(ffi).__name__))
+    if not hasattr(ffi, '_assigned_source'):
+        error("%r: the set_source() method was not called" % (mod_spec,))
+    module_name, source, source_extension, kwds = ffi._assigned_source
+    if ffi._windows_unicode:
+        kwds = kwds.copy()
+        ffi._apply_windows_unicode(kwds)
+
+    if source is None:
+        _add_py_module(dist, ffi, module_name)
+    else:
+        _add_c_module(dist, ffi, module_name, source, source_extension, kwds)
+
+def _set_py_limited_api(Extension, kwds):
+    """
+    Add py_limited_api to kwds if setuptools >= 26 is in use.
+    Do not alter the setting if it already exists.
+    Setuptools takes care of ignoring the flag on Python 2 and PyPy.
+
+    CPython itself should ignore the flag in a debugging version
+    (by not listing .abi3.so in the extensions it supports), but
+    it doesn't so far, creating troubles.  That's why we check
+    for "not hasattr(sys, 'gettotalrefcount')" (the 2.7 compatible equivalent
+    of 'd' not in sys.abiflags). (http://bugs.python.org/issue28401)
+
+    On Windows, with CPython <= 3.4, it's better not to use py_limited_api
+    because virtualenv *still* doesn't copy PYTHON3.DLL on these versions.
+    Recently (2020) we started shipping only >= 3.5 wheels, though.  So
+    we'll give it another try and set py_limited_api on Windows >= 3.5.
+    """
+    from cffi import recompiler
+
+    if ('py_limited_api' not in kwds and not hasattr(sys, 'gettotalrefcount')
+            and recompiler.USE_LIMITED_API):
+        import setuptools
+        try:
+            setuptools_major_version = int(setuptools.__version__.partition('.')[0])
+            if setuptools_major_version >= 26:
+                kwds['py_limited_api'] = True
+        except ValueError:  # certain development versions of setuptools
+            # If we don't know the version number of setuptools, we
+            # try to set 'py_limited_api' anyway.  At worst, we get a
+            # warning.
+            kwds['py_limited_api'] = True
+    return kwds
+
+def _add_c_module(dist, ffi, module_name, source, source_extension, kwds):
+    # We are a setuptools extension. Need this build_ext for py_limited_api.
+    from setuptools.command.build_ext import build_ext
+    from cffi._shimmed_dist_utils import Extension, log, mkpath
+    from cffi import recompiler
+
+    allsources = ['$PLACEHOLDER']
+    allsources.extend(kwds.pop('sources', []))
+    kwds = _set_py_limited_api(Extension, kwds)
+    ext = Extension(name=module_name, sources=allsources, **kwds)
+
+    def make_mod(tmpdir, pre_run=None):
+        c_file = os.path.join(tmpdir, module_name + source_extension)
+        log.info("generating cffi module %r" % c_file)
+        mkpath(tmpdir)
+        # a setuptools-only, API-only hook: called with the "ext" and "ffi"
+        # arguments just before we turn the ffi into C code.  To use it,
+        # subclass the 'distutils.command.build_ext.build_ext' class and
+        # add a method 'def pre_run(self, ext, ffi)'.
+        if pre_run is not None:
+            pre_run(ext, ffi)
+        updated = recompiler.make_c_source(ffi, module_name, source, c_file)
+        if not updated:
+            log.info("already up-to-date")
+        return c_file
+
+    if dist.ext_modules is None:
+        dist.ext_modules = []
+    dist.ext_modules.append(ext)
+
+    base_class = dist.cmdclass.get('build_ext', build_ext)
+    class build_ext_make_mod(base_class):
+        def run(self):
+            if ext.sources[0] == '$PLACEHOLDER':
+                pre_run = getattr(self, 'pre_run', None)
+                ext.sources[0] = make_mod(self.build_temp, pre_run)
+            base_class.run(self)
+    dist.cmdclass['build_ext'] = build_ext_make_mod
+    # NB. multiple runs here will create multiple 'build_ext_make_mod'
+    # classes.  Even in this case the 'build_ext' command should be
+    # run once; but just in case, the logic above does nothing if
+    # called again.
+
+
+def _add_py_module(dist, ffi, module_name):
+    from setuptools.command.build_py import build_py
+    from setuptools.command.build_ext import build_ext
+    from cffi._shimmed_dist_utils import log, mkpath
+    from cffi import recompiler
+
+    def generate_mod(py_file):
+        log.info("generating cffi module %r" % py_file)
+        mkpath(os.path.dirname(py_file))
+        updated = recompiler.make_py_source(ffi, module_name, py_file)
+        if not updated:
+            log.info("already up-to-date")
+
+    base_class = dist.cmdclass.get('build_py', build_py)
+    class build_py_make_mod(base_class):
+        def run(self):
+            base_class.run(self)
+            module_path = module_name.split('.')
+            module_path[-1] += '.py'
+            generate_mod(os.path.join(self.build_lib, *module_path))
+        def get_source_files(self):
+            # This is called from 'setup.py sdist' only.  Exclude
+            # the generate .py module in this case.
+            saved_py_modules = self.py_modules
+            try:
+                if saved_py_modules:
+                    self.py_modules = [m for m in saved_py_modules
+                                         if m != module_name]
+                return base_class.get_source_files(self)
+            finally:
+                self.py_modules = saved_py_modules
+    dist.cmdclass['build_py'] = build_py_make_mod
+
+    # distutils and setuptools have no notion I could find of a
+    # generated python module.  If we don't add module_name to
+    # dist.py_modules, then things mostly work but there are some
+    # combination of options (--root and --record) that will miss
+    # the module.  So we add it here, which gives a few apparently
+    # harmless warnings about not finding the file outside the
+    # build directory.
+    # Then we need to hack more in get_source_files(); see above.
+    if dist.py_modules is None:
+        dist.py_modules = []
+    dist.py_modules.append(module_name)
+
+    # the following is only for "build_ext -i"
+    base_class_2 = dist.cmdclass.get('build_ext', build_ext)
+    class build_ext_make_mod(base_class_2):
+        def run(self):
+            base_class_2.run(self)
+            if self.inplace:
+                # from get_ext_fullpath() in distutils/command/build_ext.py
+                module_path = module_name.split('.')
+                package = '.'.join(module_path[:-1])
+                build_py = self.get_finalized_command('build_py')
+                package_dir = build_py.get_package_dir(package)
+                file_name = module_path[-1] + '.py'
+                generate_mod(os.path.join(package_dir, file_name))
+    dist.cmdclass['build_ext'] = build_ext_make_mod
+
+def cffi_modules(dist, attr, value):
+    assert attr == 'cffi_modules'
+    if isinstance(value, basestring):
+        value = [value]
+
+    for cffi_module in value:
+        add_cffi_module(dist, cffi_module)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_cpy.py b/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_cpy.py
new file mode 100644
index 0000000000000000000000000000000000000000..49727d36e57b7743536a6b1e7f40efd06d4c4d47
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_cpy.py
@@ -0,0 +1,1077 @@
+#
+# DEPRECATED: implementation for ffi.verify()
+#
+import sys
+from . import model
+from .error import VerificationError
+from . import _imp_emulation as imp
+
+
+class VCPythonEngine(object):
+    _class_key = 'x'
+    _gen_python_module = True
+
+    def __init__(self, verifier):
+        self.verifier = verifier
+        self.ffi = verifier.ffi
+        self._struct_pending_verification = {}
+        self._types_of_builtin_functions = {}
+
+    def patch_extension_kwds(self, kwds):
+        pass
+
+    def find_module(self, module_name, path, so_suffixes):
+        try:
+            f, filename, descr = imp.find_module(module_name, path)
+        except ImportError:
+            return None
+        if f is not None:
+            f.close()
+        # Note that after a setuptools installation, there are both .py
+        # and .so files with the same basename.  The code here relies on
+        # imp.find_module() locating the .so in priority.
+        if descr[0] not in so_suffixes:
+            return None
+        return filename
+
+    def collect_types(self):
+        self._typesdict = {}
+        self._generate("collecttype")
+
+    def _prnt(self, what=''):
+        self._f.write(what + '\n')
+
+    def _gettypenum(self, type):
+        # a KeyError here is a bug.  please report it! :-)
+        return self._typesdict[type]
+
+    def _do_collect_type(self, tp):
+        if ((not isinstance(tp, model.PrimitiveType)
+             or tp.name == 'long double')
+                and tp not in self._typesdict):
+            num = len(self._typesdict)
+            self._typesdict[tp] = num
+
+    def write_source_to_f(self):
+        self.collect_types()
+        #
+        # The new module will have a _cffi_setup() function that receives
+        # objects from the ffi world, and that calls some setup code in
+        # the module.  This setup code is split in several independent
+        # functions, e.g. one per constant.  The functions are "chained"
+        # by ending in a tail call to each other.
+        #
+        # This is further split in two chained lists, depending on if we
+        # can do it at import-time or if we must wait for _cffi_setup() to
+        # provide us with the <ctype> objects.  This is needed because we
+        # need the values of the enum constants in order to build the
+        # <ctype 'enum'> that we may have to pass to _cffi_setup().
+        #
+        # The following two 'chained_list_constants' items contains
+        # the head of these two chained lists, as a string that gives the
+        # call to do, if any.
+        self._chained_list_constants = ['((void)lib,0)', '((void)lib,0)']
+        #
+        prnt = self._prnt
+        # first paste some standard set of lines that are mostly '#define'
+        prnt(cffimod_header)
+        prnt()
+        # then paste the C source given by the user, verbatim.
+        prnt(self.verifier.preamble)
+        prnt()
+        #
+        # call generate_cpy_xxx_decl(), for every xxx found from
+        # ffi._parser._declarations.  This generates all the functions.
+        self._generate("decl")
+        #
+        # implement the function _cffi_setup_custom() as calling the
+        # head of the chained list.
+        self._generate_setup_custom()
+        prnt()
+        #
+        # produce the method table, including the entries for the
+        # generated Python->C function wrappers, which are done
+        # by generate_cpy_function_method().
+        prnt('static PyMethodDef _cffi_methods[] = {')
+        self._generate("method")
+        prnt('  {"_cffi_setup", _cffi_setup, METH_VARARGS, NULL},')
+        prnt('  {NULL, NULL, 0, NULL}    /* Sentinel */')
+        prnt('};')
+        prnt()
+        #
+        # standard init.
+        modname = self.verifier.get_module_name()
+        constants = self._chained_list_constants[False]
+        prnt('#if PY_MAJOR_VERSION >= 3')
+        prnt()
+        prnt('static struct PyModuleDef _cffi_module_def = {')
+        prnt('  PyModuleDef_HEAD_INIT,')
+        prnt('  "%s",' % modname)
+        prnt('  NULL,')
+        prnt('  -1,')
+        prnt('  _cffi_methods,')
+        prnt('  NULL, NULL, NULL, NULL')
+        prnt('};')
+        prnt()
+        prnt('PyMODINIT_FUNC')
+        prnt('PyInit_%s(void)' % modname)
+        prnt('{')
+        prnt('  PyObject *lib;')
+        prnt('  lib = PyModule_Create(&_cffi_module_def);')
+        prnt('  if (lib == NULL)')
+        prnt('    return NULL;')
+        prnt('  if (%s < 0 || _cffi_init() < 0) {' % (constants,))
+        prnt('    Py_DECREF(lib);')
+        prnt('    return NULL;')
+        prnt('  }')
+        prnt('  return lib;')
+        prnt('}')
+        prnt()
+        prnt('#else')
+        prnt()
+        prnt('PyMODINIT_FUNC')
+        prnt('init%s(void)' % modname)
+        prnt('{')
+        prnt('  PyObject *lib;')
+        prnt('  lib = Py_InitModule("%s", _cffi_methods);' % modname)
+        prnt('  if (lib == NULL)')
+        prnt('    return;')
+        prnt('  if (%s < 0 || _cffi_init() < 0)' % (constants,))
+        prnt('    return;')
+        prnt('  return;')
+        prnt('}')
+        prnt()
+        prnt('#endif')
+
+    def load_library(self, flags=None):
+        # XXX review all usages of 'self' here!
+        # import it as a new extension module
+        imp.acquire_lock()
+        try:
+            if hasattr(sys, "getdlopenflags"):
+                previous_flags = sys.getdlopenflags()
+            try:
+                if hasattr(sys, "setdlopenflags") and flags is not None:
+                    sys.setdlopenflags(flags)
+                module = imp.load_dynamic(self.verifier.get_module_name(),
+                                          self.verifier.modulefilename)
+            except ImportError as e:
+                error = "importing %r: %s" % (self.verifier.modulefilename, e)
+                raise VerificationError(error)
+            finally:
+                if hasattr(sys, "setdlopenflags"):
+                    sys.setdlopenflags(previous_flags)
+        finally:
+            imp.release_lock()
+        #
+        # call loading_cpy_struct() to get the struct layout inferred by
+        # the C compiler
+        self._load(module, 'loading')
+        #
+        # the C code will need the <ctype> objects.  Collect them in
+        # order in a list.
+        revmapping = dict([(value, key)
+                           for (key, value) in self._typesdict.items()])
+        lst = [revmapping[i] for i in range(len(revmapping))]
+        lst = list(map(self.ffi._get_cached_btype, lst))
+        #
+        # build the FFILibrary class and instance and call _cffi_setup().
+        # this will set up some fields like '_cffi_types', and only then
+        # it will invoke the chained list of functions that will really
+        # build (notably) the constant objects, as <cdata> if they are
+        # pointers, and store them as attributes on the 'library' object.
+        class FFILibrary(object):
+            _cffi_python_module = module
+            _cffi_ffi = self.ffi
+            _cffi_dir = []
+            def __dir__(self):
+                return FFILibrary._cffi_dir + list(self.__dict__)
+        library = FFILibrary()
+        if module._cffi_setup(lst, VerificationError, library):
+            import warnings
+            warnings.warn("reimporting %r might overwrite older definitions"
+                          % (self.verifier.get_module_name()))
+        #
+        # finally, call the loaded_cpy_xxx() functions.  This will perform
+        # the final adjustments, like copying the Python->C wrapper
+        # functions from the module to the 'library' object, and setting
+        # up the FFILibrary class with properties for the global C variables.
+        self._load(module, 'loaded', library=library)
+        module._cffi_original_ffi = self.ffi
+        module._cffi_types_of_builtin_funcs = self._types_of_builtin_functions
+        return library
+
+    def _get_declarations(self):
+        lst = [(key, tp) for (key, (tp, qual)) in
+                                self.ffi._parser._declarations.items()]
+        lst.sort()
+        return lst
+
+    def _generate(self, step_name):
+        for name, tp in self._get_declarations():
+            kind, realname = name.split(' ', 1)
+            try:
+                method = getattr(self, '_generate_cpy_%s_%s' % (kind,
+                                                                step_name))
+            except AttributeError:
+                raise VerificationError(
+                    "not implemented in verify(): %r" % name)
+            try:
+                method(tp, realname)
+            except Exception as e:
+                model.attach_exception_info(e, name)
+                raise
+
+    def _load(self, module, step_name, **kwds):
+        for name, tp in self._get_declarations():
+            kind, realname = name.split(' ', 1)
+            method = getattr(self, '_%s_cpy_%s' % (step_name, kind))
+            try:
+                method(tp, realname, module, **kwds)
+            except Exception as e:
+                model.attach_exception_info(e, name)
+                raise
+
+    def _generate_nothing(self, tp, name):
+        pass
+
+    def _loaded_noop(self, tp, name, module, **kwds):
+        pass
+
+    # ----------
+
+    def _convert_funcarg_to_c(self, tp, fromvar, tovar, errcode):
+        extraarg = ''
+        if isinstance(tp, model.PrimitiveType):
+            if tp.is_integer_type() and tp.name != '_Bool':
+                converter = '_cffi_to_c_int'
+                extraarg = ', %s' % tp.name
+            else:
+                converter = '(%s)_cffi_to_c_%s' % (tp.get_c_name(''),
+                                                   tp.name.replace(' ', '_'))
+            errvalue = '-1'
+        #
+        elif isinstance(tp, model.PointerType):
+            self._convert_funcarg_to_c_ptr_or_array(tp, fromvar,
+                                                    tovar, errcode)
+            return
+        #
+        elif isinstance(tp, (model.StructOrUnion, model.EnumType)):
+            # a struct (not a struct pointer) as a function argument
+            self._prnt('  if (_cffi_to_c((char *)&%s, _cffi_type(%d), %s) < 0)'
+                      % (tovar, self._gettypenum(tp), fromvar))
+            self._prnt('    %s;' % errcode)
+            return
+        #
+        elif isinstance(tp, model.FunctionPtrType):
+            converter = '(%s)_cffi_to_c_pointer' % tp.get_c_name('')
+            extraarg = ', _cffi_type(%d)' % self._gettypenum(tp)
+            errvalue = 'NULL'
+        #
+        else:
+            raise NotImplementedError(tp)
+        #
+        self._prnt('  %s = %s(%s%s);' % (tovar, converter, fromvar, extraarg))
+        self._prnt('  if (%s == (%s)%s && PyErr_Occurred())' % (
+            tovar, tp.get_c_name(''), errvalue))
+        self._prnt('    %s;' % errcode)
+
+    def _extra_local_variables(self, tp, localvars, freelines):
+        if isinstance(tp, model.PointerType):
+            localvars.add('Py_ssize_t datasize')
+            localvars.add('struct _cffi_freeme_s *large_args_free = NULL')
+            freelines.add('if (large_args_free != NULL)'
+                          ' _cffi_free_array_arguments(large_args_free);')
+
+    def _convert_funcarg_to_c_ptr_or_array(self, tp, fromvar, tovar, errcode):
+        self._prnt('  datasize = _cffi_prepare_pointer_call_argument(')
+        self._prnt('      _cffi_type(%d), %s, (char **)&%s);' % (
+            self._gettypenum(tp), fromvar, tovar))
+        self._prnt('  if (datasize != 0) {')
+        self._prnt('    %s = ((size_t)datasize) <= 640 ? '
+                   'alloca((size_t)datasize) : NULL;' % (tovar,))
+        self._prnt('    if (_cffi_convert_array_argument(_cffi_type(%d), %s, '
+                   '(char **)&%s,' % (self._gettypenum(tp), fromvar, tovar))
+        self._prnt('            datasize, &large_args_free) < 0)')
+        self._prnt('      %s;' % errcode)
+        self._prnt('  }')
+
+    def _convert_expr_from_c(self, tp, var, context):
+        if isinstance(tp, model.PrimitiveType):
+            if tp.is_integer_type() and tp.name != '_Bool':
+                return '_cffi_from_c_int(%s, %s)' % (var, tp.name)
+            elif tp.name != 'long double':
+                return '_cffi_from_c_%s(%s)' % (tp.name.replace(' ', '_'), var)
+            else:
+                return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % (
+                    var, self._gettypenum(tp))
+        elif isinstance(tp, (model.PointerType, model.FunctionPtrType)):
+            return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        elif isinstance(tp, model.ArrayType):
+            return '_cffi_from_c_pointer((char *)%s, _cffi_type(%d))' % (
+                var, self._gettypenum(model.PointerType(tp.item)))
+        elif isinstance(tp, model.StructOrUnion):
+            if tp.fldnames is None:
+                raise TypeError("'%s' is used as %s, but is opaque" % (
+                    tp._get_c_name(), context))
+            return '_cffi_from_c_struct((char *)&%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        elif isinstance(tp, model.EnumType):
+            return '_cffi_from_c_deref((char *)&%s, _cffi_type(%d))' % (
+                var, self._gettypenum(tp))
+        else:
+            raise NotImplementedError(tp)
+
+    # ----------
+    # typedefs: generates no code so far
+
+    _generate_cpy_typedef_collecttype = _generate_nothing
+    _generate_cpy_typedef_decl   = _generate_nothing
+    _generate_cpy_typedef_method = _generate_nothing
+    _loading_cpy_typedef         = _loaded_noop
+    _loaded_cpy_typedef          = _loaded_noop
+
+    # ----------
+    # function declarations
+
+    def _generate_cpy_function_collecttype(self, tp, name):
+        assert isinstance(tp, model.FunctionPtrType)
+        if tp.ellipsis:
+            self._do_collect_type(tp)
+        else:
+            # don't call _do_collect_type(tp) in this common case,
+            # otherwise test_autofilled_struct_as_argument fails
+            for type in tp.args:
+                self._do_collect_type(type)
+            self._do_collect_type(tp.result)
+
+    def _generate_cpy_function_decl(self, tp, name):
+        assert isinstance(tp, model.FunctionPtrType)
+        if tp.ellipsis:
+            # cannot support vararg functions better than this: check for its
+            # exact type (including the fixed arguments), and build it as a
+            # constant function pointer (no CPython wrapper)
+            self._generate_cpy_const(False, name, tp)
+            return
+        prnt = self._prnt
+        numargs = len(tp.args)
+        if numargs == 0:
+            argname = 'noarg'
+        elif numargs == 1:
+            argname = 'arg0'
+        else:
+            argname = 'args'
+        prnt('static PyObject *')
+        prnt('_cffi_f_%s(PyObject *self, PyObject *%s)' % (name, argname))
+        prnt('{')
+        #
+        context = 'argument of %s' % name
+        for i, type in enumerate(tp.args):
+            prnt('  %s;' % type.get_c_name(' x%d' % i, context))
+        #
+        localvars = set()
+        freelines = set()
+        for type in tp.args:
+            self._extra_local_variables(type, localvars, freelines)
+        for decl in sorted(localvars):
+            prnt('  %s;' % (decl,))
+        #
+        if not isinstance(tp.result, model.VoidType):
+            result_code = 'result = '
+            context = 'result of %s' % name
+            prnt('  %s;' % tp.result.get_c_name(' result', context))
+            prnt('  PyObject *pyresult;')
+        else:
+            result_code = ''
+        #
+        if len(tp.args) > 1:
+            rng = range(len(tp.args))
+            for i in rng:
+                prnt('  PyObject *arg%d;' % i)
+            prnt()
+            prnt('  if (!PyArg_ParseTuple(args, "%s:%s", %s))' % (
+                'O' * numargs, name, ', '.join(['&arg%d' % i for i in rng])))
+            prnt('    return NULL;')
+        prnt()
+        #
+        for i, type in enumerate(tp.args):
+            self._convert_funcarg_to_c(type, 'arg%d' % i, 'x%d' % i,
+                                       'return NULL')
+            prnt()
+        #
+        prnt('  Py_BEGIN_ALLOW_THREADS')
+        prnt('  _cffi_restore_errno();')
+        prnt('  { %s%s(%s); }' % (
+            result_code, name,
+            ', '.join(['x%d' % i for i in range(len(tp.args))])))
+        prnt('  _cffi_save_errno();')
+        prnt('  Py_END_ALLOW_THREADS')
+        prnt()
+        #
+        prnt('  (void)self; /* unused */')
+        if numargs == 0:
+            prnt('  (void)noarg; /* unused */')
+        if result_code:
+            prnt('  pyresult = %s;' %
+                 self._convert_expr_from_c(tp.result, 'result', 'result type'))
+            for freeline in freelines:
+                prnt('  ' + freeline)
+            prnt('  return pyresult;')
+        else:
+            for freeline in freelines:
+                prnt('  ' + freeline)
+            prnt('  Py_INCREF(Py_None);')
+            prnt('  return Py_None;')
+        prnt('}')
+        prnt()
+
+    def _generate_cpy_function_method(self, tp, name):
+        if tp.ellipsis:
+            return
+        numargs = len(tp.args)
+        if numargs == 0:
+            meth = 'METH_NOARGS'
+        elif numargs == 1:
+            meth = 'METH_O'
+        else:
+            meth = 'METH_VARARGS'
+        self._prnt('  {"%s", _cffi_f_%s, %s, NULL},' % (name, name, meth))
+
+    _loading_cpy_function = _loaded_noop
+
+    def _loaded_cpy_function(self, tp, name, module, library):
+        if tp.ellipsis:
+            return
+        func = getattr(module, name)
+        setattr(library, name, func)
+        self._types_of_builtin_functions[func] = tp
+
+    # ----------
+    # named structs
+
+    _generate_cpy_struct_collecttype = _generate_nothing
+    def _generate_cpy_struct_decl(self, tp, name):
+        assert name == tp.name
+        self._generate_struct_or_union_decl(tp, 'struct', name)
+    def _generate_cpy_struct_method(self, tp, name):
+        self._generate_struct_or_union_method(tp, 'struct', name)
+    def _loading_cpy_struct(self, tp, name, module):
+        self._loading_struct_or_union(tp, 'struct', name, module)
+    def _loaded_cpy_struct(self, tp, name, module, **kwds):
+        self._loaded_struct_or_union(tp)
+
+    _generate_cpy_union_collecttype = _generate_nothing
+    def _generate_cpy_union_decl(self, tp, name):
+        assert name == tp.name
+        self._generate_struct_or_union_decl(tp, 'union', name)
+    def _generate_cpy_union_method(self, tp, name):
+        self._generate_struct_or_union_method(tp, 'union', name)
+    def _loading_cpy_union(self, tp, name, module):
+        self._loading_struct_or_union(tp, 'union', name, module)
+    def _loaded_cpy_union(self, tp, name, module, **kwds):
+        self._loaded_struct_or_union(tp)
+
+    def _generate_struct_or_union_decl(self, tp, prefix, name):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        checkfuncname = '_cffi_check_%s_%s' % (prefix, name)
+        layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
+        cname = ('%s %s' % (prefix, name)).strip()
+        #
+        prnt = self._prnt
+        prnt('static void %s(%s *p)' % (checkfuncname, cname))
+        prnt('{')
+        prnt('  /* only to generate compile-time warnings or errors */')
+        prnt('  (void)p;')
+        for fname, ftype, fbitsize, fqual in tp.enumfields():
+            if (isinstance(ftype, model.PrimitiveType)
+                and ftype.is_integer_type()) or fbitsize >= 0:
+                # accept all integers, but complain on float or double
+                prnt('  (void)((p->%s) << 1);' % fname)
+            else:
+                # only accept exactly the type declared.
+                try:
+                    prnt('  { %s = &p->%s; (void)tmp; }' % (
+                        ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual),
+                        fname))
+                except VerificationError as e:
+                    prnt('  /* %s */' % str(e))   # cannot verify it, ignore
+        prnt('}')
+        prnt('static PyObject *')
+        prnt('%s(PyObject *self, PyObject *noarg)' % (layoutfuncname,))
+        prnt('{')
+        prnt('  struct _cffi_aligncheck { char x; %s y; };' % cname)
+        prnt('  static Py_ssize_t nums[] = {')
+        prnt('    sizeof(%s),' % cname)
+        prnt('    offsetof(struct _cffi_aligncheck, y),')
+        for fname, ftype, fbitsize, fqual in tp.enumfields():
+            if fbitsize >= 0:
+                continue      # xxx ignore fbitsize for now
+            prnt('    offsetof(%s, %s),' % (cname, fname))
+            if isinstance(ftype, model.ArrayType) and ftype.length is None:
+                prnt('    0,  /* %s */' % ftype._get_c_name())
+            else:
+                prnt('    sizeof(((%s *)0)->%s),' % (cname, fname))
+        prnt('    -1')
+        prnt('  };')
+        prnt('  (void)self; /* unused */')
+        prnt('  (void)noarg; /* unused */')
+        prnt('  return _cffi_get_struct_layout(nums);')
+        prnt('  /* the next line is not executed, but compiled */')
+        prnt('  %s(0);' % (checkfuncname,))
+        prnt('}')
+        prnt()
+
+    def _generate_struct_or_union_method(self, tp, prefix, name):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
+        self._prnt('  {"%s", %s, METH_NOARGS, NULL},' % (layoutfuncname,
+                                                         layoutfuncname))
+
+    def _loading_struct_or_union(self, tp, prefix, name, module):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
+        #
+        function = getattr(module, layoutfuncname)
+        layout = function()
+        if isinstance(tp, model.StructOrUnion) and tp.partial:
+            # use the function()'s sizes and offsets to guide the
+            # layout of the struct
+            totalsize = layout[0]
+            totalalignment = layout[1]
+            fieldofs = layout[2::2]
+            fieldsize = layout[3::2]
+            tp.force_flatten()
+            assert len(fieldofs) == len(fieldsize) == len(tp.fldnames)
+            tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment
+        else:
+            cname = ('%s %s' % (prefix, name)).strip()
+            self._struct_pending_verification[tp] = layout, cname
+
+    def _loaded_struct_or_union(self, tp):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        self.ffi._get_cached_btype(tp)   # force 'fixedlayout' to be considered
+
+        if tp in self._struct_pending_verification:
+            # check that the layout sizes and offsets match the real ones
+            def check(realvalue, expectedvalue, msg):
+                if realvalue != expectedvalue:
+                    raise VerificationError(
+                        "%s (we have %d, but C compiler says %d)"
+                        % (msg, expectedvalue, realvalue))
+            ffi = self.ffi
+            BStruct = ffi._get_cached_btype(tp)
+            layout, cname = self._struct_pending_verification.pop(tp)
+            check(layout[0], ffi.sizeof(BStruct), "wrong total size")
+            check(layout[1], ffi.alignof(BStruct), "wrong total alignment")
+            i = 2
+            for fname, ftype, fbitsize, fqual in tp.enumfields():
+                if fbitsize >= 0:
+                    continue        # xxx ignore fbitsize for now
+                check(layout[i], ffi.offsetof(BStruct, fname),
+                      "wrong offset for field %r" % (fname,))
+                if layout[i+1] != 0:
+                    BField = ffi._get_cached_btype(ftype)
+                    check(layout[i+1], ffi.sizeof(BField),
+                          "wrong size for field %r" % (fname,))
+                i += 2
+            assert i == len(layout)
+
+    # ----------
+    # 'anonymous' declarations.  These are produced for anonymous structs
+    # or unions; the 'name' is obtained by a typedef.
+
+    _generate_cpy_anonymous_collecttype = _generate_nothing
+
+    def _generate_cpy_anonymous_decl(self, tp, name):
+        if isinstance(tp, model.EnumType):
+            self._generate_cpy_enum_decl(tp, name, '')
+        else:
+            self._generate_struct_or_union_decl(tp, '', name)
+
+    def _generate_cpy_anonymous_method(self, tp, name):
+        if not isinstance(tp, model.EnumType):
+            self._generate_struct_or_union_method(tp, '', name)
+
+    def _loading_cpy_anonymous(self, tp, name, module):
+        if isinstance(tp, model.EnumType):
+            self._loading_cpy_enum(tp, name, module)
+        else:
+            self._loading_struct_or_union(tp, '', name, module)
+
+    def _loaded_cpy_anonymous(self, tp, name, module, **kwds):
+        if isinstance(tp, model.EnumType):
+            self._loaded_cpy_enum(tp, name, module, **kwds)
+        else:
+            self._loaded_struct_or_union(tp)
+
+    # ----------
+    # constants, likely declared with '#define'
+
+    def _generate_cpy_const(self, is_int, name, tp=None, category='const',
+                            vartp=None, delayed=True, size_too=False,
+                            check_value=None):
+        prnt = self._prnt
+        funcname = '_cffi_%s_%s' % (category, name)
+        prnt('static int %s(PyObject *lib)' % funcname)
+        prnt('{')
+        prnt('  PyObject *o;')
+        prnt('  int res;')
+        if not is_int:
+            prnt('  %s;' % (vartp or tp).get_c_name(' i', name))
+        else:
+            assert category == 'const'
+        #
+        if check_value is not None:
+            self._check_int_constant_value(name, check_value)
+        #
+        if not is_int:
+            if category == 'var':
+                realexpr = '&' + name
+            else:
+                realexpr = name
+            prnt('  i = (%s);' % (realexpr,))
+            prnt('  o = %s;' % (self._convert_expr_from_c(tp, 'i',
+                                                          'variable type'),))
+            assert delayed
+        else:
+            prnt('  o = _cffi_from_c_int_const(%s);' % name)
+        prnt('  if (o == NULL)')
+        prnt('    return -1;')
+        if size_too:
+            prnt('  {')
+            prnt('    PyObject *o1 = o;')
+            prnt('    o = Py_BuildValue("On", o1, (Py_ssize_t)sizeof(%s));'
+                 % (name,))
+            prnt('    Py_DECREF(o1);')
+            prnt('    if (o == NULL)')
+            prnt('      return -1;')
+            prnt('  }')
+        prnt('  res = PyObject_SetAttrString(lib, "%s", o);' % name)
+        prnt('  Py_DECREF(o);')
+        prnt('  if (res < 0)')
+        prnt('    return -1;')
+        prnt('  return %s;' % self._chained_list_constants[delayed])
+        self._chained_list_constants[delayed] = funcname + '(lib)'
+        prnt('}')
+        prnt()
+
+    def _generate_cpy_constant_collecttype(self, tp, name):
+        is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type()
+        if not is_int:
+            self._do_collect_type(tp)
+
+    def _generate_cpy_constant_decl(self, tp, name):
+        is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type()
+        self._generate_cpy_const(is_int, name, tp)
+
+    _generate_cpy_constant_method = _generate_nothing
+    _loading_cpy_constant = _loaded_noop
+    _loaded_cpy_constant  = _loaded_noop
+
+    # ----------
+    # enums
+
+    def _check_int_constant_value(self, name, value, err_prefix=''):
+        prnt = self._prnt
+        if value <= 0:
+            prnt('  if ((%s) > 0 || (long)(%s) != %dL) {' % (
+                name, name, value))
+        else:
+            prnt('  if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % (
+                name, name, value))
+        prnt('    char buf[64];')
+        prnt('    if ((%s) <= 0)' % name)
+        prnt('        snprintf(buf, 63, "%%ld", (long)(%s));' % name)
+        prnt('    else')
+        prnt('        snprintf(buf, 63, "%%lu", (unsigned long)(%s));' %
+             name)
+        prnt('    PyErr_Format(_cffi_VerificationError,')
+        prnt('                 "%s%s has the real value %s, not %s",')
+        prnt('                 "%s", "%s", buf, "%d");' % (
+            err_prefix, name, value))
+        prnt('    return -1;')
+        prnt('  }')
+
+    def _enum_funcname(self, prefix, name):
+        # "$enum_$1" => "___D_enum____D_1"
+        name = name.replace('$', '___D_')
+        return '_cffi_e_%s_%s' % (prefix, name)
+
+    def _generate_cpy_enum_decl(self, tp, name, prefix='enum'):
+        if tp.partial:
+            for enumerator in tp.enumerators:
+                self._generate_cpy_const(True, enumerator, delayed=False)
+            return
+        #
+        funcname = self._enum_funcname(prefix, name)
+        prnt = self._prnt
+        prnt('static int %s(PyObject *lib)' % funcname)
+        prnt('{')
+        for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
+            self._check_int_constant_value(enumerator, enumvalue,
+                                           "enum %s: " % name)
+        prnt('  return %s;' % self._chained_list_constants[True])
+        self._chained_list_constants[True] = funcname + '(lib)'
+        prnt('}')
+        prnt()
+
+    _generate_cpy_enum_collecttype = _generate_nothing
+    _generate_cpy_enum_method = _generate_nothing
+
+    def _loading_cpy_enum(self, tp, name, module):
+        if tp.partial:
+            enumvalues = [getattr(module, enumerator)
+                          for enumerator in tp.enumerators]
+            tp.enumvalues = tuple(enumvalues)
+            tp.partial_resolved = True
+
+    def _loaded_cpy_enum(self, tp, name, module, library):
+        for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
+            setattr(library, enumerator, enumvalue)
+
+    # ----------
+    # macros: for now only for integers
+
+    def _generate_cpy_macro_decl(self, tp, name):
+        if tp == '...':
+            check_value = None
+        else:
+            check_value = tp     # an integer
+        self._generate_cpy_const(True, name, check_value=check_value)
+
+    _generate_cpy_macro_collecttype = _generate_nothing
+    _generate_cpy_macro_method = _generate_nothing
+    _loading_cpy_macro = _loaded_noop
+    _loaded_cpy_macro  = _loaded_noop
+
+    # ----------
+    # global variables
+
+    def _generate_cpy_variable_collecttype(self, tp, name):
+        if isinstance(tp, model.ArrayType):
+            tp_ptr = model.PointerType(tp.item)
+        else:
+            tp_ptr = model.PointerType(tp)
+        self._do_collect_type(tp_ptr)
+
+    def _generate_cpy_variable_decl(self, tp, name):
+        if isinstance(tp, model.ArrayType):
+            tp_ptr = model.PointerType(tp.item)
+            self._generate_cpy_const(False, name, tp, vartp=tp_ptr,
+                                     size_too = tp.length_is_unknown())
+        else:
+            tp_ptr = model.PointerType(tp)
+            self._generate_cpy_const(False, name, tp_ptr, category='var')
+
+    _generate_cpy_variable_method = _generate_nothing
+    _loading_cpy_variable = _loaded_noop
+
+    def _loaded_cpy_variable(self, tp, name, module, library):
+        value = getattr(library, name)
+        if isinstance(tp, model.ArrayType):   # int a[5] is "constant" in the
+                                              # sense that "a=..." is forbidden
+            if tp.length_is_unknown():
+                assert isinstance(value, tuple)
+                (value, size) = value
+                BItemType = self.ffi._get_cached_btype(tp.item)
+                length, rest = divmod(size, self.ffi.sizeof(BItemType))
+                if rest != 0:
+                    raise VerificationError(
+                        "bad size: %r does not seem to be an array of %s" %
+                        (name, tp.item))
+                tp = tp.resolve_length(length)
+            # 'value' is a <cdata 'type *'> which we have to replace with
+            # a <cdata 'type[N]'> if the N is actually known
+            if tp.length is not None:
+                BArray = self.ffi._get_cached_btype(tp)
+                value = self.ffi.cast(BArray, value)
+                setattr(library, name, value)
+            return
+        # remove ptr=<cdata 'int *'> from the library instance, and replace
+        # it by a property on the class, which reads/writes into ptr[0].
+        ptr = value
+        delattr(library, name)
+        def getter(library):
+            return ptr[0]
+        def setter(library, value):
+            ptr[0] = value
+        setattr(type(library), name, property(getter, setter))
+        type(library)._cffi_dir.append(name)
+
+    # ----------
+
+    def _generate_setup_custom(self):
+        prnt = self._prnt
+        prnt('static int _cffi_setup_custom(PyObject *lib)')
+        prnt('{')
+        prnt('  return %s;' % self._chained_list_constants[True])
+        prnt('}')
+
+cffimod_header = r'''
+#include <Python.h>
+#include <stddef.h>
+
+/* this block of #ifs should be kept exactly identical between
+   c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py
+   and cffi/_cffi_include.h */
+#if defined(_MSC_VER)
+# include <malloc.h>   /* for alloca() */
+# if _MSC_VER < 1600   /* MSVC < 2010 */
+   typedef __int8 int8_t;
+   typedef __int16 int16_t;
+   typedef __int32 int32_t;
+   typedef __int64 int64_t;
+   typedef unsigned __int8 uint8_t;
+   typedef unsigned __int16 uint16_t;
+   typedef unsigned __int32 uint32_t;
+   typedef unsigned __int64 uint64_t;
+   typedef __int8 int_least8_t;
+   typedef __int16 int_least16_t;
+   typedef __int32 int_least32_t;
+   typedef __int64 int_least64_t;
+   typedef unsigned __int8 uint_least8_t;
+   typedef unsigned __int16 uint_least16_t;
+   typedef unsigned __int32 uint_least32_t;
+   typedef unsigned __int64 uint_least64_t;
+   typedef __int8 int_fast8_t;
+   typedef __int16 int_fast16_t;
+   typedef __int32 int_fast32_t;
+   typedef __int64 int_fast64_t;
+   typedef unsigned __int8 uint_fast8_t;
+   typedef unsigned __int16 uint_fast16_t;
+   typedef unsigned __int32 uint_fast32_t;
+   typedef unsigned __int64 uint_fast64_t;
+   typedef __int64 intmax_t;
+   typedef unsigned __int64 uintmax_t;
+# else
+#  include <stdint.h>
+# endif
+# if _MSC_VER < 1800   /* MSVC < 2013 */
+#  ifndef __cplusplus
+    typedef unsigned char _Bool;
+#  endif
+# endif
+#else
+# include <stdint.h>
+# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
+#  include <alloca.h>
+# endif
+#endif
+
+#if PY_MAJOR_VERSION < 3
+# undef PyCapsule_CheckExact
+# undef PyCapsule_GetPointer
+# define PyCapsule_CheckExact(capsule) (PyCObject_Check(capsule))
+# define PyCapsule_GetPointer(capsule, name) \
+    (PyCObject_AsVoidPtr(capsule))
+#endif
+
+#if PY_MAJOR_VERSION >= 3
+# define PyInt_FromLong PyLong_FromLong
+#endif
+
+#define _cffi_from_c_double PyFloat_FromDouble
+#define _cffi_from_c_float PyFloat_FromDouble
+#define _cffi_from_c_long PyInt_FromLong
+#define _cffi_from_c_ulong PyLong_FromUnsignedLong
+#define _cffi_from_c_longlong PyLong_FromLongLong
+#define _cffi_from_c_ulonglong PyLong_FromUnsignedLongLong
+#define _cffi_from_c__Bool PyBool_FromLong
+
+#define _cffi_to_c_double PyFloat_AsDouble
+#define _cffi_to_c_float PyFloat_AsDouble
+
+#define _cffi_from_c_int_const(x)                                        \
+    (((x) > 0) ?                                                         \
+        ((unsigned long long)(x) <= (unsigned long long)LONG_MAX) ?      \
+            PyInt_FromLong((long)(x)) :                                  \
+            PyLong_FromUnsignedLongLong((unsigned long long)(x)) :       \
+        ((long long)(x) >= (long long)LONG_MIN) ?                        \
+            PyInt_FromLong((long)(x)) :                                  \
+            PyLong_FromLongLong((long long)(x)))
+
+#define _cffi_from_c_int(x, type)                                        \
+    (((type)-1) > 0 ? /* unsigned */                                     \
+        (sizeof(type) < sizeof(long) ?                                   \
+            PyInt_FromLong((long)x) :                                    \
+         sizeof(type) == sizeof(long) ?                                  \
+            PyLong_FromUnsignedLong((unsigned long)x) :                  \
+            PyLong_FromUnsignedLongLong((unsigned long long)x)) :        \
+        (sizeof(type) <= sizeof(long) ?                                  \
+            PyInt_FromLong((long)x) :                                    \
+            PyLong_FromLongLong((long long)x)))
+
+#define _cffi_to_c_int(o, type)                                          \
+    ((type)(                                                             \
+     sizeof(type) == 1 ? (((type)-1) > 0 ? (type)_cffi_to_c_u8(o)        \
+                                         : (type)_cffi_to_c_i8(o)) :     \
+     sizeof(type) == 2 ? (((type)-1) > 0 ? (type)_cffi_to_c_u16(o)       \
+                                         : (type)_cffi_to_c_i16(o)) :    \
+     sizeof(type) == 4 ? (((type)-1) > 0 ? (type)_cffi_to_c_u32(o)       \
+                                         : (type)_cffi_to_c_i32(o)) :    \
+     sizeof(type) == 8 ? (((type)-1) > 0 ? (type)_cffi_to_c_u64(o)       \
+                                         : (type)_cffi_to_c_i64(o)) :    \
+     (Py_FatalError("unsupported size for type " #type), (type)0)))
+
+#define _cffi_to_c_i8                                                    \
+                 ((int(*)(PyObject *))_cffi_exports[1])
+#define _cffi_to_c_u8                                                    \
+                 ((int(*)(PyObject *))_cffi_exports[2])
+#define _cffi_to_c_i16                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[3])
+#define _cffi_to_c_u16                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[4])
+#define _cffi_to_c_i32                                                   \
+                 ((int(*)(PyObject *))_cffi_exports[5])
+#define _cffi_to_c_u32                                                   \
+                 ((unsigned int(*)(PyObject *))_cffi_exports[6])
+#define _cffi_to_c_i64                                                   \
+                 ((long long(*)(PyObject *))_cffi_exports[7])
+#define _cffi_to_c_u64                                                   \
+                 ((unsigned long long(*)(PyObject *))_cffi_exports[8])
+#define _cffi_to_c_char                                                  \
+                 ((int(*)(PyObject *))_cffi_exports[9])
+#define _cffi_from_c_pointer                                             \
+    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10])
+#define _cffi_to_c_pointer                                               \
+    ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11])
+#define _cffi_get_struct_layout                                          \
+    ((PyObject *(*)(Py_ssize_t[]))_cffi_exports[12])
+#define _cffi_restore_errno                                              \
+    ((void(*)(void))_cffi_exports[13])
+#define _cffi_save_errno                                                 \
+    ((void(*)(void))_cffi_exports[14])
+#define _cffi_from_c_char                                                \
+    ((PyObject *(*)(char))_cffi_exports[15])
+#define _cffi_from_c_deref                                               \
+    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16])
+#define _cffi_to_c                                                       \
+    ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17])
+#define _cffi_from_c_struct                                              \
+    ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18])
+#define _cffi_to_c_wchar_t                                               \
+    ((wchar_t(*)(PyObject *))_cffi_exports[19])
+#define _cffi_from_c_wchar_t                                             \
+    ((PyObject *(*)(wchar_t))_cffi_exports[20])
+#define _cffi_to_c_long_double                                           \
+    ((long double(*)(PyObject *))_cffi_exports[21])
+#define _cffi_to_c__Bool                                                 \
+    ((_Bool(*)(PyObject *))_cffi_exports[22])
+#define _cffi_prepare_pointer_call_argument                              \
+    ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23])
+#define _cffi_convert_array_from_object                                  \
+    ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24])
+#define _CFFI_NUM_EXPORTS 25
+
+typedef struct _ctypedescr CTypeDescrObject;
+
+static void *_cffi_exports[_CFFI_NUM_EXPORTS];
+static PyObject *_cffi_types, *_cffi_VerificationError;
+
+static int _cffi_setup_custom(PyObject *lib);   /* forward */
+
+static PyObject *_cffi_setup(PyObject *self, PyObject *args)
+{
+    PyObject *library;
+    int was_alive = (_cffi_types != NULL);
+    (void)self; /* unused */
+    if (!PyArg_ParseTuple(args, "OOO", &_cffi_types, &_cffi_VerificationError,
+                                       &library))
+        return NULL;
+    Py_INCREF(_cffi_types);
+    Py_INCREF(_cffi_VerificationError);
+    if (_cffi_setup_custom(library) < 0)
+        return NULL;
+    return PyBool_FromLong(was_alive);
+}
+
+union _cffi_union_alignment_u {
+    unsigned char m_char;
+    unsigned short m_short;
+    unsigned int m_int;
+    unsigned long m_long;
+    unsigned long long m_longlong;
+    float m_float;
+    double m_double;
+    long double m_longdouble;
+};
+
+struct _cffi_freeme_s {
+    struct _cffi_freeme_s *next;
+    union _cffi_union_alignment_u alignment;
+};
+
+#ifdef __GNUC__
+  __attribute__((unused))
+#endif
+static int _cffi_convert_array_argument(CTypeDescrObject *ctptr, PyObject *arg,
+                                        char **output_data, Py_ssize_t datasize,
+                                        struct _cffi_freeme_s **freeme)
+{
+    char *p;
+    if (datasize < 0)
+        return -1;
+
+    p = *output_data;
+    if (p == NULL) {
+        struct _cffi_freeme_s *fp = (struct _cffi_freeme_s *)PyObject_Malloc(
+            offsetof(struct _cffi_freeme_s, alignment) + (size_t)datasize);
+        if (fp == NULL)
+            return -1;
+        fp->next = *freeme;
+        *freeme = fp;
+        p = *output_data = (char *)&fp->alignment;
+    }
+    memset((void *)p, 0, (size_t)datasize);
+    return _cffi_convert_array_from_object(p, ctptr, arg);
+}
+
+#ifdef __GNUC__
+  __attribute__((unused))
+#endif
+static void _cffi_free_array_arguments(struct _cffi_freeme_s *freeme)
+{
+    do {
+        void *p = (void *)freeme;
+        freeme = freeme->next;
+        PyObject_Free(p);
+    } while (freeme != NULL);
+}
+
+static int _cffi_init(void)
+{
+    PyObject *module, *c_api_object = NULL;
+
+    module = PyImport_ImportModule("_cffi_backend");
+    if (module == NULL)
+        goto failure;
+
+    c_api_object = PyObject_GetAttrString(module, "_C_API");
+    if (c_api_object == NULL)
+        goto failure;
+    if (!PyCapsule_CheckExact(c_api_object)) {
+        PyErr_SetNone(PyExc_ImportError);
+        goto failure;
+    }
+    memcpy(_cffi_exports, PyCapsule_GetPointer(c_api_object, "cffi"),
+           _CFFI_NUM_EXPORTS * sizeof(void *));
+
+    Py_DECREF(module);
+    Py_DECREF(c_api_object);
+    return 0;
+
+  failure:
+    Py_XDECREF(module);
+    Py_XDECREF(c_api_object);
+    return -1;
+}
+
+#define _cffi_type(num) ((CTypeDescrObject *)PyList_GET_ITEM(_cffi_types, num))
+
+/**********/
+'''
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_gen.py b/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_gen.py
new file mode 100644
index 0000000000000000000000000000000000000000..26421526f62a07e04419cd57f1f19a64ecd36452
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/vengine_gen.py
@@ -0,0 +1,675 @@
+#
+# DEPRECATED: implementation for ffi.verify()
+#
+import sys, os
+import types
+
+from . import model
+from .error import VerificationError
+
+
+class VGenericEngine(object):
+    _class_key = 'g'
+    _gen_python_module = False
+
+    def __init__(self, verifier):
+        self.verifier = verifier
+        self.ffi = verifier.ffi
+        self.export_symbols = []
+        self._struct_pending_verification = {}
+
+    def patch_extension_kwds(self, kwds):
+        # add 'export_symbols' to the dictionary.  Note that we add the
+        # list before filling it.  When we fill it, it will thus also show
+        # up in kwds['export_symbols'].
+        kwds.setdefault('export_symbols', self.export_symbols)
+
+    def find_module(self, module_name, path, so_suffixes):
+        for so_suffix in so_suffixes:
+            basename = module_name + so_suffix
+            if path is None:
+                path = sys.path
+            for dirname in path:
+                filename = os.path.join(dirname, basename)
+                if os.path.isfile(filename):
+                    return filename
+
+    def collect_types(self):
+        pass      # not needed in the generic engine
+
+    def _prnt(self, what=''):
+        self._f.write(what + '\n')
+
+    def write_source_to_f(self):
+        prnt = self._prnt
+        # first paste some standard set of lines that are mostly '#include'
+        prnt(cffimod_header)
+        # then paste the C source given by the user, verbatim.
+        prnt(self.verifier.preamble)
+        #
+        # call generate_gen_xxx_decl(), for every xxx found from
+        # ffi._parser._declarations.  This generates all the functions.
+        self._generate('decl')
+        #
+        # on Windows, distutils insists on putting init_cffi_xyz in
+        # 'export_symbols', so instead of fighting it, just give up and
+        # give it one
+        if sys.platform == 'win32':
+            if sys.version_info >= (3,):
+                prefix = 'PyInit_'
+            else:
+                prefix = 'init'
+            modname = self.verifier.get_module_name()
+            prnt("void %s%s(void) { }\n" % (prefix, modname))
+
+    def load_library(self, flags=0):
+        # import it with the CFFI backend
+        backend = self.ffi._backend
+        # needs to make a path that contains '/', on Posix
+        filename = os.path.join(os.curdir, self.verifier.modulefilename)
+        module = backend.load_library(filename, flags)
+        #
+        # call loading_gen_struct() to get the struct layout inferred by
+        # the C compiler
+        self._load(module, 'loading')
+
+        # build the FFILibrary class and instance, this is a module subclass
+        # because modules are expected to have usually-constant-attributes and
+        # in PyPy this means the JIT is able to treat attributes as constant,
+        # which we want.
+        class FFILibrary(types.ModuleType):
+            _cffi_generic_module = module
+            _cffi_ffi = self.ffi
+            _cffi_dir = []
+            def __dir__(self):
+                return FFILibrary._cffi_dir
+        library = FFILibrary("")
+        #
+        # finally, call the loaded_gen_xxx() functions.  This will set
+        # up the 'library' object.
+        self._load(module, 'loaded', library=library)
+        return library
+
+    def _get_declarations(self):
+        lst = [(key, tp) for (key, (tp, qual)) in
+                                self.ffi._parser._declarations.items()]
+        lst.sort()
+        return lst
+
+    def _generate(self, step_name):
+        for name, tp in self._get_declarations():
+            kind, realname = name.split(' ', 1)
+            try:
+                method = getattr(self, '_generate_gen_%s_%s' % (kind,
+                                                                step_name))
+            except AttributeError:
+                raise VerificationError(
+                    "not implemented in verify(): %r" % name)
+            try:
+                method(tp, realname)
+            except Exception as e:
+                model.attach_exception_info(e, name)
+                raise
+
+    def _load(self, module, step_name, **kwds):
+        for name, tp in self._get_declarations():
+            kind, realname = name.split(' ', 1)
+            method = getattr(self, '_%s_gen_%s' % (step_name, kind))
+            try:
+                method(tp, realname, module, **kwds)
+            except Exception as e:
+                model.attach_exception_info(e, name)
+                raise
+
+    def _generate_nothing(self, tp, name):
+        pass
+
+    def _loaded_noop(self, tp, name, module, **kwds):
+        pass
+
+    # ----------
+    # typedefs: generates no code so far
+
+    _generate_gen_typedef_decl   = _generate_nothing
+    _loading_gen_typedef         = _loaded_noop
+    _loaded_gen_typedef          = _loaded_noop
+
+    # ----------
+    # function declarations
+
+    def _generate_gen_function_decl(self, tp, name):
+        assert isinstance(tp, model.FunctionPtrType)
+        if tp.ellipsis:
+            # cannot support vararg functions better than this: check for its
+            # exact type (including the fixed arguments), and build it as a
+            # constant function pointer (no _cffi_f_%s wrapper)
+            self._generate_gen_const(False, name, tp)
+            return
+        prnt = self._prnt
+        numargs = len(tp.args)
+        argnames = []
+        for i, type in enumerate(tp.args):
+            indirection = ''
+            if isinstance(type, model.StructOrUnion):
+                indirection = '*'
+            argnames.append('%sx%d' % (indirection, i))
+        context = 'argument of %s' % name
+        arglist = [type.get_c_name(' %s' % arg, context)
+                   for type, arg in zip(tp.args, argnames)]
+        tpresult = tp.result
+        if isinstance(tpresult, model.StructOrUnion):
+            arglist.insert(0, tpresult.get_c_name(' *r', context))
+            tpresult = model.void_type
+        arglist = ', '.join(arglist) or 'void'
+        wrappername = '_cffi_f_%s' % name
+        self.export_symbols.append(wrappername)
+        if tp.abi:
+            abi = tp.abi + ' '
+        else:
+            abi = ''
+        funcdecl = ' %s%s(%s)' % (abi, wrappername, arglist)
+        context = 'result of %s' % name
+        prnt(tpresult.get_c_name(funcdecl, context))
+        prnt('{')
+        #
+        if isinstance(tp.result, model.StructOrUnion):
+            result_code = '*r = '
+        elif not isinstance(tp.result, model.VoidType):
+            result_code = 'return '
+        else:
+            result_code = ''
+        prnt('  %s%s(%s);' % (result_code, name, ', '.join(argnames)))
+        prnt('}')
+        prnt()
+
+    _loading_gen_function = _loaded_noop
+
+    def _loaded_gen_function(self, tp, name, module, library):
+        assert isinstance(tp, model.FunctionPtrType)
+        if tp.ellipsis:
+            newfunction = self._load_constant(False, tp, name, module)
+        else:
+            indirections = []
+            base_tp = tp
+            if (any(isinstance(typ, model.StructOrUnion) for typ in tp.args)
+                    or isinstance(tp.result, model.StructOrUnion)):
+                indirect_args = []
+                for i, typ in enumerate(tp.args):
+                    if isinstance(typ, model.StructOrUnion):
+                        typ = model.PointerType(typ)
+                        indirections.append((i, typ))
+                    indirect_args.append(typ)
+                indirect_result = tp.result
+                if isinstance(indirect_result, model.StructOrUnion):
+                    if indirect_result.fldtypes is None:
+                        raise TypeError("'%s' is used as result type, "
+                                        "but is opaque" % (
+                                            indirect_result._get_c_name(),))
+                    indirect_result = model.PointerType(indirect_result)
+                    indirect_args.insert(0, indirect_result)
+                    indirections.insert(0, ("result", indirect_result))
+                    indirect_result = model.void_type
+                tp = model.FunctionPtrType(tuple(indirect_args),
+                                           indirect_result, tp.ellipsis)
+            BFunc = self.ffi._get_cached_btype(tp)
+            wrappername = '_cffi_f_%s' % name
+            newfunction = module.load_function(BFunc, wrappername)
+            for i, typ in indirections:
+                newfunction = self._make_struct_wrapper(newfunction, i, typ,
+                                                        base_tp)
+        setattr(library, name, newfunction)
+        type(library)._cffi_dir.append(name)
+
+    def _make_struct_wrapper(self, oldfunc, i, tp, base_tp):
+        backend = self.ffi._backend
+        BType = self.ffi._get_cached_btype(tp)
+        if i == "result":
+            ffi = self.ffi
+            def newfunc(*args):
+                res = ffi.new(BType)
+                oldfunc(res, *args)
+                return res[0]
+        else:
+            def newfunc(*args):
+                args = args[:i] + (backend.newp(BType, args[i]),) + args[i+1:]
+                return oldfunc(*args)
+        newfunc._cffi_base_type = base_tp
+        return newfunc
+
+    # ----------
+    # named structs
+
+    def _generate_gen_struct_decl(self, tp, name):
+        assert name == tp.name
+        self._generate_struct_or_union_decl(tp, 'struct', name)
+
+    def _loading_gen_struct(self, tp, name, module):
+        self._loading_struct_or_union(tp, 'struct', name, module)
+
+    def _loaded_gen_struct(self, tp, name, module, **kwds):
+        self._loaded_struct_or_union(tp)
+
+    def _generate_gen_union_decl(self, tp, name):
+        assert name == tp.name
+        self._generate_struct_or_union_decl(tp, 'union', name)
+
+    def _loading_gen_union(self, tp, name, module):
+        self._loading_struct_or_union(tp, 'union', name, module)
+
+    def _loaded_gen_union(self, tp, name, module, **kwds):
+        self._loaded_struct_or_union(tp)
+
+    def _generate_struct_or_union_decl(self, tp, prefix, name):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        checkfuncname = '_cffi_check_%s_%s' % (prefix, name)
+        layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
+        cname = ('%s %s' % (prefix, name)).strip()
+        #
+        prnt = self._prnt
+        prnt('static void %s(%s *p)' % (checkfuncname, cname))
+        prnt('{')
+        prnt('  /* only to generate compile-time warnings or errors */')
+        prnt('  (void)p;')
+        for fname, ftype, fbitsize, fqual in tp.enumfields():
+            if (isinstance(ftype, model.PrimitiveType)
+                and ftype.is_integer_type()) or fbitsize >= 0:
+                # accept all integers, but complain on float or double
+                prnt('  (void)((p->%s) << 1);' % fname)
+            else:
+                # only accept exactly the type declared.
+                try:
+                    prnt('  { %s = &p->%s; (void)tmp; }' % (
+                        ftype.get_c_name('*tmp', 'field %r'%fname, quals=fqual),
+                        fname))
+                except VerificationError as e:
+                    prnt('  /* %s */' % str(e))   # cannot verify it, ignore
+        prnt('}')
+        self.export_symbols.append(layoutfuncname)
+        prnt('intptr_t %s(intptr_t i)' % (layoutfuncname,))
+        prnt('{')
+        prnt('  struct _cffi_aligncheck { char x; %s y; };' % cname)
+        prnt('  static intptr_t nums[] = {')
+        prnt('    sizeof(%s),' % cname)
+        prnt('    offsetof(struct _cffi_aligncheck, y),')
+        for fname, ftype, fbitsize, fqual in tp.enumfields():
+            if fbitsize >= 0:
+                continue      # xxx ignore fbitsize for now
+            prnt('    offsetof(%s, %s),' % (cname, fname))
+            if isinstance(ftype, model.ArrayType) and ftype.length is None:
+                prnt('    0,  /* %s */' % ftype._get_c_name())
+            else:
+                prnt('    sizeof(((%s *)0)->%s),' % (cname, fname))
+        prnt('    -1')
+        prnt('  };')
+        prnt('  return nums[i];')
+        prnt('  /* the next line is not executed, but compiled */')
+        prnt('  %s(0);' % (checkfuncname,))
+        prnt('}')
+        prnt()
+
+    def _loading_struct_or_union(self, tp, prefix, name, module):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        layoutfuncname = '_cffi_layout_%s_%s' % (prefix, name)
+        #
+        BFunc = self.ffi._typeof_locked("intptr_t(*)(intptr_t)")[0]
+        function = module.load_function(BFunc, layoutfuncname)
+        layout = []
+        num = 0
+        while True:
+            x = function(num)
+            if x < 0: break
+            layout.append(x)
+            num += 1
+        if isinstance(tp, model.StructOrUnion) and tp.partial:
+            # use the function()'s sizes and offsets to guide the
+            # layout of the struct
+            totalsize = layout[0]
+            totalalignment = layout[1]
+            fieldofs = layout[2::2]
+            fieldsize = layout[3::2]
+            tp.force_flatten()
+            assert len(fieldofs) == len(fieldsize) == len(tp.fldnames)
+            tp.fixedlayout = fieldofs, fieldsize, totalsize, totalalignment
+        else:
+            cname = ('%s %s' % (prefix, name)).strip()
+            self._struct_pending_verification[tp] = layout, cname
+
+    def _loaded_struct_or_union(self, tp):
+        if tp.fldnames is None:
+            return     # nothing to do with opaque structs
+        self.ffi._get_cached_btype(tp)   # force 'fixedlayout' to be considered
+
+        if tp in self._struct_pending_verification:
+            # check that the layout sizes and offsets match the real ones
+            def check(realvalue, expectedvalue, msg):
+                if realvalue != expectedvalue:
+                    raise VerificationError(
+                        "%s (we have %d, but C compiler says %d)"
+                        % (msg, expectedvalue, realvalue))
+            ffi = self.ffi
+            BStruct = ffi._get_cached_btype(tp)
+            layout, cname = self._struct_pending_verification.pop(tp)
+            check(layout[0], ffi.sizeof(BStruct), "wrong total size")
+            check(layout[1], ffi.alignof(BStruct), "wrong total alignment")
+            i = 2
+            for fname, ftype, fbitsize, fqual in tp.enumfields():
+                if fbitsize >= 0:
+                    continue        # xxx ignore fbitsize for now
+                check(layout[i], ffi.offsetof(BStruct, fname),
+                      "wrong offset for field %r" % (fname,))
+                if layout[i+1] != 0:
+                    BField = ffi._get_cached_btype(ftype)
+                    check(layout[i+1], ffi.sizeof(BField),
+                          "wrong size for field %r" % (fname,))
+                i += 2
+            assert i == len(layout)
+
+    # ----------
+    # 'anonymous' declarations.  These are produced for anonymous structs
+    # or unions; the 'name' is obtained by a typedef.
+
+    def _generate_gen_anonymous_decl(self, tp, name):
+        if isinstance(tp, model.EnumType):
+            self._generate_gen_enum_decl(tp, name, '')
+        else:
+            self._generate_struct_or_union_decl(tp, '', name)
+
+    def _loading_gen_anonymous(self, tp, name, module):
+        if isinstance(tp, model.EnumType):
+            self._loading_gen_enum(tp, name, module, '')
+        else:
+            self._loading_struct_or_union(tp, '', name, module)
+
+    def _loaded_gen_anonymous(self, tp, name, module, **kwds):
+        if isinstance(tp, model.EnumType):
+            self._loaded_gen_enum(tp, name, module, **kwds)
+        else:
+            self._loaded_struct_or_union(tp)
+
+    # ----------
+    # constants, likely declared with '#define'
+
+    def _generate_gen_const(self, is_int, name, tp=None, category='const',
+                            check_value=None):
+        prnt = self._prnt
+        funcname = '_cffi_%s_%s' % (category, name)
+        self.export_symbols.append(funcname)
+        if check_value is not None:
+            assert is_int
+            assert category == 'const'
+            prnt('int %s(char *out_error)' % funcname)
+            prnt('{')
+            self._check_int_constant_value(name, check_value)
+            prnt('  return 0;')
+            prnt('}')
+        elif is_int:
+            assert category == 'const'
+            prnt('int %s(long long *out_value)' % funcname)
+            prnt('{')
+            prnt('  *out_value = (long long)(%s);' % (name,))
+            prnt('  return (%s) <= 0;' % (name,))
+            prnt('}')
+        else:
+            assert tp is not None
+            assert check_value is None
+            if category == 'var':
+                ampersand = '&'
+            else:
+                ampersand = ''
+            extra = ''
+            if category == 'const' and isinstance(tp, model.StructOrUnion):
+                extra = 'const *'
+                ampersand = '&'
+            prnt(tp.get_c_name(' %s%s(void)' % (extra, funcname), name))
+            prnt('{')
+            prnt('  return (%s%s);' % (ampersand, name))
+            prnt('}')
+        prnt()
+
+    def _generate_gen_constant_decl(self, tp, name):
+        is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type()
+        self._generate_gen_const(is_int, name, tp)
+
+    _loading_gen_constant = _loaded_noop
+
+    def _load_constant(self, is_int, tp, name, module, check_value=None):
+        funcname = '_cffi_const_%s' % name
+        if check_value is not None:
+            assert is_int
+            self._load_known_int_constant(module, funcname)
+            value = check_value
+        elif is_int:
+            BType = self.ffi._typeof_locked("long long*")[0]
+            BFunc = self.ffi._typeof_locked("int(*)(long long*)")[0]
+            function = module.load_function(BFunc, funcname)
+            p = self.ffi.new(BType)
+            negative = function(p)
+            value = int(p[0])
+            if value < 0 and not negative:
+                BLongLong = self.ffi._typeof_locked("long long")[0]
+                value += (1 << (8*self.ffi.sizeof(BLongLong)))
+        else:
+            assert check_value is None
+            fntypeextra = '(*)(void)'
+            if isinstance(tp, model.StructOrUnion):
+                fntypeextra = '*' + fntypeextra
+            BFunc = self.ffi._typeof_locked(tp.get_c_name(fntypeextra, name))[0]
+            function = module.load_function(BFunc, funcname)
+            value = function()
+            if isinstance(tp, model.StructOrUnion):
+                value = value[0]
+        return value
+
+    def _loaded_gen_constant(self, tp, name, module, library):
+        is_int = isinstance(tp, model.PrimitiveType) and tp.is_integer_type()
+        value = self._load_constant(is_int, tp, name, module)
+        setattr(library, name, value)
+        type(library)._cffi_dir.append(name)
+
+    # ----------
+    # enums
+
+    def _check_int_constant_value(self, name, value):
+        prnt = self._prnt
+        if value <= 0:
+            prnt('  if ((%s) > 0 || (long)(%s) != %dL) {' % (
+                name, name, value))
+        else:
+            prnt('  if ((%s) <= 0 || (unsigned long)(%s) != %dUL) {' % (
+                name, name, value))
+        prnt('    char buf[64];')
+        prnt('    if ((%s) <= 0)' % name)
+        prnt('        sprintf(buf, "%%ld", (long)(%s));' % name)
+        prnt('    else')
+        prnt('        sprintf(buf, "%%lu", (unsigned long)(%s));' %
+             name)
+        prnt('    sprintf(out_error, "%s has the real value %s, not %s",')
+        prnt('            "%s", buf, "%d");' % (name[:100], value))
+        prnt('    return -1;')
+        prnt('  }')
+
+    def _load_known_int_constant(self, module, funcname):
+        BType = self.ffi._typeof_locked("char[]")[0]
+        BFunc = self.ffi._typeof_locked("int(*)(char*)")[0]
+        function = module.load_function(BFunc, funcname)
+        p = self.ffi.new(BType, 256)
+        if function(p) < 0:
+            error = self.ffi.string(p)
+            if sys.version_info >= (3,):
+                error = str(error, 'utf-8')
+            raise VerificationError(error)
+
+    def _enum_funcname(self, prefix, name):
+        # "$enum_$1" => "___D_enum____D_1"
+        name = name.replace('$', '___D_')
+        return '_cffi_e_%s_%s' % (prefix, name)
+
+    def _generate_gen_enum_decl(self, tp, name, prefix='enum'):
+        if tp.partial:
+            for enumerator in tp.enumerators:
+                self._generate_gen_const(True, enumerator)
+            return
+        #
+        funcname = self._enum_funcname(prefix, name)
+        self.export_symbols.append(funcname)
+        prnt = self._prnt
+        prnt('int %s(char *out_error)' % funcname)
+        prnt('{')
+        for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
+            self._check_int_constant_value(enumerator, enumvalue)
+        prnt('  return 0;')
+        prnt('}')
+        prnt()
+
+    def _loading_gen_enum(self, tp, name, module, prefix='enum'):
+        if tp.partial:
+            enumvalues = [self._load_constant(True, tp, enumerator, module)
+                          for enumerator in tp.enumerators]
+            tp.enumvalues = tuple(enumvalues)
+            tp.partial_resolved = True
+        else:
+            funcname = self._enum_funcname(prefix, name)
+            self._load_known_int_constant(module, funcname)
+
+    def _loaded_gen_enum(self, tp, name, module, library):
+        for enumerator, enumvalue in zip(tp.enumerators, tp.enumvalues):
+            setattr(library, enumerator, enumvalue)
+            type(library)._cffi_dir.append(enumerator)
+
+    # ----------
+    # macros: for now only for integers
+
+    def _generate_gen_macro_decl(self, tp, name):
+        if tp == '...':
+            check_value = None
+        else:
+            check_value = tp     # an integer
+        self._generate_gen_const(True, name, check_value=check_value)
+
+    _loading_gen_macro = _loaded_noop
+
+    def _loaded_gen_macro(self, tp, name, module, library):
+        if tp == '...':
+            check_value = None
+        else:
+            check_value = tp     # an integer
+        value = self._load_constant(True, tp, name, module,
+                                    check_value=check_value)
+        setattr(library, name, value)
+        type(library)._cffi_dir.append(name)
+
+    # ----------
+    # global variables
+
+    def _generate_gen_variable_decl(self, tp, name):
+        if isinstance(tp, model.ArrayType):
+            if tp.length_is_unknown():
+                prnt = self._prnt
+                funcname = '_cffi_sizeof_%s' % (name,)
+                self.export_symbols.append(funcname)
+                prnt("size_t %s(void)" % funcname)
+                prnt("{")
+                prnt("  return sizeof(%s);" % (name,))
+                prnt("}")
+            tp_ptr = model.PointerType(tp.item)
+            self._generate_gen_const(False, name, tp_ptr)
+        else:
+            tp_ptr = model.PointerType(tp)
+            self._generate_gen_const(False, name, tp_ptr, category='var')
+
+    _loading_gen_variable = _loaded_noop
+
+    def _loaded_gen_variable(self, tp, name, module, library):
+        if isinstance(tp, model.ArrayType):   # int a[5] is "constant" in the
+                                              # sense that "a=..." is forbidden
+            if tp.length_is_unknown():
+                funcname = '_cffi_sizeof_%s' % (name,)
+                BFunc = self.ffi._typeof_locked('size_t(*)(void)')[0]
+                function = module.load_function(BFunc, funcname)
+                size = function()
+                BItemType = self.ffi._get_cached_btype(tp.item)
+                length, rest = divmod(size, self.ffi.sizeof(BItemType))
+                if rest != 0:
+                    raise VerificationError(
+                        "bad size: %r does not seem to be an array of %s" %
+                        (name, tp.item))
+                tp = tp.resolve_length(length)
+            tp_ptr = model.PointerType(tp.item)
+            value = self._load_constant(False, tp_ptr, name, module)
+            # 'value' is a <cdata 'type *'> which we have to replace with
+            # a <cdata 'type[N]'> if the N is actually known
+            if tp.length is not None:
+                BArray = self.ffi._get_cached_btype(tp)
+                value = self.ffi.cast(BArray, value)
+            setattr(library, name, value)
+            type(library)._cffi_dir.append(name)
+            return
+        # remove ptr=<cdata 'int *'> from the library instance, and replace
+        # it by a property on the class, which reads/writes into ptr[0].
+        funcname = '_cffi_var_%s' % name
+        BFunc = self.ffi._typeof_locked(tp.get_c_name('*(*)(void)', name))[0]
+        function = module.load_function(BFunc, funcname)
+        ptr = function()
+        def getter(library):
+            return ptr[0]
+        def setter(library, value):
+            ptr[0] = value
+        setattr(type(library), name, property(getter, setter))
+        type(library)._cffi_dir.append(name)
+
+cffimod_header = r'''
+#include <stdio.h>
+#include <stddef.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <sys/types.h>   /* XXX for ssize_t on some platforms */
+
+/* this block of #ifs should be kept exactly identical between
+   c/_cffi_backend.c, cffi/vengine_cpy.py, cffi/vengine_gen.py
+   and cffi/_cffi_include.h */
+#if defined(_MSC_VER)
+# include <malloc.h>   /* for alloca() */
+# if _MSC_VER < 1600   /* MSVC < 2010 */
+   typedef __int8 int8_t;
+   typedef __int16 int16_t;
+   typedef __int32 int32_t;
+   typedef __int64 int64_t;
+   typedef unsigned __int8 uint8_t;
+   typedef unsigned __int16 uint16_t;
+   typedef unsigned __int32 uint32_t;
+   typedef unsigned __int64 uint64_t;
+   typedef __int8 int_least8_t;
+   typedef __int16 int_least16_t;
+   typedef __int32 int_least32_t;
+   typedef __int64 int_least64_t;
+   typedef unsigned __int8 uint_least8_t;
+   typedef unsigned __int16 uint_least16_t;
+   typedef unsigned __int32 uint_least32_t;
+   typedef unsigned __int64 uint_least64_t;
+   typedef __int8 int_fast8_t;
+   typedef __int16 int_fast16_t;
+   typedef __int32 int_fast32_t;
+   typedef __int64 int_fast64_t;
+   typedef unsigned __int8 uint_fast8_t;
+   typedef unsigned __int16 uint_fast16_t;
+   typedef unsigned __int32 uint_fast32_t;
+   typedef unsigned __int64 uint_fast64_t;
+   typedef __int64 intmax_t;
+   typedef unsigned __int64 uintmax_t;
+# else
+#  include <stdint.h>
+# endif
+# if _MSC_VER < 1800   /* MSVC < 2013 */
+#  ifndef __cplusplus
+    typedef unsigned char _Bool;
+#  endif
+# endif
+#else
+# include <stdint.h>
+# if (defined (__SVR4) && defined (__sun)) || defined(_AIX) || defined(__hpux)
+#  include <alloca.h>
+# endif
+#endif
+'''
diff --git a/TP03/TP03/lib/python3.9/site-packages/cffi/verifier.py b/TP03/TP03/lib/python3.9/site-packages/cffi/verifier.py
new file mode 100644
index 0000000000000000000000000000000000000000..e392a2b7fdab66662f5a32885cbe865d6c538ebe
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cffi/verifier.py
@@ -0,0 +1,306 @@
+#
+# DEPRECATED: implementation for ffi.verify()
+#
+import sys, os, binascii, shutil, io
+from . import __version_verifier_modules__
+from . import ffiplatform
+from .error import VerificationError
+
+if sys.version_info >= (3, 3):
+    import importlib.machinery
+    def _extension_suffixes():
+        return importlib.machinery.EXTENSION_SUFFIXES[:]
+else:
+    import imp
+    def _extension_suffixes():
+        return [suffix for suffix, _, type in imp.get_suffixes()
+                if type == imp.C_EXTENSION]
+
+
+if sys.version_info >= (3,):
+    NativeIO = io.StringIO
+else:
+    class NativeIO(io.BytesIO):
+        def write(self, s):
+            if isinstance(s, unicode):
+                s = s.encode('ascii')
+            super(NativeIO, self).write(s)
+
+
+class Verifier(object):
+
+    def __init__(self, ffi, preamble, tmpdir=None, modulename=None,
+                 ext_package=None, tag='', force_generic_engine=False,
+                 source_extension='.c', flags=None, relative_to=None, **kwds):
+        if ffi._parser._uses_new_feature:
+            raise VerificationError(
+                "feature not supported with ffi.verify(), but only "
+                "with ffi.set_source(): %s" % (ffi._parser._uses_new_feature,))
+        self.ffi = ffi
+        self.preamble = preamble
+        if not modulename:
+            flattened_kwds = ffiplatform.flatten(kwds)
+        vengine_class = _locate_engine_class(ffi, force_generic_engine)
+        self._vengine = vengine_class(self)
+        self._vengine.patch_extension_kwds(kwds)
+        self.flags = flags
+        self.kwds = self.make_relative_to(kwds, relative_to)
+        #
+        if modulename:
+            if tag:
+                raise TypeError("can't specify both 'modulename' and 'tag'")
+        else:
+            key = '\x00'.join(['%d.%d' % sys.version_info[:2],
+                               __version_verifier_modules__,
+                               preamble, flattened_kwds] +
+                              ffi._cdefsources)
+            if sys.version_info >= (3,):
+                key = key.encode('utf-8')
+            k1 = hex(binascii.crc32(key[0::2]) & 0xffffffff)
+            k1 = k1.lstrip('0x').rstrip('L')
+            k2 = hex(binascii.crc32(key[1::2]) & 0xffffffff)
+            k2 = k2.lstrip('0').rstrip('L')
+            modulename = '_cffi_%s_%s%s%s' % (tag, self._vengine._class_key,
+                                              k1, k2)
+        suffix = _get_so_suffixes()[0]
+        self.tmpdir = tmpdir or _caller_dir_pycache()
+        self.sourcefilename = os.path.join(self.tmpdir, modulename + source_extension)
+        self.modulefilename = os.path.join(self.tmpdir, modulename + suffix)
+        self.ext_package = ext_package
+        self._has_source = False
+        self._has_module = False
+
+    def write_source(self, file=None):
+        """Write the C source code.  It is produced in 'self.sourcefilename',
+        which can be tweaked beforehand."""
+        with self.ffi._lock:
+            if self._has_source and file is None:
+                raise VerificationError(
+                    "source code already written")
+            self._write_source(file)
+
+    def compile_module(self):
+        """Write the C source code (if not done already) and compile it.
+        This produces a dynamic link library in 'self.modulefilename'."""
+        with self.ffi._lock:
+            if self._has_module:
+                raise VerificationError("module already compiled")
+            if not self._has_source:
+                self._write_source()
+            self._compile_module()
+
+    def load_library(self):
+        """Get a C module from this Verifier instance.
+        Returns an instance of a FFILibrary class that behaves like the
+        objects returned by ffi.dlopen(), but that delegates all
+        operations to the C module.  If necessary, the C code is written
+        and compiled first.
+        """
+        with self.ffi._lock:
+            if not self._has_module:
+                self._locate_module()
+                if not self._has_module:
+                    if not self._has_source:
+                        self._write_source()
+                    self._compile_module()
+            return self._load_library()
+
+    def get_module_name(self):
+        basename = os.path.basename(self.modulefilename)
+        # kill both the .so extension and the other .'s, as introduced
+        # by Python 3: 'basename.cpython-33m.so'
+        basename = basename.split('.', 1)[0]
+        # and the _d added in Python 2 debug builds --- but try to be
+        # conservative and not kill a legitimate _d
+        if basename.endswith('_d') and hasattr(sys, 'gettotalrefcount'):
+            basename = basename[:-2]
+        return basename
+
+    def get_extension(self):
+        if not self._has_source:
+            with self.ffi._lock:
+                if not self._has_source:
+                    self._write_source()
+        sourcename = ffiplatform.maybe_relative_path(self.sourcefilename)
+        modname = self.get_module_name()
+        return ffiplatform.get_extension(sourcename, modname, **self.kwds)
+
+    def generates_python_module(self):
+        return self._vengine._gen_python_module
+
+    def make_relative_to(self, kwds, relative_to):
+        if relative_to and os.path.dirname(relative_to):
+            dirname = os.path.dirname(relative_to)
+            kwds = kwds.copy()
+            for key in ffiplatform.LIST_OF_FILE_NAMES:
+                if key in kwds:
+                    lst = kwds[key]
+                    if not isinstance(lst, (list, tuple)):
+                        raise TypeError("keyword '%s' should be a list or tuple"
+                                        % (key,))
+                    lst = [os.path.join(dirname, fn) for fn in lst]
+                    kwds[key] = lst
+        return kwds
+
+    # ----------
+
+    def _locate_module(self):
+        if not os.path.isfile(self.modulefilename):
+            if self.ext_package:
+                try:
+                    pkg = __import__(self.ext_package, None, None, ['__doc__'])
+                except ImportError:
+                    return      # cannot import the package itself, give up
+                    # (e.g. it might be called differently before installation)
+                path = pkg.__path__
+            else:
+                path = None
+            filename = self._vengine.find_module(self.get_module_name(), path,
+                                                 _get_so_suffixes())
+            if filename is None:
+                return
+            self.modulefilename = filename
+        self._vengine.collect_types()
+        self._has_module = True
+
+    def _write_source_to(self, file):
+        self._vengine._f = file
+        try:
+            self._vengine.write_source_to_f()
+        finally:
+            del self._vengine._f
+
+    def _write_source(self, file=None):
+        if file is not None:
+            self._write_source_to(file)
+        else:
+            # Write our source file to an in memory file.
+            f = NativeIO()
+            self._write_source_to(f)
+            source_data = f.getvalue()
+
+            # Determine if this matches the current file
+            if os.path.exists(self.sourcefilename):
+                with open(self.sourcefilename, "r") as fp:
+                    needs_written = not (fp.read() == source_data)
+            else:
+                needs_written = True
+
+            # Actually write the file out if it doesn't match
+            if needs_written:
+                _ensure_dir(self.sourcefilename)
+                with open(self.sourcefilename, "w") as fp:
+                    fp.write(source_data)
+
+            # Set this flag
+            self._has_source = True
+
+    def _compile_module(self):
+        # compile this C source
+        tmpdir = os.path.dirname(self.sourcefilename)
+        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
+        try:
+            same = ffiplatform.samefile(outputfilename, self.modulefilename)
+        except OSError:
+            same = False
+        if not same:
+            _ensure_dir(self.modulefilename)
+            shutil.move(outputfilename, self.modulefilename)
+        self._has_module = True
+
+    def _load_library(self):
+        assert self._has_module
+        if self.flags is not None:
+            return self._vengine.load_library(self.flags)
+        else:
+            return self._vengine.load_library()
+
+# ____________________________________________________________
+
+_FORCE_GENERIC_ENGINE = False      # for tests
+
+def _locate_engine_class(ffi, force_generic_engine):
+    if _FORCE_GENERIC_ENGINE:
+        force_generic_engine = True
+    if not force_generic_engine:
+        if '__pypy__' in sys.builtin_module_names:
+            force_generic_engine = True
+        else:
+            try:
+                import _cffi_backend
+            except ImportError:
+                _cffi_backend = '?'
+            if ffi._backend is not _cffi_backend:
+                force_generic_engine = True
+    if force_generic_engine:
+        from . import vengine_gen
+        return vengine_gen.VGenericEngine
+    else:
+        from . import vengine_cpy
+        return vengine_cpy.VCPythonEngine
+
+# ____________________________________________________________
+
+_TMPDIR = None
+
+def _caller_dir_pycache():
+    if _TMPDIR:
+        return _TMPDIR
+    result = os.environ.get('CFFI_TMPDIR')
+    if result:
+        return result
+    filename = sys._getframe(2).f_code.co_filename
+    return os.path.abspath(os.path.join(os.path.dirname(filename),
+                           '__pycache__'))
+
+def set_tmpdir(dirname):
+    """Set the temporary directory to use instead of __pycache__."""
+    global _TMPDIR
+    _TMPDIR = dirname
+
+def cleanup_tmpdir(tmpdir=None, keep_so=False):
+    """Clean up the temporary directory by removing all files in it
+    called `_cffi_*.{c,so}` as well as the `build` subdirectory."""
+    tmpdir = tmpdir or _caller_dir_pycache()
+    try:
+        filelist = os.listdir(tmpdir)
+    except OSError:
+        return
+    if keep_so:
+        suffix = '.c'   # only remove .c files
+    else:
+        suffix = _get_so_suffixes()[0].lower()
+    for fn in filelist:
+        if fn.lower().startswith('_cffi_') and (
+                fn.lower().endswith(suffix) or fn.lower().endswith('.c')):
+            try:
+                os.unlink(os.path.join(tmpdir, fn))
+            except OSError:
+                pass
+    clean_dir = [os.path.join(tmpdir, 'build')]
+    for dir in clean_dir:
+        try:
+            for fn in os.listdir(dir):
+                fn = os.path.join(dir, fn)
+                if os.path.isdir(fn):
+                    clean_dir.append(fn)
+                else:
+                    os.unlink(fn)
+        except OSError:
+            pass
+
+def _get_so_suffixes():
+    suffixes = _extension_suffixes()
+    if not suffixes:
+        # bah, no C_EXTENSION available.  Occurs on pypy without cpyext
+        if sys.platform == 'win32':
+            suffixes = [".pyd"]
+        else:
+            suffixes = [".so"]
+
+    return suffixes
+
+def _ensure_dir(filename):
+    dirname = os.path.dirname(filename)
+    if dirname and not os.path.isdir(dirname):
+        os.makedirs(dirname)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..b11f379efe1504d235b4d2d42685ba5dc6af6e9f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE
@@ -0,0 +1,3 @@
+This software is made available under the terms of *either* of the licenses
+found in LICENSE.APACHE or LICENSE.BSD. Contributions to cryptography are made
+under the terms of *both* these licenses.
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.APACHE b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.APACHE
new file mode 100644
index 0000000000000000000000000000000000000000..62589edd12a37dd28b6b6fed1e2d728ac9f05c8d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.APACHE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        https://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
+
+       https://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/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.BSD b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.BSD
new file mode 100644
index 0000000000000000000000000000000000000000..ec1a29d34d6e419411c75523408aca72f705345c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/LICENSE.BSD
@@ -0,0 +1,27 @@
+Copyright (c) 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.
+
+    3. Neither the name of PyCA Cryptography 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 OWNER 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/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..ad3563fdb8e0388c5c1e19f51ea9fc9fa3cf921b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/METADATA
@@ -0,0 +1,133 @@
+Metadata-Version: 2.1
+Name: cryptography
+Version: 41.0.4
+Summary: cryptography is a package which provides cryptographic recipes and primitives to Python developers.
+Author-email: The Python Cryptographic Authority and individual contributors <cryptography-dev@python.org>
+License: Apache-2.0 OR BSD-3-Clause
+Project-URL: homepage, https://github.com/pyca/cryptography
+Project-URL: documentation, https://cryptography.io/
+Project-URL: source, https://github.com/pyca/cryptography/
+Project-URL: issues, https://github.com/pyca/cryptography/issues
+Project-URL: changelog, https://cryptography.io/en/latest/changelog/
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: Apache Software License
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Natural Language :: English
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: POSIX :: BSD
+Classifier: Operating System :: POSIX :: Linux
+Classifier: Operating System :: Microsoft :: Windows
+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 :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Security :: Cryptography
+Requires-Python: >=3.7
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+License-File: LICENSE.APACHE
+License-File: LICENSE.BSD
+Requires-Dist: cffi >=1.12
+Provides-Extra: docs
+Requires-Dist: sphinx >=5.3.0 ; extra == 'docs'
+Requires-Dist: sphinx-rtd-theme >=1.1.1 ; extra == 'docs'
+Provides-Extra: docstest
+Requires-Dist: pyenchant >=1.6.11 ; extra == 'docstest'
+Requires-Dist: twine >=1.12.0 ; extra == 'docstest'
+Requires-Dist: sphinxcontrib-spelling >=4.0.1 ; extra == 'docstest'
+Provides-Extra: nox
+Requires-Dist: nox ; extra == 'nox'
+Provides-Extra: pep8test
+Requires-Dist: black ; extra == 'pep8test'
+Requires-Dist: ruff ; extra == 'pep8test'
+Requires-Dist: mypy ; extra == 'pep8test'
+Requires-Dist: check-sdist ; extra == 'pep8test'
+Provides-Extra: sdist
+Requires-Dist: build ; extra == 'sdist'
+Provides-Extra: ssh
+Requires-Dist: bcrypt >=3.1.5 ; extra == 'ssh'
+Provides-Extra: test
+Requires-Dist: pytest >=6.2.0 ; extra == 'test'
+Requires-Dist: pytest-benchmark ; extra == 'test'
+Requires-Dist: pytest-cov ; extra == 'test'
+Requires-Dist: pytest-xdist ; extra == 'test'
+Requires-Dist: pretend ; extra == 'test'
+Provides-Extra: test-randomorder
+Requires-Dist: pytest-randomly ; extra == 'test-randomorder'
+
+pyca/cryptography
+=================
+
+.. image:: https://img.shields.io/pypi/v/cryptography.svg
+    :target: https://pypi.org/project/cryptography/
+    :alt: Latest Version
+
+.. image:: https://readthedocs.org/projects/cryptography/badge/?version=latest
+    :target: https://cryptography.io
+    :alt: Latest Docs
+
+.. image:: https://github.com/pyca/cryptography/workflows/CI/badge.svg?branch=main
+    :target: https://github.com/pyca/cryptography/actions?query=workflow%3ACI+branch%3Amain
+
+
+``cryptography`` is a package which provides cryptographic recipes and
+primitives to Python developers. Our goal is for it to be your "cryptographic
+standard library". It supports Python 3.7+ and PyPy3 7.3.10+.
+
+``cryptography`` includes both high level recipes and low level interfaces to
+common cryptographic algorithms such as symmetric ciphers, message digests, and
+key derivation functions. For example, to encrypt something with
+``cryptography``'s high level symmetric encryption recipe:
+
+.. code-block:: pycon
+
+    >>> from cryptography.fernet import Fernet
+    >>> # Put this somewhere safe!
+    >>> key = Fernet.generate_key()
+    >>> f = Fernet(key)
+    >>> token = f.encrypt(b"A really secret message. Not for prying eyes.")
+    >>> token
+    b'...'
+    >>> f.decrypt(token)
+    b'A really secret message. Not for prying eyes.'
+
+You can find more information in the `documentation`_.
+
+You can install ``cryptography`` with:
+
+.. code-block:: console
+
+    $ pip install cryptography
+
+For full details see `the installation documentation`_.
+
+Discussion
+~~~~~~~~~~
+
+If you run into bugs, you can file them in our `issue tracker`_.
+
+We maintain a `cryptography-dev`_ mailing list for development discussion.
+
+You can also join ``#pyca`` on ``irc.libera.chat`` to ask questions or get
+involved.
+
+Security
+~~~~~~~~
+
+Need to report a security issue? Please consult our `security reporting`_
+documentation.
+
+
+.. _`documentation`: https://cryptography.io/
+.. _`the installation documentation`: https://cryptography.io/en/latest/installation/
+.. _`issue tracker`: https://github.com/pyca/cryptography/issues
+.. _`cryptography-dev`: https://mail.python.org/mailman/listinfo/cryptography-dev
+.. _`security reporting`: https://cryptography.io/en/latest/security/
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..4482b051995a82bff8455d03c742a148ced27dba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/RECORD
@@ -0,0 +1,172 @@
+cryptography-41.0.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+cryptography-41.0.4.dist-info/LICENSE,sha256=Pgx8CRqUi4JTO6mP18u0BDLW8amsv4X1ki0vmak65rs,197
+cryptography-41.0.4.dist-info/LICENSE.APACHE,sha256=qsc7MUj20dcRHbyjIJn2jSbGRMaBOuHk8F9leaomY_4,11360
+cryptography-41.0.4.dist-info/LICENSE.BSD,sha256=YCxMdILeZHndLpeTzaJ15eY9dz2s0eymiSMqtwCPtPs,1532
+cryptography-41.0.4.dist-info/METADATA,sha256=1hloAgKAl3JBGLNieRRGHanEv5X6A1WYYajHMoDdmdI,5159
+cryptography-41.0.4.dist-info/RECORD,,
+cryptography-41.0.4.dist-info/WHEEL,sha256=w3wdY8NmJj3huITS1zpOfaItmPiN9HBpgqMYEQeoUWE,112
+cryptography-41.0.4.dist-info/top_level.txt,sha256=KNaT-Sn2K4uxNaEbe6mYdDn3qWDMlp4y-MtWfB73nJc,13
+cryptography/__about__.py,sha256=QoWTuIXfz5CTOnAMXDj5J9gWmaBajYMZHmfFyqeYRHE,445
+cryptography/__init__.py,sha256=iVPlBlXWTJyiFeRedxcbMPhyHB34viOM10d72vGnWuE,364
+cryptography/__pycache__/__about__.cpython-39.pyc,,
+cryptography/__pycache__/__init__.cpython-39.pyc,,
+cryptography/__pycache__/exceptions.cpython-39.pyc,,
+cryptography/__pycache__/fernet.cpython-39.pyc,,
+cryptography/__pycache__/utils.cpython-39.pyc,,
+cryptography/exceptions.py,sha256=EHe7XM2_OtdOM1bZE0ci-4GUhtOlEQ6fQXhK2Igf0qA,1118
+cryptography/fernet.py,sha256=TVZy4Dtkpl7kWIpvuKcNldE95IEjTQ0MfHgRsLdnDSM,6886
+cryptography/hazmat/__init__.py,sha256=5IwrLWrVp0AjEr_4FdWG_V057NSJGY_W4egNNsuct0g,455
+cryptography/hazmat/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/__pycache__/_oid.cpython-39.pyc,,
+cryptography/hazmat/_oid.py,sha256=gxhMHKpu9Xsi6uHCGZ_-soYMXj_izOIFaxjUKWbCPeE,14441
+cryptography/hazmat/backends/__init__.py,sha256=O5jvKFQdZnXhKeqJ-HtulaEL9Ni7mr1mDzZY5kHlYhI,361
+cryptography/hazmat/backends/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__init__.py,sha256=p3jmJfnCag9iE5sdMrN6VvVEu55u46xaS_IjoI0SrmA,305
+cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-39.pyc,,
+cryptography/hazmat/backends/openssl/aead.py,sha256=s3zXcVQf0COIOuOzI8usebWpznGnyZ7GhnmlJYu7QXA,15967
+cryptography/hazmat/backends/openssl/backend.py,sha256=sNMXDL0YPS9vdXFoufEDFOQJh_uMfpUnErd1j1Rdzf0,73231
+cryptography/hazmat/backends/openssl/ciphers.py,sha256=lxWrvnufudsDI2bpwNs2c8XLILbAE2j2rMSD1nhnPVg,10358
+cryptography/hazmat/backends/openssl/cmac.py,sha256=pHgQOIRfR4cIDa5ltcKFtgjqPTXbOLyRQmmqv9JlbUk,3035
+cryptography/hazmat/backends/openssl/decode_asn1.py,sha256=kz6gys8wuJhrx4QyU6enYx7UatNHr0LB3TI1jH3oQ54,1148
+cryptography/hazmat/backends/openssl/ec.py,sha256=GKzh3mZKvgsM1jqM88-4XikHHalpV-Efyskclt8yxYg,11474
+cryptography/hazmat/backends/openssl/rsa.py,sha256=P_ak-2zvA6VBt_P0ldzTSCUkcjo2GhYt_HLn8CVvWtE,21825
+cryptography/hazmat/backends/openssl/utils.py,sha256=UoguO26QzwN4lsMAltsIrgAlbi3SOeSrexZs1-QPNu8,2190
+cryptography/hazmat/bindings/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180
+cryptography/hazmat/bindings/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/bindings/_rust.abi3.so,sha256=u6KeftQRgZXGCq4NflTqz0FV3kfGGfcUi4Lz9boS0_U,13761152
+cryptography/hazmat/bindings/_rust/__init__.pyi,sha256=IumK7zP9Ko3HjLLb5hwZiY2rbfmfsuyTZLLcHOMvSdk,981
+cryptography/hazmat/bindings/_rust/_openssl.pyi,sha256=mpNJLuYLbCVrd5i33FBTmWwL_55Dw7JPkSLlSX9Q7oI,230
+cryptography/hazmat/bindings/_rust/asn1.pyi,sha256=9CyI-grOsLQB_hfnhJPoG9dNOdJ7Zg6B0iUpzCowh44,592
+cryptography/hazmat/bindings/_rust/exceptions.pyi,sha256=exXr2xw_0pB1kk93cYbM3MohbzoUkjOms1ZMUi0uQZE,640
+cryptography/hazmat/bindings/_rust/ocsp.pyi,sha256=RzVaLkY0y9L8W8opAL_uVD8bySKxP23pSQtEbLOStXI,905
+cryptography/hazmat/bindings/_rust/openssl/__init__.pyi,sha256=j764U4RRBZbDuOfjQxRqU7rCf74kgM-3AnTIjLdRy3E,970
+cryptography/hazmat/bindings/_rust/openssl/dh.pyi,sha256=0FVY1t5qM9HV_ZKDIcdJI2a72i1fHKyTvYIJb5UnH4M,896
+cryptography/hazmat/bindings/_rust/openssl/dsa.pyi,sha256=43in4PCsm2kz_H7RQFLBKqhDsUmb4yWop6dpYeVDg-4,764
+cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi,sha256=E2GXAgibfRGqKxskH8MfZI8gHFoMJJOTjG7Elg2gOww,629
+cryptography/hazmat/bindings/_rust/openssl/ed448.pyi,sha256=pk_kx5Biq8O53d2joOT-cXuwCrbFPicV7iaqYdeiIAI,603
+cryptography/hazmat/bindings/_rust/openssl/hashes.pyi,sha256=J8HoN0GdtPcjRAfNHr5Elva_nkmQfq63L75_z9dd8Uc,573
+cryptography/hazmat/bindings/_rust/openssl/hmac.pyi,sha256=ZmLJ73pmxcZFC1XosWEiXMRYtvJJor3ZLdCQOJu85Cw,662
+cryptography/hazmat/bindings/_rust/openssl/kdf.pyi,sha256=wPS5c7NLspM2632II0I4iH1RSxZvSRtBOVqmpyQATfk,544
+cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi,sha256=9iogF7Q4i81IkOS-IMXp6HvxFF_3cNy_ucrAjVQnn14,540
+cryptography/hazmat/bindings/_rust/openssl/x25519.pyi,sha256=-1F5QDZfrdhmDLKTeSERuuDUHBTV-EhxIYk9mjpwcG4,616
+cryptography/hazmat/bindings/_rust/openssl/x448.pyi,sha256=SdL4blscYBEvuWY4SuNAY1s5zFaGj38eQ-bulVBZvFg,590
+cryptography/hazmat/bindings/_rust/pkcs7.pyi,sha256=VkTC78wjJgb_qrboOYIFPuFZ3W46zsr6zsxnlrOMwao,460
+cryptography/hazmat/bindings/_rust/x509.pyi,sha256=j6AbXBZSXeJHLSrXnaapbiPfle-znfk9uJUa_zqxgy4,1878
+cryptography/hazmat/bindings/openssl/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180
+cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-39.pyc,,
+cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-39.pyc,,
+cryptography/hazmat/bindings/openssl/_conditional.py,sha256=DeECq7AKguhs390ZmxgItdqPLzyrKGJk-3KlHJMkXoY,9098
+cryptography/hazmat/bindings/openssl/binding.py,sha256=0x3kzvq2grHu4gbbgEIzEVrX6unp71EEs1hx0o-uuOM,6696
+cryptography/hazmat/primitives/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180
+cryptography/hazmat/primitives/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/_serialization.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/cmac.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/constant_time.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/hashes.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/hmac.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/keywrap.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/padding.cpython-39.pyc,,
+cryptography/hazmat/primitives/__pycache__/poly1305.cpython-39.pyc,,
+cryptography/hazmat/primitives/_asymmetric.py,sha256=RhgcouUB6HTiFDBrR1LxqkMjpUxIiNvQ1r_zJjRG6qQ,532
+cryptography/hazmat/primitives/_cipheralgorithm.py,sha256=7LPkpw-DrgyvmBMUjvXeBvojVZPtXhFgfelUftnxPGw,1093
+cryptography/hazmat/primitives/_serialization.py,sha256=U0DU0ZzOLJppCQsh9EJH6vGYoHotBolfNyRyx3wr1l0,5216
+cryptography/hazmat/primitives/asymmetric/__init__.py,sha256=s9oKCQ2ycFdXoERdS1imafueSkBsL9kvbyfghaauZ9Y,180
+cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-39.pyc,,
+cryptography/hazmat/primitives/asymmetric/dh.py,sha256=XsthqjvExWWOyePs0PxT4MestU9QeGuL-Hx7fWzTguQ,7013
+cryptography/hazmat/primitives/asymmetric/dsa.py,sha256=aaTY7EMLTzaWs-jhOMpMAfa2GnfhoqsCKZPKAs35L40,8263
+cryptography/hazmat/primitives/asymmetric/ec.py,sha256=L1WoWPYevJ6Pk2T1etbnHbvr6AeXFccckPNNiyUVoNM,12867
+cryptography/hazmat/primitives/asymmetric/ed25519.py,sha256=wl2NCCP4bZdUCqZGMkOOd6eaxjU1vXPAIwzUuFPE__w,3489
+cryptography/hazmat/primitives/asymmetric/ed448.py,sha256=2MCJ87qcyCCsjj0OvrfWFxPX8CgaC3d0mr78bt_vDIY,3440
+cryptography/hazmat/primitives/asymmetric/padding.py,sha256=6p8Ojiax_2tcm1aTnNOAkinriCJ67nSTxugg34f-hzk,2717
+cryptography/hazmat/primitives/asymmetric/rsa.py,sha256=vxvOryF00WL8mZQv9bs_-LlgobYLiPYfX246_j_ICtA,11623
+cryptography/hazmat/primitives/asymmetric/types.py,sha256=LnsOJym-wmPUJ7Knu_7bCNU3kIiELCd6krOaW_JU08I,2996
+cryptography/hazmat/primitives/asymmetric/utils.py,sha256=DPTs6T4F-UhwzFQTh-1fSEpQzazH2jf2xpIro3ItF4o,790
+cryptography/hazmat/primitives/asymmetric/x25519.py,sha256=8YJAIaU7w09jTnPU_cLwd98fMHIECgfA3R7P3Ktv-CA,3437
+cryptography/hazmat/primitives/asymmetric/x448.py,sha256=y-Yj-rgciiuH1g6FJLZftvAqgOnzT1on9gCisru7vBc,3358
+cryptography/hazmat/primitives/ciphers/__init__.py,sha256=kAyb9NSczqTrCWj0HEoVp3Cxo7AHW8ibPFQz-ZHsOtA,680
+cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-39.pyc,,
+cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-39.pyc,,
+cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-39.pyc,,
+cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-39.pyc,,
+cryptography/hazmat/primitives/ciphers/aead.py,sha256=DY7qKmbt0bgB1GB7i-fQrbjEfwFG8wfUfVHvc7DA2YY,12067
+cryptography/hazmat/primitives/ciphers/algorithms.py,sha256=SCDskXc9xyzsz0NjND6tAX8t17jYTbUB2sww1ub9GuY,5000
+cryptography/hazmat/primitives/ciphers/base.py,sha256=PqNDltHdDxBhLhgtfO707H07sSOLA6ZVwjZlalOJTAo,8286
+cryptography/hazmat/primitives/ciphers/modes.py,sha256=YJQXi4PJGIIZ1rgchbMH47Ed-YiUcUSjLPEOuV8rgGE,8361
+cryptography/hazmat/primitives/cmac.py,sha256=YaeWksCYaqVoqf9zHRThAJ95ZvPUioAOfXwZUWiPzD8,2065
+cryptography/hazmat/primitives/constant_time.py,sha256=xdunWT0nf8OvKdcqUhhlFKayGp4_PgVJRU2W1wLSr_A,422
+cryptography/hazmat/primitives/hashes.py,sha256=VJpnbK2sQN2bEqwRTOoCB4nuxYx5CnqFiScMJNyhsrI,5115
+cryptography/hazmat/primitives/hmac.py,sha256=RpB3z9z5skirCQrm7zQbtnp9pLMnAjrlTUvKqF5aDDc,423
+cryptography/hazmat/primitives/kdf/__init__.py,sha256=4XibZnrYq4hh5xBjWiIXzaYW6FKx8hPbVaa_cB9zS64,750
+cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-39.pyc,,
+cryptography/hazmat/primitives/kdf/concatkdf.py,sha256=wGYWgILmxQWnCPkbAH1RpsCHrdKgmYrCEVrCvXVGCo8,3726
+cryptography/hazmat/primitives/kdf/hkdf.py,sha256=bBYr1yUIbOlJIEd6ZoLYcXm_yd-H54An9kNcFIJ3kbo,3045
+cryptography/hazmat/primitives/kdf/kbkdf.py,sha256=qPL6TmDUmkus6CW3ylTJfG8N8egZhjQOyXrSyLLpnak,9232
+cryptography/hazmat/primitives/kdf/pbkdf2.py,sha256=1CCH9Q5gXUpnZd3c8d8bCXgpJ3s2hZZGBnuG7FH1waM,2012
+cryptography/hazmat/primitives/kdf/scrypt.py,sha256=4QONhjxA_ZtuQtQ7QV3FnbB8ftrFnM52B4HPfV7hFys,2354
+cryptography/hazmat/primitives/kdf/x963kdf.py,sha256=S3B4Enk2Yxj9txpairotaXkavuZqQ6t6MB5a28U02ek,2002
+cryptography/hazmat/primitives/keywrap.py,sha256=Qb_N2V_E1Dti5VtDXnrtTYtJDZ8aMpur8BY5yxrXclg,5678
+cryptography/hazmat/primitives/padding.py,sha256=8pCeLaqwQPSGf51j06U5C_INvgYWVWPv3m9mxUERGmU,6242
+cryptography/hazmat/primitives/poly1305.py,sha256=P5EPQV-RB_FJPahpg01u0Ts4S_PnAmsroxIGXbGeRRo,355
+cryptography/hazmat/primitives/serialization/__init__.py,sha256=6ZlL3EicEzoGdMOat86w8y_XICCnlHdCjFI97rMxRDg,1653
+cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-39.pyc,,
+cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-39.pyc,,
+cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-39.pyc,,
+cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-39.pyc,,
+cryptography/hazmat/primitives/serialization/base.py,sha256=VZjIIqnbb-x38qpg2Wf_IxZvqjsgcEzNQtQoeJiQfpw,1986
+cryptography/hazmat/primitives/serialization/pkcs12.py,sha256=NOzFxArlZhdjfgfugs8nERho1eyaxujXKGUKINchek4,6767
+cryptography/hazmat/primitives/serialization/pkcs7.py,sha256=BCvlPubXQOunb76emISK89PX9qXcBQI2CRPNe85VTZk,7392
+cryptography/hazmat/primitives/serialization/ssh.py,sha256=aLCYLPY3W1kerfCwadn5aYNzwcwIQl9c7RcsB8CKfuc,51027
+cryptography/hazmat/primitives/twofactor/__init__.py,sha256=tmMZGB-g4IU1r7lIFqASU019zr0uPp_wEBYcwdDCKCA,258
+cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-39.pyc,,
+cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-39.pyc,,
+cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-39.pyc,,
+cryptography/hazmat/primitives/twofactor/hotp.py,sha256=uZ0PSKYDZOL0aAobiw1Zd2HD0W2Ei1niUNC2v7Tnpc8,3010
+cryptography/hazmat/primitives/twofactor/totp.py,sha256=cMbWlAapOM1SfezEx9MoMHpCW9ingNXCg6OsGv4T8jc,1473
+cryptography/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+cryptography/utils.py,sha256=DfdXc9M4kmAboE2a0pPiISt5LVnW-jhhXURy8nDHae0,4018
+cryptography/x509/__init__.py,sha256=DzZE8bR-3iiVi3Wrcq7-g5Pm64fCr5aqsTNyi_rjJu0,7870
+cryptography/x509/__pycache__/__init__.cpython-39.pyc,,
+cryptography/x509/__pycache__/base.cpython-39.pyc,,
+cryptography/x509/__pycache__/certificate_transparency.cpython-39.pyc,,
+cryptography/x509/__pycache__/extensions.cpython-39.pyc,,
+cryptography/x509/__pycache__/general_name.cpython-39.pyc,,
+cryptography/x509/__pycache__/name.cpython-39.pyc,,
+cryptography/x509/__pycache__/ocsp.cpython-39.pyc,,
+cryptography/x509/__pycache__/oid.cpython-39.pyc,,
+cryptography/x509/base.py,sha256=FbS6EFE3uJ3O-zbFPRjsO6DckrNSN5TJNZMJcnzUWFQ,35677
+cryptography/x509/certificate_transparency.py,sha256=6HvzAD0dlSQVxy6tnDhGj0-pisp1MaJ9bxQNRr92inI,2261
+cryptography/x509/extensions.py,sha256=rFEcfZiFvcONs1ot03d68dAMK2U75w0s3g9mhyWBRcI,68365
+cryptography/x509/general_name.py,sha256=zm8GxNgVJuLD6rN488c5zdHhxp5gUxeRzw8enZMWDQ0,7868
+cryptography/x509/name.py,sha256=aZ2dpsinhkza3eTxT1vNmWuFMQ7fmcA0hs4npgnkf9Q,14855
+cryptography/x509/ocsp.py,sha256=48iW7xbZ9mZLELSEl7Wwjb4vYhOQ3KcNtqgKsAb_UD0,18534
+cryptography/x509/oid.py,sha256=fFosjGsnIB_w_0YrzZv1ggkSVwZl7xmY0zofKZNZkDA,829
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..e381d8dc248f7997f43ae3b40822c32fd46b8303
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.41.2)
+Root-Is-Purelib: false
+Tag: cp37-abi3-manylinux_2_28_x86_64
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0d38bc5ea2591b0363e24090a1631afa3da2c14e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography-41.0.4.dist-info/top_level.txt
@@ -0,0 +1 @@
+cryptography
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__about__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/__about__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a83d2d1d14b18722bc80ef83f6ea1e95793c0a47
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/__about__.py
@@ -0,0 +1,17 @@
+# 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 annotations
+
+__all__ = [
+    "__version__",
+    "__author__",
+    "__copyright__",
+]
+
+__version__ = "41.0.4"
+
+
+__author__ = "The Python Cryptographic Authority and individual contributors"
+__copyright__ = f"Copyright 2013-2023 {__author__}"
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..86b9a25726d121ce9fb202f627dbab73c83e297f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/__init__.py
@@ -0,0 +1,13 @@
+# 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 annotations
+
+from cryptography.__about__ import __author__, __copyright__, __version__
+
+__all__ = [
+    "__version__",
+    "__author__",
+    "__copyright__",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__about__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__about__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e0df4fd4109be1d650f1847977b563199a85b3b7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__about__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..38e5c75efb4d53bf0c04a83b7581ae1534eb6c33
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/exceptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/exceptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4091053b5528951f338a2d91b3f2324ca3296c93
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/exceptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/fernet.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/fernet.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b0d96e639e4d78bd6e8665afc646585a502e744b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/fernet.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dd2270f5042c2e4ad9fec5bba68a0fd49a658432
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/exceptions.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..47fdd18eeeb2d331b71d126b8a947e39ca66299c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/exceptions.py
@@ -0,0 +1,54 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.bindings._rust import exceptions as rust_exceptions
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+
+_Reasons = rust_exceptions._Reasons
+
+
+class UnsupportedAlgorithm(Exception):
+    def __init__(
+        self, message: str, reason: typing.Optional[_Reasons] = None
+    ) -> None:
+        super().__init__(message)
+        self._reason = reason
+
+
+class AlreadyFinalized(Exception):
+    pass
+
+
+class AlreadyUpdated(Exception):
+    pass
+
+
+class NotYetFinalized(Exception):
+    pass
+
+
+class InvalidTag(Exception):
+    pass
+
+
+class InvalidSignature(Exception):
+    pass
+
+
+class InternalError(Exception):
+    def __init__(
+        self, msg: str, err_code: typing.List[rust_openssl.OpenSSLError]
+    ) -> None:
+        super().__init__(msg)
+        self.err_code = err_code
+
+
+class InvalidKey(Exception):
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/fernet.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/fernet.py
new file mode 100644
index 0000000000000000000000000000000000000000..ad8fb40b9d44b55867750b4f7d161a4e9ce750ff
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/fernet.py
@@ -0,0 +1,221 @@
+# 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 annotations
+
+import base64
+import binascii
+import os
+import time
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import InvalidSignature
+from cryptography.hazmat.primitives import hashes, padding
+from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
+from cryptography.hazmat.primitives.hmac import HMAC
+
+
+class InvalidToken(Exception):
+    pass
+
+
+_MAX_CLOCK_SKEW = 60
+
+
+class Fernet:
+    def __init__(
+        self,
+        key: typing.Union[bytes, str],
+        backend: typing.Any = None,
+    ) -> None:
+        try:
+            key = base64.urlsafe_b64decode(key)
+        except binascii.Error as exc:
+            raise ValueError(
+                "Fernet key must be 32 url-safe base64-encoded bytes."
+            ) from exc
+        if len(key) != 32:
+            raise ValueError(
+                "Fernet key must be 32 url-safe base64-encoded bytes."
+            )
+
+        self._signing_key = key[:16]
+        self._encryption_key = key[16:]
+
+    @classmethod
+    def generate_key(cls) -> bytes:
+        return base64.urlsafe_b64encode(os.urandom(32))
+
+    def encrypt(self, data: bytes) -> bytes:
+        return self.encrypt_at_time(data, int(time.time()))
+
+    def encrypt_at_time(self, data: bytes, current_time: int) -> bytes:
+        iv = os.urandom(16)
+        return self._encrypt_from_parts(data, current_time, iv)
+
+    def _encrypt_from_parts(
+        self, data: bytes, current_time: int, iv: bytes
+    ) -> bytes:
+        utils._check_bytes("data", data)
+
+        padder = padding.PKCS7(algorithms.AES.block_size).padder()
+        padded_data = padder.update(data) + padder.finalize()
+        encryptor = Cipher(
+            algorithms.AES(self._encryption_key),
+            modes.CBC(iv),
+        ).encryptor()
+        ciphertext = encryptor.update(padded_data) + encryptor.finalize()
+
+        basic_parts = (
+            b"\x80"
+            + current_time.to_bytes(length=8, byteorder="big")
+            + iv
+            + ciphertext
+        )
+
+        h = HMAC(self._signing_key, hashes.SHA256())
+        h.update(basic_parts)
+        hmac = h.finalize()
+        return base64.urlsafe_b64encode(basic_parts + hmac)
+
+    def decrypt(
+        self, token: typing.Union[bytes, str], ttl: typing.Optional[int] = None
+    ) -> bytes:
+        timestamp, data = Fernet._get_unverified_token_data(token)
+        if ttl is None:
+            time_info = None
+        else:
+            time_info = (ttl, int(time.time()))
+        return self._decrypt_data(data, timestamp, time_info)
+
+    def decrypt_at_time(
+        self, token: typing.Union[bytes, str], ttl: int, current_time: int
+    ) -> bytes:
+        if ttl is None:
+            raise ValueError(
+                "decrypt_at_time() can only be used with a non-None ttl"
+            )
+        timestamp, data = Fernet._get_unverified_token_data(token)
+        return self._decrypt_data(data, timestamp, (ttl, current_time))
+
+    def extract_timestamp(self, token: typing.Union[bytes, str]) -> int:
+        timestamp, data = Fernet._get_unverified_token_data(token)
+        # Verify the token was not tampered with.
+        self._verify_signature(data)
+        return timestamp
+
+    @staticmethod
+    def _get_unverified_token_data(
+        token: typing.Union[bytes, str]
+    ) -> typing.Tuple[int, bytes]:
+        if not isinstance(token, (str, bytes)):
+            raise TypeError("token must be bytes or str")
+
+        try:
+            data = base64.urlsafe_b64decode(token)
+        except (TypeError, binascii.Error):
+            raise InvalidToken
+
+        if not data or data[0] != 0x80:
+            raise InvalidToken
+
+        if len(data) < 9:
+            raise InvalidToken
+
+        timestamp = int.from_bytes(data[1:9], byteorder="big")
+        return timestamp, data
+
+    def _verify_signature(self, data: bytes) -> None:
+        h = HMAC(self._signing_key, hashes.SHA256())
+        h.update(data[:-32])
+        try:
+            h.verify(data[-32:])
+        except InvalidSignature:
+            raise InvalidToken
+
+    def _decrypt_data(
+        self,
+        data: bytes,
+        timestamp: int,
+        time_info: typing.Optional[typing.Tuple[int, int]],
+    ) -> bytes:
+        if time_info is not None:
+            ttl, current_time = time_info
+            if timestamp + ttl < current_time:
+                raise InvalidToken
+
+            if current_time + _MAX_CLOCK_SKEW < timestamp:
+                raise InvalidToken
+
+        self._verify_signature(data)
+
+        iv = data[9:25]
+        ciphertext = data[25:-32]
+        decryptor = Cipher(
+            algorithms.AES(self._encryption_key), modes.CBC(iv)
+        ).decryptor()
+        plaintext_padded = decryptor.update(ciphertext)
+        try:
+            plaintext_padded += decryptor.finalize()
+        except ValueError:
+            raise InvalidToken
+        unpadder = padding.PKCS7(algorithms.AES.block_size).unpadder()
+
+        unpadded = unpadder.update(plaintext_padded)
+        try:
+            unpadded += unpadder.finalize()
+        except ValueError:
+            raise InvalidToken
+        return unpadded
+
+
+class MultiFernet:
+    def __init__(self, fernets: typing.Iterable[Fernet]):
+        fernets = list(fernets)
+        if not fernets:
+            raise ValueError(
+                "MultiFernet requires at least one Fernet instance"
+            )
+        self._fernets = fernets
+
+    def encrypt(self, msg: bytes) -> bytes:
+        return self.encrypt_at_time(msg, int(time.time()))
+
+    def encrypt_at_time(self, msg: bytes, current_time: int) -> bytes:
+        return self._fernets[0].encrypt_at_time(msg, current_time)
+
+    def rotate(self, msg: typing.Union[bytes, str]) -> bytes:
+        timestamp, data = Fernet._get_unverified_token_data(msg)
+        for f in self._fernets:
+            try:
+                p = f._decrypt_data(data, timestamp, None)
+                break
+            except InvalidToken:
+                pass
+        else:
+            raise InvalidToken
+
+        iv = os.urandom(16)
+        return self._fernets[0]._encrypt_from_parts(p, timestamp, iv)
+
+    def decrypt(
+        self, msg: typing.Union[bytes, str], ttl: typing.Optional[int] = None
+    ) -> bytes:
+        for f in self._fernets:
+            try:
+                return f.decrypt(msg, ttl)
+            except InvalidToken:
+                pass
+        raise InvalidToken
+
+    def decrypt_at_time(
+        self, msg: typing.Union[bytes, str], ttl: int, current_time: int
+    ) -> bytes:
+        for f in self._fernets:
+            try:
+                return f.decrypt_at_time(msg, ttl, current_time)
+            except InvalidToken:
+                pass
+        raise InvalidToken
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b9f1187011bdaa0720bc462564582393700f3d4a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__init__.py
@@ -0,0 +1,13 @@
+# 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 annotations
+
+"""
+Hazardous Materials
+
+This is a "Hazardous Materials" module. You should ONLY use it if you're
+100% absolutely sure that you know what you're doing because this module
+is full of land mines, dragons, and dinosaurs with laser guns.
+"""
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..78c9b8466059ea25daafbaa777cd8dd4c2b56032
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/_oid.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/_oid.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..460cbfaf539c66b0124f5a4bf06f4386c5541b17
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/__pycache__/_oid.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/_oid.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/_oid.py
new file mode 100644
index 0000000000000000000000000000000000000000..01d4b3406062ad68aa7b6c658e3c60b406ed6d80
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/_oid.py
@@ -0,0 +1,299 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.bindings._rust import (
+    ObjectIdentifier as ObjectIdentifier,
+)
+from cryptography.hazmat.primitives import hashes
+
+
+class ExtensionOID:
+    SUBJECT_DIRECTORY_ATTRIBUTES = ObjectIdentifier("2.5.29.9")
+    SUBJECT_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.14")
+    KEY_USAGE = ObjectIdentifier("2.5.29.15")
+    SUBJECT_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.17")
+    ISSUER_ALTERNATIVE_NAME = ObjectIdentifier("2.5.29.18")
+    BASIC_CONSTRAINTS = ObjectIdentifier("2.5.29.19")
+    NAME_CONSTRAINTS = ObjectIdentifier("2.5.29.30")
+    CRL_DISTRIBUTION_POINTS = ObjectIdentifier("2.5.29.31")
+    CERTIFICATE_POLICIES = ObjectIdentifier("2.5.29.32")
+    POLICY_MAPPINGS = ObjectIdentifier("2.5.29.33")
+    AUTHORITY_KEY_IDENTIFIER = ObjectIdentifier("2.5.29.35")
+    POLICY_CONSTRAINTS = ObjectIdentifier("2.5.29.36")
+    EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37")
+    FRESHEST_CRL = ObjectIdentifier("2.5.29.46")
+    INHIBIT_ANY_POLICY = ObjectIdentifier("2.5.29.54")
+    ISSUING_DISTRIBUTION_POINT = ObjectIdentifier("2.5.29.28")
+    AUTHORITY_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.1")
+    SUBJECT_INFORMATION_ACCESS = ObjectIdentifier("1.3.6.1.5.5.7.1.11")
+    OCSP_NO_CHECK = ObjectIdentifier("1.3.6.1.5.5.7.48.1.5")
+    TLS_FEATURE = ObjectIdentifier("1.3.6.1.5.5.7.1.24")
+    CRL_NUMBER = ObjectIdentifier("2.5.29.20")
+    DELTA_CRL_INDICATOR = ObjectIdentifier("2.5.29.27")
+    PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier(
+        "1.3.6.1.4.1.11129.2.4.2"
+    )
+    PRECERT_POISON = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.3")
+    SIGNED_CERTIFICATE_TIMESTAMPS = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.5")
+    MS_CERTIFICATE_TEMPLATE = ObjectIdentifier("1.3.6.1.4.1.311.21.7")
+
+
+class OCSPExtensionOID:
+    NONCE = ObjectIdentifier("1.3.6.1.5.5.7.48.1.2")
+    ACCEPTABLE_RESPONSES = ObjectIdentifier("1.3.6.1.5.5.7.48.1.4")
+
+
+class CRLEntryExtensionOID:
+    CERTIFICATE_ISSUER = ObjectIdentifier("2.5.29.29")
+    CRL_REASON = ObjectIdentifier("2.5.29.21")
+    INVALIDITY_DATE = ObjectIdentifier("2.5.29.24")
+
+
+class NameOID:
+    COMMON_NAME = ObjectIdentifier("2.5.4.3")
+    COUNTRY_NAME = ObjectIdentifier("2.5.4.6")
+    LOCALITY_NAME = ObjectIdentifier("2.5.4.7")
+    STATE_OR_PROVINCE_NAME = ObjectIdentifier("2.5.4.8")
+    STREET_ADDRESS = ObjectIdentifier("2.5.4.9")
+    ORGANIZATION_NAME = ObjectIdentifier("2.5.4.10")
+    ORGANIZATIONAL_UNIT_NAME = ObjectIdentifier("2.5.4.11")
+    SERIAL_NUMBER = ObjectIdentifier("2.5.4.5")
+    SURNAME = ObjectIdentifier("2.5.4.4")
+    GIVEN_NAME = ObjectIdentifier("2.5.4.42")
+    TITLE = ObjectIdentifier("2.5.4.12")
+    INITIALS = ObjectIdentifier("2.5.4.43")
+    GENERATION_QUALIFIER = ObjectIdentifier("2.5.4.44")
+    X500_UNIQUE_IDENTIFIER = ObjectIdentifier("2.5.4.45")
+    DN_QUALIFIER = ObjectIdentifier("2.5.4.46")
+    PSEUDONYM = ObjectIdentifier("2.5.4.65")
+    USER_ID = ObjectIdentifier("0.9.2342.19200300.100.1.1")
+    DOMAIN_COMPONENT = ObjectIdentifier("0.9.2342.19200300.100.1.25")
+    EMAIL_ADDRESS = ObjectIdentifier("1.2.840.113549.1.9.1")
+    JURISDICTION_COUNTRY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.3")
+    JURISDICTION_LOCALITY_NAME = ObjectIdentifier("1.3.6.1.4.1.311.60.2.1.1")
+    JURISDICTION_STATE_OR_PROVINCE_NAME = ObjectIdentifier(
+        "1.3.6.1.4.1.311.60.2.1.2"
+    )
+    BUSINESS_CATEGORY = ObjectIdentifier("2.5.4.15")
+    POSTAL_ADDRESS = ObjectIdentifier("2.5.4.16")
+    POSTAL_CODE = ObjectIdentifier("2.5.4.17")
+    INN = ObjectIdentifier("1.2.643.3.131.1.1")
+    OGRN = ObjectIdentifier("1.2.643.100.1")
+    SNILS = ObjectIdentifier("1.2.643.100.3")
+    UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2")
+
+
+class SignatureAlgorithmOID:
+    RSA_WITH_MD5 = ObjectIdentifier("1.2.840.113549.1.1.4")
+    RSA_WITH_SHA1 = ObjectIdentifier("1.2.840.113549.1.1.5")
+    # This is an alternate OID for RSA with SHA1 that is occasionally seen
+    _RSA_WITH_SHA1 = ObjectIdentifier("1.3.14.3.2.29")
+    RSA_WITH_SHA224 = ObjectIdentifier("1.2.840.113549.1.1.14")
+    RSA_WITH_SHA256 = ObjectIdentifier("1.2.840.113549.1.1.11")
+    RSA_WITH_SHA384 = ObjectIdentifier("1.2.840.113549.1.1.12")
+    RSA_WITH_SHA512 = ObjectIdentifier("1.2.840.113549.1.1.13")
+    RSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.13")
+    RSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.14")
+    RSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.15")
+    RSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.16")
+    RSASSA_PSS = ObjectIdentifier("1.2.840.113549.1.1.10")
+    ECDSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10045.4.1")
+    ECDSA_WITH_SHA224 = ObjectIdentifier("1.2.840.10045.4.3.1")
+    ECDSA_WITH_SHA256 = ObjectIdentifier("1.2.840.10045.4.3.2")
+    ECDSA_WITH_SHA384 = ObjectIdentifier("1.2.840.10045.4.3.3")
+    ECDSA_WITH_SHA512 = ObjectIdentifier("1.2.840.10045.4.3.4")
+    ECDSA_WITH_SHA3_224 = ObjectIdentifier("2.16.840.1.101.3.4.3.9")
+    ECDSA_WITH_SHA3_256 = ObjectIdentifier("2.16.840.1.101.3.4.3.10")
+    ECDSA_WITH_SHA3_384 = ObjectIdentifier("2.16.840.1.101.3.4.3.11")
+    ECDSA_WITH_SHA3_512 = ObjectIdentifier("2.16.840.1.101.3.4.3.12")
+    DSA_WITH_SHA1 = ObjectIdentifier("1.2.840.10040.4.3")
+    DSA_WITH_SHA224 = ObjectIdentifier("2.16.840.1.101.3.4.3.1")
+    DSA_WITH_SHA256 = ObjectIdentifier("2.16.840.1.101.3.4.3.2")
+    DSA_WITH_SHA384 = ObjectIdentifier("2.16.840.1.101.3.4.3.3")
+    DSA_WITH_SHA512 = ObjectIdentifier("2.16.840.1.101.3.4.3.4")
+    ED25519 = ObjectIdentifier("1.3.101.112")
+    ED448 = ObjectIdentifier("1.3.101.113")
+    GOSTR3411_94_WITH_3410_2001 = ObjectIdentifier("1.2.643.2.2.3")
+    GOSTR3410_2012_WITH_3411_2012_256 = ObjectIdentifier("1.2.643.7.1.1.3.2")
+    GOSTR3410_2012_WITH_3411_2012_512 = ObjectIdentifier("1.2.643.7.1.1.3.3")
+
+
+_SIG_OIDS_TO_HASH: typing.Dict[
+    ObjectIdentifier, typing.Optional[hashes.HashAlgorithm]
+] = {
+    SignatureAlgorithmOID.RSA_WITH_MD5: hashes.MD5(),
+    SignatureAlgorithmOID.RSA_WITH_SHA1: hashes.SHA1(),
+    SignatureAlgorithmOID._RSA_WITH_SHA1: hashes.SHA1(),
+    SignatureAlgorithmOID.RSA_WITH_SHA224: hashes.SHA224(),
+    SignatureAlgorithmOID.RSA_WITH_SHA256: hashes.SHA256(),
+    SignatureAlgorithmOID.RSA_WITH_SHA384: hashes.SHA384(),
+    SignatureAlgorithmOID.RSA_WITH_SHA512: hashes.SHA512(),
+    SignatureAlgorithmOID.RSA_WITH_SHA3_224: hashes.SHA3_224(),
+    SignatureAlgorithmOID.RSA_WITH_SHA3_256: hashes.SHA3_256(),
+    SignatureAlgorithmOID.RSA_WITH_SHA3_384: hashes.SHA3_384(),
+    SignatureAlgorithmOID.RSA_WITH_SHA3_512: hashes.SHA3_512(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA1: hashes.SHA1(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA224: hashes.SHA224(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA256: hashes.SHA256(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA384: hashes.SHA384(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA512: hashes.SHA512(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA3_224: hashes.SHA3_224(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA3_256: hashes.SHA3_256(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA3_384: hashes.SHA3_384(),
+    SignatureAlgorithmOID.ECDSA_WITH_SHA3_512: hashes.SHA3_512(),
+    SignatureAlgorithmOID.DSA_WITH_SHA1: hashes.SHA1(),
+    SignatureAlgorithmOID.DSA_WITH_SHA224: hashes.SHA224(),
+    SignatureAlgorithmOID.DSA_WITH_SHA256: hashes.SHA256(),
+    SignatureAlgorithmOID.ED25519: None,
+    SignatureAlgorithmOID.ED448: None,
+    SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: None,
+    SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: None,
+    SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: None,
+}
+
+
+class ExtendedKeyUsageOID:
+    SERVER_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.1")
+    CLIENT_AUTH = ObjectIdentifier("1.3.6.1.5.5.7.3.2")
+    CODE_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.3")
+    EMAIL_PROTECTION = ObjectIdentifier("1.3.6.1.5.5.7.3.4")
+    TIME_STAMPING = ObjectIdentifier("1.3.6.1.5.5.7.3.8")
+    OCSP_SIGNING = ObjectIdentifier("1.3.6.1.5.5.7.3.9")
+    ANY_EXTENDED_KEY_USAGE = ObjectIdentifier("2.5.29.37.0")
+    SMARTCARD_LOGON = ObjectIdentifier("1.3.6.1.4.1.311.20.2.2")
+    KERBEROS_PKINIT_KDC = ObjectIdentifier("1.3.6.1.5.2.3.5")
+    IPSEC_IKE = ObjectIdentifier("1.3.6.1.5.5.7.3.17")
+    CERTIFICATE_TRANSPARENCY = ObjectIdentifier("1.3.6.1.4.1.11129.2.4.4")
+
+
+class AuthorityInformationAccessOID:
+    CA_ISSUERS = ObjectIdentifier("1.3.6.1.5.5.7.48.2")
+    OCSP = ObjectIdentifier("1.3.6.1.5.5.7.48.1")
+
+
+class SubjectInformationAccessOID:
+    CA_REPOSITORY = ObjectIdentifier("1.3.6.1.5.5.7.48.5")
+
+
+class CertificatePoliciesOID:
+    CPS_QUALIFIER = ObjectIdentifier("1.3.6.1.5.5.7.2.1")
+    CPS_USER_NOTICE = ObjectIdentifier("1.3.6.1.5.5.7.2.2")
+    ANY_POLICY = ObjectIdentifier("2.5.29.32.0")
+
+
+class AttributeOID:
+    CHALLENGE_PASSWORD = ObjectIdentifier("1.2.840.113549.1.9.7")
+    UNSTRUCTURED_NAME = ObjectIdentifier("1.2.840.113549.1.9.2")
+
+
+_OID_NAMES = {
+    NameOID.COMMON_NAME: "commonName",
+    NameOID.COUNTRY_NAME: "countryName",
+    NameOID.LOCALITY_NAME: "localityName",
+    NameOID.STATE_OR_PROVINCE_NAME: "stateOrProvinceName",
+    NameOID.STREET_ADDRESS: "streetAddress",
+    NameOID.ORGANIZATION_NAME: "organizationName",
+    NameOID.ORGANIZATIONAL_UNIT_NAME: "organizationalUnitName",
+    NameOID.SERIAL_NUMBER: "serialNumber",
+    NameOID.SURNAME: "surname",
+    NameOID.GIVEN_NAME: "givenName",
+    NameOID.TITLE: "title",
+    NameOID.GENERATION_QUALIFIER: "generationQualifier",
+    NameOID.X500_UNIQUE_IDENTIFIER: "x500UniqueIdentifier",
+    NameOID.DN_QUALIFIER: "dnQualifier",
+    NameOID.PSEUDONYM: "pseudonym",
+    NameOID.USER_ID: "userID",
+    NameOID.DOMAIN_COMPONENT: "domainComponent",
+    NameOID.EMAIL_ADDRESS: "emailAddress",
+    NameOID.JURISDICTION_COUNTRY_NAME: "jurisdictionCountryName",
+    NameOID.JURISDICTION_LOCALITY_NAME: "jurisdictionLocalityName",
+    NameOID.JURISDICTION_STATE_OR_PROVINCE_NAME: (
+        "jurisdictionStateOrProvinceName"
+    ),
+    NameOID.BUSINESS_CATEGORY: "businessCategory",
+    NameOID.POSTAL_ADDRESS: "postalAddress",
+    NameOID.POSTAL_CODE: "postalCode",
+    NameOID.INN: "INN",
+    NameOID.OGRN: "OGRN",
+    NameOID.SNILS: "SNILS",
+    NameOID.UNSTRUCTURED_NAME: "unstructuredName",
+    SignatureAlgorithmOID.RSA_WITH_MD5: "md5WithRSAEncryption",
+    SignatureAlgorithmOID.RSA_WITH_SHA1: "sha1WithRSAEncryption",
+    SignatureAlgorithmOID.RSA_WITH_SHA224: "sha224WithRSAEncryption",
+    SignatureAlgorithmOID.RSA_WITH_SHA256: "sha256WithRSAEncryption",
+    SignatureAlgorithmOID.RSA_WITH_SHA384: "sha384WithRSAEncryption",
+    SignatureAlgorithmOID.RSA_WITH_SHA512: "sha512WithRSAEncryption",
+    SignatureAlgorithmOID.RSASSA_PSS: "RSASSA-PSS",
+    SignatureAlgorithmOID.ECDSA_WITH_SHA1: "ecdsa-with-SHA1",
+    SignatureAlgorithmOID.ECDSA_WITH_SHA224: "ecdsa-with-SHA224",
+    SignatureAlgorithmOID.ECDSA_WITH_SHA256: "ecdsa-with-SHA256",
+    SignatureAlgorithmOID.ECDSA_WITH_SHA384: "ecdsa-with-SHA384",
+    SignatureAlgorithmOID.ECDSA_WITH_SHA512: "ecdsa-with-SHA512",
+    SignatureAlgorithmOID.DSA_WITH_SHA1: "dsa-with-sha1",
+    SignatureAlgorithmOID.DSA_WITH_SHA224: "dsa-with-sha224",
+    SignatureAlgorithmOID.DSA_WITH_SHA256: "dsa-with-sha256",
+    SignatureAlgorithmOID.ED25519: "ed25519",
+    SignatureAlgorithmOID.ED448: "ed448",
+    SignatureAlgorithmOID.GOSTR3411_94_WITH_3410_2001: (
+        "GOST R 34.11-94 with GOST R 34.10-2001"
+    ),
+    SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_256: (
+        "GOST R 34.10-2012 with GOST R 34.11-2012 (256 bit)"
+    ),
+    SignatureAlgorithmOID.GOSTR3410_2012_WITH_3411_2012_512: (
+        "GOST R 34.10-2012 with GOST R 34.11-2012 (512 bit)"
+    ),
+    ExtendedKeyUsageOID.SERVER_AUTH: "serverAuth",
+    ExtendedKeyUsageOID.CLIENT_AUTH: "clientAuth",
+    ExtendedKeyUsageOID.CODE_SIGNING: "codeSigning",
+    ExtendedKeyUsageOID.EMAIL_PROTECTION: "emailProtection",
+    ExtendedKeyUsageOID.TIME_STAMPING: "timeStamping",
+    ExtendedKeyUsageOID.OCSP_SIGNING: "OCSPSigning",
+    ExtendedKeyUsageOID.SMARTCARD_LOGON: "msSmartcardLogin",
+    ExtendedKeyUsageOID.KERBEROS_PKINIT_KDC: "pkInitKDC",
+    ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES: "subjectDirectoryAttributes",
+    ExtensionOID.SUBJECT_KEY_IDENTIFIER: "subjectKeyIdentifier",
+    ExtensionOID.KEY_USAGE: "keyUsage",
+    ExtensionOID.SUBJECT_ALTERNATIVE_NAME: "subjectAltName",
+    ExtensionOID.ISSUER_ALTERNATIVE_NAME: "issuerAltName",
+    ExtensionOID.BASIC_CONSTRAINTS: "basicConstraints",
+    ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS: (
+        "signedCertificateTimestampList"
+    ),
+    ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS: (
+        "signedCertificateTimestampList"
+    ),
+    ExtensionOID.PRECERT_POISON: "ctPoison",
+    ExtensionOID.MS_CERTIFICATE_TEMPLATE: "msCertificateTemplate",
+    CRLEntryExtensionOID.CRL_REASON: "cRLReason",
+    CRLEntryExtensionOID.INVALIDITY_DATE: "invalidityDate",
+    CRLEntryExtensionOID.CERTIFICATE_ISSUER: "certificateIssuer",
+    ExtensionOID.NAME_CONSTRAINTS: "nameConstraints",
+    ExtensionOID.CRL_DISTRIBUTION_POINTS: "cRLDistributionPoints",
+    ExtensionOID.CERTIFICATE_POLICIES: "certificatePolicies",
+    ExtensionOID.POLICY_MAPPINGS: "policyMappings",
+    ExtensionOID.AUTHORITY_KEY_IDENTIFIER: "authorityKeyIdentifier",
+    ExtensionOID.POLICY_CONSTRAINTS: "policyConstraints",
+    ExtensionOID.EXTENDED_KEY_USAGE: "extendedKeyUsage",
+    ExtensionOID.FRESHEST_CRL: "freshestCRL",
+    ExtensionOID.INHIBIT_ANY_POLICY: "inhibitAnyPolicy",
+    ExtensionOID.ISSUING_DISTRIBUTION_POINT: ("issuingDistributionPoint"),
+    ExtensionOID.AUTHORITY_INFORMATION_ACCESS: "authorityInfoAccess",
+    ExtensionOID.SUBJECT_INFORMATION_ACCESS: "subjectInfoAccess",
+    ExtensionOID.OCSP_NO_CHECK: "OCSPNoCheck",
+    ExtensionOID.CRL_NUMBER: "cRLNumber",
+    ExtensionOID.DELTA_CRL_INDICATOR: "deltaCRLIndicator",
+    ExtensionOID.TLS_FEATURE: "TLSFeature",
+    AuthorityInformationAccessOID.OCSP: "OCSP",
+    AuthorityInformationAccessOID.CA_ISSUERS: "caIssuers",
+    SubjectInformationAccessOID.CA_REPOSITORY: "caRepository",
+    CertificatePoliciesOID.CPS_QUALIFIER: "id-qt-cps",
+    CertificatePoliciesOID.CPS_USER_NOTICE: "id-qt-unotice",
+    OCSPExtensionOID.NONCE: "OCSPNonce",
+    AttributeOID.CHALLENGE_PASSWORD: "challengePassword",
+}
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b4400aa037451d10d6bcadd455dcf98f9b72e221
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__init__.py
@@ -0,0 +1,13 @@
+# 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 annotations
+
+from typing import Any
+
+
+def default_backend() -> Any:
+    from cryptography.hazmat.backends.openssl.backend import backend
+
+    return backend
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c0ff04e02d8b70ab58ccfe244aa080b39f0aac07
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..51b04476cbb7f4a98051f2fc55bcc1aa35e22d05
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__init__.py
@@ -0,0 +1,9 @@
+# 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 annotations
+
+from cryptography.hazmat.backends.openssl.backend import backend
+
+__all__ = ["backend"]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..65b1414c77028d6c079d64967f996d1c207c60fa
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dd756b303939ab071617a1faa00ec0bb260955a2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/aead.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c90e5d3881b4336168d75cc41499d49102731806
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/backend.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8a030a02e8756a51004f6f265f11a8a1f7a99f4c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ciphers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d63e433105cc9e060b9e250bb0b6dbaf901d491f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/cmac.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..909c9818fac2381d94a6501f94ee303ea8614a1a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/decode_asn1.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d20a2e2889340fb9960e40f440314b692224cb35
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/ec.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..197dc8835ef97427964ea8dd9a8bfa3b5348049f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/rsa.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9ec6d80e45aa42700a7501d3d34bc2258d8456ba
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/aead.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/aead.py
new file mode 100644
index 0000000000000000000000000000000000000000..b36f535f3f8fa6061b26f1b91ad7b9aeb85e0aa5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/aead.py
@@ -0,0 +1,527 @@
+# 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 annotations
+
+import typing
+
+from cryptography.exceptions import InvalidTag
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+    from cryptography.hazmat.primitives.ciphers.aead import (
+        AESCCM,
+        AESGCM,
+        AESOCB3,
+        AESSIV,
+        ChaCha20Poly1305,
+    )
+
+    _AEADTypes = typing.Union[
+        AESCCM, AESGCM, AESOCB3, AESSIV, ChaCha20Poly1305
+    ]
+
+
+def _is_evp_aead_supported_cipher(
+    backend: Backend, cipher: _AEADTypes
+) -> bool:
+    """
+    Checks whether the given cipher is supported through
+    EVP_AEAD rather than the normal OpenSSL EVP_CIPHER API.
+    """
+    from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
+
+    return backend._lib.Cryptography_HAS_EVP_AEAD and isinstance(
+        cipher, ChaCha20Poly1305
+    )
+
+
+def _aead_cipher_supported(backend: Backend, cipher: _AEADTypes) -> bool:
+    if _is_evp_aead_supported_cipher(backend, cipher):
+        return True
+    else:
+        cipher_name = _evp_cipher_cipher_name(cipher)
+        if backend._fips_enabled and cipher_name not in backend._fips_aead:
+            return False
+        # SIV isn't loaded through get_cipherbyname but instead a new fetch API
+        # only available in 3.0+. But if we know we're on 3.0+ then we know
+        # it's supported.
+        if cipher_name.endswith(b"-siv"):
+            return backend._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER == 1
+        else:
+            return (
+                backend._lib.EVP_get_cipherbyname(cipher_name)
+                != backend._ffi.NULL
+            )
+
+
+def _aead_create_ctx(
+    backend: Backend,
+    cipher: _AEADTypes,
+    key: bytes,
+):
+    if _is_evp_aead_supported_cipher(backend, cipher):
+        return _evp_aead_create_ctx(backend, cipher, key)
+    else:
+        return _evp_cipher_create_ctx(backend, cipher, key)
+
+
+def _encrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any = None,
+) -> bytes:
+    if _is_evp_aead_supported_cipher(backend, cipher):
+        return _evp_aead_encrypt(
+            backend, cipher, nonce, data, associated_data, tag_length, ctx
+        )
+    else:
+        return _evp_cipher_encrypt(
+            backend, cipher, nonce, data, associated_data, tag_length, ctx
+        )
+
+
+def _decrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any = None,
+) -> bytes:
+    if _is_evp_aead_supported_cipher(backend, cipher):
+        return _evp_aead_decrypt(
+            backend, cipher, nonce, data, associated_data, tag_length, ctx
+        )
+    else:
+        return _evp_cipher_decrypt(
+            backend, cipher, nonce, data, associated_data, tag_length, ctx
+        )
+
+
+def _evp_aead_create_ctx(
+    backend: Backend,
+    cipher: _AEADTypes,
+    key: bytes,
+    tag_len: typing.Optional[int] = None,
+):
+    aead_cipher = _evp_aead_get_cipher(backend, cipher)
+    assert aead_cipher is not None
+    key_ptr = backend._ffi.from_buffer(key)
+    tag_len = (
+        backend._lib.EVP_AEAD_DEFAULT_TAG_LENGTH
+        if tag_len is None
+        else tag_len
+    )
+    ctx = backend._lib.Cryptography_EVP_AEAD_CTX_new(
+        aead_cipher, key_ptr, len(key), tag_len
+    )
+    backend.openssl_assert(ctx != backend._ffi.NULL)
+    ctx = backend._ffi.gc(ctx, backend._lib.EVP_AEAD_CTX_free)
+    return ctx
+
+
+def _evp_aead_get_cipher(backend: Backend, cipher: _AEADTypes):
+    from cryptography.hazmat.primitives.ciphers.aead import (
+        ChaCha20Poly1305,
+    )
+
+    # Currently only ChaCha20-Poly1305 is supported using this API
+    assert isinstance(cipher, ChaCha20Poly1305)
+    return backend._lib.EVP_aead_chacha20_poly1305()
+
+
+def _evp_aead_encrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any,
+) -> bytes:
+    assert ctx is not None
+
+    aead_cipher = _evp_aead_get_cipher(backend, cipher)
+    assert aead_cipher is not None
+
+    out_len = backend._ffi.new("size_t *")
+    # max_out_len should be in_len plus the result of
+    # EVP_AEAD_max_overhead.
+    max_out_len = len(data) + backend._lib.EVP_AEAD_max_overhead(aead_cipher)
+    out_buf = backend._ffi.new("uint8_t[]", max_out_len)
+    data_ptr = backend._ffi.from_buffer(data)
+    nonce_ptr = backend._ffi.from_buffer(nonce)
+    aad = b"".join(associated_data)
+    aad_ptr = backend._ffi.from_buffer(aad)
+
+    res = backend._lib.EVP_AEAD_CTX_seal(
+        ctx,
+        out_buf,
+        out_len,
+        max_out_len,
+        nonce_ptr,
+        len(nonce),
+        data_ptr,
+        len(data),
+        aad_ptr,
+        len(aad),
+    )
+    backend.openssl_assert(res == 1)
+    encrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:]
+    return encrypted_data
+
+
+def _evp_aead_decrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any,
+) -> bytes:
+    if len(data) < tag_length:
+        raise InvalidTag
+
+    assert ctx is not None
+
+    out_len = backend._ffi.new("size_t *")
+    #  max_out_len should at least in_len
+    max_out_len = len(data)
+    out_buf = backend._ffi.new("uint8_t[]", max_out_len)
+    data_ptr = backend._ffi.from_buffer(data)
+    nonce_ptr = backend._ffi.from_buffer(nonce)
+    aad = b"".join(associated_data)
+    aad_ptr = backend._ffi.from_buffer(aad)
+
+    res = backend._lib.EVP_AEAD_CTX_open(
+        ctx,
+        out_buf,
+        out_len,
+        max_out_len,
+        nonce_ptr,
+        len(nonce),
+        data_ptr,
+        len(data),
+        aad_ptr,
+        len(aad),
+    )
+
+    if res == 0:
+        backend._consume_errors()
+        raise InvalidTag
+
+    decrypted_data = backend._ffi.buffer(out_buf, out_len[0])[:]
+    return decrypted_data
+
+
+_ENCRYPT = 1
+_DECRYPT = 0
+
+
+def _evp_cipher_cipher_name(cipher: _AEADTypes) -> bytes:
+    from cryptography.hazmat.primitives.ciphers.aead import (
+        AESCCM,
+        AESGCM,
+        AESOCB3,
+        AESSIV,
+        ChaCha20Poly1305,
+    )
+
+    if isinstance(cipher, ChaCha20Poly1305):
+        return b"chacha20-poly1305"
+    elif isinstance(cipher, AESCCM):
+        return f"aes-{len(cipher._key) * 8}-ccm".encode("ascii")
+    elif isinstance(cipher, AESOCB3):
+        return f"aes-{len(cipher._key) * 8}-ocb".encode("ascii")
+    elif isinstance(cipher, AESSIV):
+        return f"aes-{len(cipher._key) * 8 // 2}-siv".encode("ascii")
+    else:
+        assert isinstance(cipher, AESGCM)
+        return f"aes-{len(cipher._key) * 8}-gcm".encode("ascii")
+
+
+def _evp_cipher(cipher_name: bytes, backend: Backend):
+    if cipher_name.endswith(b"-siv"):
+        evp_cipher = backend._lib.EVP_CIPHER_fetch(
+            backend._ffi.NULL,
+            cipher_name,
+            backend._ffi.NULL,
+        )
+        backend.openssl_assert(evp_cipher != backend._ffi.NULL)
+        evp_cipher = backend._ffi.gc(evp_cipher, backend._lib.EVP_CIPHER_free)
+    else:
+        evp_cipher = backend._lib.EVP_get_cipherbyname(cipher_name)
+        backend.openssl_assert(evp_cipher != backend._ffi.NULL)
+
+    return evp_cipher
+
+
+def _evp_cipher_create_ctx(
+    backend: Backend,
+    cipher: _AEADTypes,
+    key: bytes,
+):
+    ctx = backend._lib.EVP_CIPHER_CTX_new()
+    backend.openssl_assert(ctx != backend._ffi.NULL)
+    ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free)
+    cipher_name = _evp_cipher_cipher_name(cipher)
+    evp_cipher = _evp_cipher(cipher_name, backend)
+    key_ptr = backend._ffi.from_buffer(key)
+    res = backend._lib.EVP_CipherInit_ex(
+        ctx,
+        evp_cipher,
+        backend._ffi.NULL,
+        key_ptr,
+        backend._ffi.NULL,
+        0,
+    )
+    backend.openssl_assert(res != 0)
+    return ctx
+
+
+def _evp_cipher_aead_setup(
+    backend: Backend,
+    cipher_name: bytes,
+    key: bytes,
+    nonce: bytes,
+    tag: typing.Optional[bytes],
+    tag_len: int,
+    operation: int,
+):
+    evp_cipher = _evp_cipher(cipher_name, backend)
+    ctx = backend._lib.EVP_CIPHER_CTX_new()
+    ctx = backend._ffi.gc(ctx, backend._lib.EVP_CIPHER_CTX_free)
+    res = backend._lib.EVP_CipherInit_ex(
+        ctx,
+        evp_cipher,
+        backend._ffi.NULL,
+        backend._ffi.NULL,
+        backend._ffi.NULL,
+        int(operation == _ENCRYPT),
+    )
+    backend.openssl_assert(res != 0)
+    # CCM requires the IVLEN to be set before calling SET_TAG on decrypt
+    res = backend._lib.EVP_CIPHER_CTX_ctrl(
+        ctx,
+        backend._lib.EVP_CTRL_AEAD_SET_IVLEN,
+        len(nonce),
+        backend._ffi.NULL,
+    )
+    backend.openssl_assert(res != 0)
+    if operation == _DECRYPT:
+        assert tag is not None
+        _evp_cipher_set_tag(backend, ctx, tag)
+    elif cipher_name.endswith(b"-ccm"):
+        res = backend._lib.EVP_CIPHER_CTX_ctrl(
+            ctx,
+            backend._lib.EVP_CTRL_AEAD_SET_TAG,
+            tag_len,
+            backend._ffi.NULL,
+        )
+        backend.openssl_assert(res != 0)
+
+    nonce_ptr = backend._ffi.from_buffer(nonce)
+    key_ptr = backend._ffi.from_buffer(key)
+    res = backend._lib.EVP_CipherInit_ex(
+        ctx,
+        backend._ffi.NULL,
+        backend._ffi.NULL,
+        key_ptr,
+        nonce_ptr,
+        int(operation == _ENCRYPT),
+    )
+    backend.openssl_assert(res != 0)
+    return ctx
+
+
+def _evp_cipher_set_tag(backend, ctx, tag: bytes) -> None:
+    tag_ptr = backend._ffi.from_buffer(tag)
+    res = backend._lib.EVP_CIPHER_CTX_ctrl(
+        ctx, backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag_ptr
+    )
+    backend.openssl_assert(res != 0)
+
+
+def _evp_cipher_set_nonce_operation(
+    backend, ctx, nonce: bytes, operation: int
+) -> None:
+    nonce_ptr = backend._ffi.from_buffer(nonce)
+    res = backend._lib.EVP_CipherInit_ex(
+        ctx,
+        backend._ffi.NULL,
+        backend._ffi.NULL,
+        backend._ffi.NULL,
+        nonce_ptr,
+        int(operation == _ENCRYPT),
+    )
+    backend.openssl_assert(res != 0)
+
+
+def _evp_cipher_set_length(backend: Backend, ctx, data_len: int) -> None:
+    intptr = backend._ffi.new("int *")
+    res = backend._lib.EVP_CipherUpdate(
+        ctx, backend._ffi.NULL, intptr, backend._ffi.NULL, data_len
+    )
+    backend.openssl_assert(res != 0)
+
+
+def _evp_cipher_process_aad(
+    backend: Backend, ctx, associated_data: bytes
+) -> None:
+    outlen = backend._ffi.new("int *")
+    a_data_ptr = backend._ffi.from_buffer(associated_data)
+    res = backend._lib.EVP_CipherUpdate(
+        ctx, backend._ffi.NULL, outlen, a_data_ptr, len(associated_data)
+    )
+    backend.openssl_assert(res != 0)
+
+
+def _evp_cipher_process_data(backend: Backend, ctx, data: bytes) -> bytes:
+    outlen = backend._ffi.new("int *")
+    buf = backend._ffi.new("unsigned char[]", len(data))
+    data_ptr = backend._ffi.from_buffer(data)
+    res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, data_ptr, len(data))
+    if res == 0:
+        # AES SIV can error here if the data is invalid on decrypt
+        backend._consume_errors()
+        raise InvalidTag
+    return backend._ffi.buffer(buf, outlen[0])[:]
+
+
+def _evp_cipher_encrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any = None,
+) -> bytes:
+    from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV
+
+    if ctx is None:
+        cipher_name = _evp_cipher_cipher_name(cipher)
+        ctx = _evp_cipher_aead_setup(
+            backend,
+            cipher_name,
+            cipher._key,
+            nonce,
+            None,
+            tag_length,
+            _ENCRYPT,
+        )
+    else:
+        _evp_cipher_set_nonce_operation(backend, ctx, nonce, _ENCRYPT)
+
+    # CCM requires us to pass the length of the data before processing
+    # anything.
+    # However calling this with any other AEAD results in an error
+    if isinstance(cipher, AESCCM):
+        _evp_cipher_set_length(backend, ctx, len(data))
+
+    for ad in associated_data:
+        _evp_cipher_process_aad(backend, ctx, ad)
+    processed_data = _evp_cipher_process_data(backend, ctx, data)
+    outlen = backend._ffi.new("int *")
+    # All AEADs we support besides OCB are streaming so they return nothing
+    # in finalization. OCB can return up to (16 byte block - 1) bytes so
+    # we need a buffer here too.
+    buf = backend._ffi.new("unsigned char[]", 16)
+    res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen)
+    backend.openssl_assert(res != 0)
+    processed_data += backend._ffi.buffer(buf, outlen[0])[:]
+    tag_buf = backend._ffi.new("unsigned char[]", tag_length)
+    res = backend._lib.EVP_CIPHER_CTX_ctrl(
+        ctx, backend._lib.EVP_CTRL_AEAD_GET_TAG, tag_length, tag_buf
+    )
+    backend.openssl_assert(res != 0)
+    tag = backend._ffi.buffer(tag_buf)[:]
+
+    if isinstance(cipher, AESSIV):
+        # RFC 5297 defines the output as IV || C, where the tag we generate
+        # is the "IV" and C is the ciphertext. This is the opposite of our
+        # other AEADs, which are Ciphertext || Tag
+        backend.openssl_assert(len(tag) == 16)
+        return tag + processed_data
+    else:
+        return processed_data + tag
+
+
+def _evp_cipher_decrypt(
+    backend: Backend,
+    cipher: _AEADTypes,
+    nonce: bytes,
+    data: bytes,
+    associated_data: typing.List[bytes],
+    tag_length: int,
+    ctx: typing.Any = None,
+) -> bytes:
+    from cryptography.hazmat.primitives.ciphers.aead import AESCCM, AESSIV
+
+    if len(data) < tag_length:
+        raise InvalidTag
+
+    if isinstance(cipher, AESSIV):
+        # RFC 5297 defines the output as IV || C, where the tag we generate
+        # is the "IV" and C is the ciphertext. This is the opposite of our
+        # other AEADs, which are Ciphertext || Tag
+        tag = data[:tag_length]
+        data = data[tag_length:]
+    else:
+        tag = data[-tag_length:]
+        data = data[:-tag_length]
+    if ctx is None:
+        cipher_name = _evp_cipher_cipher_name(cipher)
+        ctx = _evp_cipher_aead_setup(
+            backend,
+            cipher_name,
+            cipher._key,
+            nonce,
+            tag,
+            tag_length,
+            _DECRYPT,
+        )
+    else:
+        _evp_cipher_set_nonce_operation(backend, ctx, nonce, _DECRYPT)
+        _evp_cipher_set_tag(backend, ctx, tag)
+
+    # CCM requires us to pass the length of the data before processing
+    # anything.
+    # However calling this with any other AEAD results in an error
+    if isinstance(cipher, AESCCM):
+        _evp_cipher_set_length(backend, ctx, len(data))
+
+    for ad in associated_data:
+        _evp_cipher_process_aad(backend, ctx, ad)
+    # CCM has a different error path if the tag doesn't match. Errors are
+    # raised in Update and Final is irrelevant.
+    if isinstance(cipher, AESCCM):
+        outlen = backend._ffi.new("int *")
+        buf = backend._ffi.new("unsigned char[]", len(data))
+        d_ptr = backend._ffi.from_buffer(data)
+        res = backend._lib.EVP_CipherUpdate(ctx, buf, outlen, d_ptr, len(data))
+        if res != 1:
+            backend._consume_errors()
+            raise InvalidTag
+
+        processed_data = backend._ffi.buffer(buf, outlen[0])[:]
+    else:
+        processed_data = _evp_cipher_process_data(backend, ctx, data)
+        outlen = backend._ffi.new("int *")
+        # OCB can return up to 15 bytes (16 byte block - 1) in finalization
+        buf = backend._ffi.new("unsigned char[]", 16)
+        res = backend._lib.EVP_CipherFinal_ex(ctx, buf, outlen)
+        processed_data += backend._ffi.buffer(buf, outlen[0])[:]
+        if res == 0:
+            backend._consume_errors()
+            raise InvalidTag
+
+    return processed_data
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py
new file mode 100644
index 0000000000000000000000000000000000000000..02d51094cfe5f73da9cb8297cc44e943b0257dd1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/backend.py
@@ -0,0 +1,1935 @@
+# 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 annotations
+
+import collections
+import contextlib
+import itertools
+import typing
+from contextlib import contextmanager
+
+from cryptography import utils, x509
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.backends.openssl import aead
+from cryptography.hazmat.backends.openssl.ciphers import _CipherContext
+from cryptography.hazmat.backends.openssl.cmac import _CMACContext
+from cryptography.hazmat.backends.openssl.ec import (
+    _EllipticCurvePrivateKey,
+    _EllipticCurvePublicKey,
+)
+from cryptography.hazmat.backends.openssl.rsa import (
+    _RSAPrivateKey,
+    _RSAPublicKey,
+)
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.bindings.openssl import binding
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding
+from cryptography.hazmat.primitives.asymmetric import (
+    dh,
+    dsa,
+    ec,
+    ed448,
+    ed25519,
+    rsa,
+    x448,
+    x25519,
+)
+from cryptography.hazmat.primitives.asymmetric.padding import (
+    MGF1,
+    OAEP,
+    PSS,
+    PKCS1v15,
+)
+from cryptography.hazmat.primitives.asymmetric.types import (
+    PrivateKeyTypes,
+    PublicKeyTypes,
+)
+from cryptography.hazmat.primitives.ciphers import (
+    BlockCipherAlgorithm,
+    CipherAlgorithm,
+)
+from cryptography.hazmat.primitives.ciphers.algorithms import (
+    AES,
+    AES128,
+    AES256,
+    ARC4,
+    SM4,
+    Camellia,
+    ChaCha20,
+    TripleDES,
+    _BlowfishInternal,
+    _CAST5Internal,
+    _IDEAInternal,
+    _SEEDInternal,
+)
+from cryptography.hazmat.primitives.ciphers.modes import (
+    CBC,
+    CFB,
+    CFB8,
+    CTR,
+    ECB,
+    GCM,
+    OFB,
+    XTS,
+    Mode,
+)
+from cryptography.hazmat.primitives.serialization import ssh
+from cryptography.hazmat.primitives.serialization.pkcs12 import (
+    PBES,
+    PKCS12Certificate,
+    PKCS12KeyAndCertificates,
+    PKCS12PrivateKeyTypes,
+    _PKCS12CATypes,
+)
+
+_MemoryBIO = collections.namedtuple("_MemoryBIO", ["bio", "char_ptr"])
+
+
+# Not actually supported, just used as a marker for some serialization tests.
+class _RC2:
+    pass
+
+
+class Backend:
+    """
+    OpenSSL API binding interfaces.
+    """
+
+    name = "openssl"
+
+    # FIPS has opinions about acceptable algorithms and key sizes, but the
+    # disallowed algorithms are still present in OpenSSL. They just error if
+    # you try to use them. To avoid that we allowlist the algorithms in
+    # FIPS 140-3. This isn't ideal, but FIPS 140-3 is trash so here we are.
+    _fips_aead = {
+        b"aes-128-ccm",
+        b"aes-192-ccm",
+        b"aes-256-ccm",
+        b"aes-128-gcm",
+        b"aes-192-gcm",
+        b"aes-256-gcm",
+    }
+    # TripleDES encryption is disallowed/deprecated throughout 2023 in
+    # FIPS 140-3. To keep it simple we denylist any use of TripleDES (TDEA).
+    _fips_ciphers = (AES,)
+    # Sometimes SHA1 is still permissible. That logic is contained
+    # within the various *_supported methods.
+    _fips_hashes = (
+        hashes.SHA224,
+        hashes.SHA256,
+        hashes.SHA384,
+        hashes.SHA512,
+        hashes.SHA512_224,
+        hashes.SHA512_256,
+        hashes.SHA3_224,
+        hashes.SHA3_256,
+        hashes.SHA3_384,
+        hashes.SHA3_512,
+        hashes.SHAKE128,
+        hashes.SHAKE256,
+    )
+    _fips_ecdh_curves = (
+        ec.SECP224R1,
+        ec.SECP256R1,
+        ec.SECP384R1,
+        ec.SECP521R1,
+    )
+    _fips_rsa_min_key_size = 2048
+    _fips_rsa_min_public_exponent = 65537
+    _fips_dsa_min_modulus = 1 << 2048
+    _fips_dh_min_key_size = 2048
+    _fips_dh_min_modulus = 1 << _fips_dh_min_key_size
+
+    def __init__(self) -> None:
+        self._binding = binding.Binding()
+        self._ffi = self._binding.ffi
+        self._lib = self._binding.lib
+        self._fips_enabled = rust_openssl.is_fips_enabled()
+
+        self._cipher_registry: typing.Dict[
+            typing.Tuple[typing.Type[CipherAlgorithm], typing.Type[Mode]],
+            typing.Callable,
+        ] = {}
+        self._register_default_ciphers()
+        self._dh_types = [self._lib.EVP_PKEY_DH]
+        if self._lib.Cryptography_HAS_EVP_PKEY_DHX:
+            self._dh_types.append(self._lib.EVP_PKEY_DHX)
+
+    def __repr__(self) -> str:
+        return "<OpenSSLBackend(version: {}, FIPS: {}, Legacy: {})>".format(
+            self.openssl_version_text(),
+            self._fips_enabled,
+            self._binding._legacy_provider_loaded,
+        )
+
+    def openssl_assert(
+        self,
+        ok: bool,
+        errors: typing.Optional[typing.List[rust_openssl.OpenSSLError]] = None,
+    ) -> None:
+        return binding._openssl_assert(self._lib, ok, errors=errors)
+
+    def _enable_fips(self) -> None:
+        # This function enables FIPS mode for OpenSSL 3.0.0 on installs that
+        # have the FIPS provider installed properly.
+        self._binding._enable_fips()
+        assert rust_openssl.is_fips_enabled()
+        self._fips_enabled = rust_openssl.is_fips_enabled()
+
+    def openssl_version_text(self) -> str:
+        """
+        Friendly string name of the loaded OpenSSL library. This is not
+        necessarily the same version as it was compiled against.
+
+        Example: OpenSSL 1.1.1d  10 Sep 2019
+        """
+        return self._ffi.string(
+            self._lib.OpenSSL_version(self._lib.OPENSSL_VERSION)
+        ).decode("ascii")
+
+    def openssl_version_number(self) -> int:
+        return self._lib.OpenSSL_version_num()
+
+    def _evp_md_from_algorithm(self, algorithm: hashes.HashAlgorithm):
+        if algorithm.name == "blake2b" or algorithm.name == "blake2s":
+            alg = "{}{}".format(
+                algorithm.name, algorithm.digest_size * 8
+            ).encode("ascii")
+        else:
+            alg = algorithm.name.encode("ascii")
+
+        evp_md = self._lib.EVP_get_digestbyname(alg)
+        return evp_md
+
+    def _evp_md_non_null_from_algorithm(self, algorithm: hashes.HashAlgorithm):
+        evp_md = self._evp_md_from_algorithm(algorithm)
+        self.openssl_assert(evp_md != self._ffi.NULL)
+        return evp_md
+
+    def hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
+        if self._fips_enabled and not isinstance(algorithm, self._fips_hashes):
+            return False
+
+        evp_md = self._evp_md_from_algorithm(algorithm)
+        return evp_md != self._ffi.NULL
+
+    def signature_hash_supported(
+        self, algorithm: hashes.HashAlgorithm
+    ) -> bool:
+        # Dedicated check for hashing algorithm use in message digest for
+        # signatures, e.g. RSA PKCS#1 v1.5 SHA1 (sha1WithRSAEncryption).
+        if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
+            return False
+        return self.hash_supported(algorithm)
+
+    def scrypt_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        else:
+            return self._lib.Cryptography_HAS_SCRYPT == 1
+
+    def hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
+        # FIPS mode still allows SHA1 for HMAC
+        if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
+            return True
+
+        return self.hash_supported(algorithm)
+
+    def cipher_supported(self, cipher: CipherAlgorithm, mode: Mode) -> bool:
+        if self._fips_enabled:
+            # FIPS mode requires AES. TripleDES is disallowed/deprecated in
+            # FIPS 140-3.
+            if not isinstance(cipher, self._fips_ciphers):
+                return False
+
+        try:
+            adapter = self._cipher_registry[type(cipher), type(mode)]
+        except KeyError:
+            return False
+        evp_cipher = adapter(self, cipher, mode)
+        return self._ffi.NULL != evp_cipher
+
+    def register_cipher_adapter(self, cipher_cls, mode_cls, adapter) -> None:
+        if (cipher_cls, mode_cls) in self._cipher_registry:
+            raise ValueError(
+                "Duplicate registration for: {} {}.".format(
+                    cipher_cls, mode_cls
+                )
+            )
+        self._cipher_registry[cipher_cls, mode_cls] = adapter
+
+    def _register_default_ciphers(self) -> None:
+        for cipher_cls in [AES, AES128, AES256]:
+            for mode_cls in [CBC, CTR, ECB, OFB, CFB, CFB8, GCM]:
+                self.register_cipher_adapter(
+                    cipher_cls,
+                    mode_cls,
+                    GetCipherByName(
+                        "{cipher.name}-{cipher.key_size}-{mode.name}"
+                    ),
+                )
+        for mode_cls in [CBC, CTR, ECB, OFB, CFB]:
+            self.register_cipher_adapter(
+                Camellia,
+                mode_cls,
+                GetCipherByName("{cipher.name}-{cipher.key_size}-{mode.name}"),
+            )
+        for mode_cls in [CBC, CFB, CFB8, OFB]:
+            self.register_cipher_adapter(
+                TripleDES, mode_cls, GetCipherByName("des-ede3-{mode.name}")
+            )
+        self.register_cipher_adapter(
+            TripleDES, ECB, GetCipherByName("des-ede3")
+        )
+        self.register_cipher_adapter(
+            ChaCha20, type(None), GetCipherByName("chacha20")
+        )
+        self.register_cipher_adapter(AES, XTS, _get_xts_cipher)
+        for mode_cls in [ECB, CBC, OFB, CFB, CTR]:
+            self.register_cipher_adapter(
+                SM4, mode_cls, GetCipherByName("sm4-{mode.name}")
+            )
+        # Don't register legacy ciphers if they're unavailable. Hypothetically
+        # this wouldn't be necessary because we test availability by seeing if
+        # we get an EVP_CIPHER * in the _CipherContext __init__, but OpenSSL 3
+        # will return a valid pointer even though the cipher is unavailable.
+        if (
+            self._binding._legacy_provider_loaded
+            or not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER
+        ):
+            for mode_cls in [CBC, CFB, OFB, ECB]:
+                self.register_cipher_adapter(
+                    _BlowfishInternal,
+                    mode_cls,
+                    GetCipherByName("bf-{mode.name}"),
+                )
+            for mode_cls in [CBC, CFB, OFB, ECB]:
+                self.register_cipher_adapter(
+                    _SEEDInternal,
+                    mode_cls,
+                    GetCipherByName("seed-{mode.name}"),
+                )
+            for cipher_cls, mode_cls in itertools.product(
+                [_CAST5Internal, _IDEAInternal],
+                [CBC, OFB, CFB, ECB],
+            ):
+                self.register_cipher_adapter(
+                    cipher_cls,
+                    mode_cls,
+                    GetCipherByName("{cipher.name}-{mode.name}"),
+                )
+            self.register_cipher_adapter(
+                ARC4, type(None), GetCipherByName("rc4")
+            )
+            # We don't actually support RC2, this is just used by some tests.
+            self.register_cipher_adapter(
+                _RC2, type(None), GetCipherByName("rc2")
+            )
+
+    def create_symmetric_encryption_ctx(
+        self, cipher: CipherAlgorithm, mode: Mode
+    ) -> _CipherContext:
+        return _CipherContext(self, cipher, mode, _CipherContext._ENCRYPT)
+
+    def create_symmetric_decryption_ctx(
+        self, cipher: CipherAlgorithm, mode: Mode
+    ) -> _CipherContext:
+        return _CipherContext(self, cipher, mode, _CipherContext._DECRYPT)
+
+    def pbkdf2_hmac_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
+        return self.hmac_supported(algorithm)
+
+    def _consume_errors(self) -> typing.List[rust_openssl.OpenSSLError]:
+        return rust_openssl.capture_error_stack()
+
+    def _bn_to_int(self, bn) -> int:
+        assert bn != self._ffi.NULL
+        self.openssl_assert(not self._lib.BN_is_negative(bn))
+
+        bn_num_bytes = self._lib.BN_num_bytes(bn)
+        bin_ptr = self._ffi.new("unsigned char[]", bn_num_bytes)
+        bin_len = self._lib.BN_bn2bin(bn, bin_ptr)
+        # A zero length means the BN has value 0
+        self.openssl_assert(bin_len >= 0)
+        val = int.from_bytes(self._ffi.buffer(bin_ptr)[:bin_len], "big")
+        return val
+
+    def _int_to_bn(self, num: int):
+        """
+        Converts a python integer to a BIGNUM. The returned BIGNUM will not
+        be garbage collected (to support adding them to structs that take
+        ownership of the object). Be sure to register it for GC if it will
+        be discarded after use.
+        """
+        binary = num.to_bytes(int(num.bit_length() / 8.0 + 1), "big")
+        bn_ptr = self._lib.BN_bin2bn(binary, len(binary), self._ffi.NULL)
+        self.openssl_assert(bn_ptr != self._ffi.NULL)
+        return bn_ptr
+
+    def generate_rsa_private_key(
+        self, public_exponent: int, key_size: int
+    ) -> rsa.RSAPrivateKey:
+        rsa._verify_rsa_parameters(public_exponent, key_size)
+
+        rsa_cdata = self._lib.RSA_new()
+        self.openssl_assert(rsa_cdata != self._ffi.NULL)
+        rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+
+        bn = self._int_to_bn(public_exponent)
+        bn = self._ffi.gc(bn, self._lib.BN_free)
+
+        res = self._lib.RSA_generate_key_ex(
+            rsa_cdata, key_size, bn, self._ffi.NULL
+        )
+        self.openssl_assert(res == 1)
+        evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata)
+
+        # We can skip RSA key validation here since we just generated the key
+        return _RSAPrivateKey(
+            self, rsa_cdata, evp_pkey, unsafe_skip_rsa_key_validation=True
+        )
+
+    def generate_rsa_parameters_supported(
+        self, public_exponent: int, key_size: int
+    ) -> bool:
+        return (
+            public_exponent >= 3
+            and public_exponent & 1 != 0
+            and key_size >= 512
+        )
+
+    def load_rsa_private_numbers(
+        self,
+        numbers: rsa.RSAPrivateNumbers,
+        unsafe_skip_rsa_key_validation: bool,
+    ) -> rsa.RSAPrivateKey:
+        rsa._check_private_key_components(
+            numbers.p,
+            numbers.q,
+            numbers.d,
+            numbers.dmp1,
+            numbers.dmq1,
+            numbers.iqmp,
+            numbers.public_numbers.e,
+            numbers.public_numbers.n,
+        )
+        rsa_cdata = self._lib.RSA_new()
+        self.openssl_assert(rsa_cdata != self._ffi.NULL)
+        rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+        p = self._int_to_bn(numbers.p)
+        q = self._int_to_bn(numbers.q)
+        d = self._int_to_bn(numbers.d)
+        dmp1 = self._int_to_bn(numbers.dmp1)
+        dmq1 = self._int_to_bn(numbers.dmq1)
+        iqmp = self._int_to_bn(numbers.iqmp)
+        e = self._int_to_bn(numbers.public_numbers.e)
+        n = self._int_to_bn(numbers.public_numbers.n)
+        res = self._lib.RSA_set0_factors(rsa_cdata, p, q)
+        self.openssl_assert(res == 1)
+        res = self._lib.RSA_set0_key(rsa_cdata, n, e, d)
+        self.openssl_assert(res == 1)
+        res = self._lib.RSA_set0_crt_params(rsa_cdata, dmp1, dmq1, iqmp)
+        self.openssl_assert(res == 1)
+        evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata)
+
+        return _RSAPrivateKey(
+            self,
+            rsa_cdata,
+            evp_pkey,
+            unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation,
+        )
+
+    def load_rsa_public_numbers(
+        self, numbers: rsa.RSAPublicNumbers
+    ) -> rsa.RSAPublicKey:
+        rsa._check_public_key_components(numbers.e, numbers.n)
+        rsa_cdata = self._lib.RSA_new()
+        self.openssl_assert(rsa_cdata != self._ffi.NULL)
+        rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+        e = self._int_to_bn(numbers.e)
+        n = self._int_to_bn(numbers.n)
+        res = self._lib.RSA_set0_key(rsa_cdata, n, e, self._ffi.NULL)
+        self.openssl_assert(res == 1)
+        evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata)
+
+        return _RSAPublicKey(self, rsa_cdata, evp_pkey)
+
+    def _create_evp_pkey_gc(self):
+        evp_pkey = self._lib.EVP_PKEY_new()
+        self.openssl_assert(evp_pkey != self._ffi.NULL)
+        evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
+        return evp_pkey
+
+    def _rsa_cdata_to_evp_pkey(self, rsa_cdata):
+        evp_pkey = self._create_evp_pkey_gc()
+        res = self._lib.EVP_PKEY_set1_RSA(evp_pkey, rsa_cdata)
+        self.openssl_assert(res == 1)
+        return evp_pkey
+
+    def _bytes_to_bio(self, data: bytes) -> _MemoryBIO:
+        """
+        Return a _MemoryBIO namedtuple of (BIO, char*).
+
+        The char* is the storage for the BIO and it must stay alive until the
+        BIO is finished with.
+        """
+        data_ptr = self._ffi.from_buffer(data)
+        bio = self._lib.BIO_new_mem_buf(data_ptr, len(data))
+        self.openssl_assert(bio != self._ffi.NULL)
+
+        return _MemoryBIO(self._ffi.gc(bio, self._lib.BIO_free), data_ptr)
+
+    def _create_mem_bio_gc(self):
+        """
+        Creates an empty memory BIO.
+        """
+        bio_method = self._lib.BIO_s_mem()
+        self.openssl_assert(bio_method != self._ffi.NULL)
+        bio = self._lib.BIO_new(bio_method)
+        self.openssl_assert(bio != self._ffi.NULL)
+        bio = self._ffi.gc(bio, self._lib.BIO_free)
+        return bio
+
+    def _read_mem_bio(self, bio) -> bytes:
+        """
+        Reads a memory BIO. This only works on memory BIOs.
+        """
+        buf = self._ffi.new("char **")
+        buf_len = self._lib.BIO_get_mem_data(bio, buf)
+        self.openssl_assert(buf_len > 0)
+        self.openssl_assert(buf[0] != self._ffi.NULL)
+        bio_data = self._ffi.buffer(buf[0], buf_len)[:]
+        return bio_data
+
+    def _evp_pkey_to_private_key(
+        self, evp_pkey, unsafe_skip_rsa_key_validation: bool
+    ) -> PrivateKeyTypes:
+        """
+        Return the appropriate type of PrivateKey given an evp_pkey cdata
+        pointer.
+        """
+
+        key_type = self._lib.EVP_PKEY_id(evp_pkey)
+
+        if key_type == self._lib.EVP_PKEY_RSA:
+            rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey)
+            self.openssl_assert(rsa_cdata != self._ffi.NULL)
+            rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+            return _RSAPrivateKey(
+                self,
+                rsa_cdata,
+                evp_pkey,
+                unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation,
+            )
+        elif (
+            key_type == self._lib.EVP_PKEY_RSA_PSS
+            and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL
+            and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+            and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E
+        ):
+            # At the moment the way we handle RSA PSS keys is to strip the
+            # PSS constraints from them and treat them as normal RSA keys
+            # Unfortunately the RSA * itself tracks this data so we need to
+            # extract, serialize, and reload it without the constraints.
+            rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey)
+            self.openssl_assert(rsa_cdata != self._ffi.NULL)
+            rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+            bio = self._create_mem_bio_gc()
+            res = self._lib.i2d_RSAPrivateKey_bio(bio, rsa_cdata)
+            self.openssl_assert(res == 1)
+            return self.load_der_private_key(
+                self._read_mem_bio(bio),
+                password=None,
+                unsafe_skip_rsa_key_validation=unsafe_skip_rsa_key_validation,
+            )
+        elif key_type == self._lib.EVP_PKEY_DSA:
+            return rust_openssl.dsa.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == self._lib.EVP_PKEY_EC:
+            ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey)
+            self.openssl_assert(ec_cdata != self._ffi.NULL)
+            ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free)
+            return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey)
+        elif key_type in self._dh_types:
+            return rust_openssl.dh.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None):
+            # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.ed25519.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_X448", None):
+            # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.x448.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == self._lib.EVP_PKEY_X25519:
+            return rust_openssl.x25519.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None):
+            # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.ed448.private_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        else:
+            raise UnsupportedAlgorithm("Unsupported key type.")
+
+    def _evp_pkey_to_public_key(self, evp_pkey) -> PublicKeyTypes:
+        """
+        Return the appropriate type of PublicKey given an evp_pkey cdata
+        pointer.
+        """
+
+        key_type = self._lib.EVP_PKEY_id(evp_pkey)
+
+        if key_type == self._lib.EVP_PKEY_RSA:
+            rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey)
+            self.openssl_assert(rsa_cdata != self._ffi.NULL)
+            rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+            return _RSAPublicKey(self, rsa_cdata, evp_pkey)
+        elif (
+            key_type == self._lib.EVP_PKEY_RSA_PSS
+            and not self._lib.CRYPTOGRAPHY_IS_LIBRESSL
+            and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+            and not self._lib.CRYPTOGRAPHY_OPENSSL_LESS_THAN_111E
+        ):
+            rsa_cdata = self._lib.EVP_PKEY_get1_RSA(evp_pkey)
+            self.openssl_assert(rsa_cdata != self._ffi.NULL)
+            rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+            bio = self._create_mem_bio_gc()
+            res = self._lib.i2d_RSAPublicKey_bio(bio, rsa_cdata)
+            self.openssl_assert(res == 1)
+            return self.load_der_public_key(self._read_mem_bio(bio))
+        elif key_type == self._lib.EVP_PKEY_DSA:
+            return rust_openssl.dsa.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == self._lib.EVP_PKEY_EC:
+            ec_cdata = self._lib.EVP_PKEY_get1_EC_KEY(evp_pkey)
+            if ec_cdata == self._ffi.NULL:
+                errors = self._consume_errors()
+                raise ValueError("Unable to load EC key", errors)
+            ec_cdata = self._ffi.gc(ec_cdata, self._lib.EC_KEY_free)
+            return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey)
+        elif key_type in self._dh_types:
+            return rust_openssl.dh.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_ED25519", None):
+            # EVP_PKEY_ED25519 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.ed25519.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_X448", None):
+            # EVP_PKEY_X448 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.x448.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == self._lib.EVP_PKEY_X25519:
+            return rust_openssl.x25519.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        elif key_type == getattr(self._lib, "EVP_PKEY_ED448", None):
+            # EVP_PKEY_ED448 is not present in CRYPTOGRAPHY_IS_LIBRESSL
+            return rust_openssl.ed448.public_key_from_ptr(
+                int(self._ffi.cast("uintptr_t", evp_pkey))
+            )
+        else:
+            raise UnsupportedAlgorithm("Unsupported key type.")
+
+    def _oaep_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
+        if self._fips_enabled and isinstance(algorithm, hashes.SHA1):
+            return False
+
+        return isinstance(
+            algorithm,
+            (
+                hashes.SHA1,
+                hashes.SHA224,
+                hashes.SHA256,
+                hashes.SHA384,
+                hashes.SHA512,
+            ),
+        )
+
+    def rsa_padding_supported(self, padding: AsymmetricPadding) -> bool:
+        if isinstance(padding, PKCS1v15):
+            return True
+        elif isinstance(padding, PSS) and isinstance(padding._mgf, MGF1):
+            # SHA1 is permissible in MGF1 in FIPS even when SHA1 is blocked
+            # as signature algorithm.
+            if self._fips_enabled and isinstance(
+                padding._mgf._algorithm, hashes.SHA1
+            ):
+                return True
+            else:
+                return self.hash_supported(padding._mgf._algorithm)
+        elif isinstance(padding, OAEP) and isinstance(padding._mgf, MGF1):
+            return self._oaep_hash_supported(
+                padding._mgf._algorithm
+            ) and self._oaep_hash_supported(padding._algorithm)
+        else:
+            return False
+
+    def rsa_encryption_supported(self, padding: AsymmetricPadding) -> bool:
+        if self._fips_enabled and isinstance(padding, PKCS1v15):
+            return False
+        else:
+            return self.rsa_padding_supported(padding)
+
+    def generate_dsa_parameters(self, key_size: int) -> dsa.DSAParameters:
+        if key_size not in (1024, 2048, 3072, 4096):
+            raise ValueError(
+                "Key size must be 1024, 2048, 3072, or 4096 bits."
+            )
+
+        return rust_openssl.dsa.generate_parameters(key_size)
+
+    def generate_dsa_private_key(
+        self, parameters: dsa.DSAParameters
+    ) -> dsa.DSAPrivateKey:
+        return parameters.generate_private_key()
+
+    def generate_dsa_private_key_and_parameters(
+        self, key_size: int
+    ) -> dsa.DSAPrivateKey:
+        parameters = self.generate_dsa_parameters(key_size)
+        return self.generate_dsa_private_key(parameters)
+
+    def load_dsa_private_numbers(
+        self, numbers: dsa.DSAPrivateNumbers
+    ) -> dsa.DSAPrivateKey:
+        dsa._check_dsa_private_numbers(numbers)
+        return rust_openssl.dsa.from_private_numbers(numbers)
+
+    def load_dsa_public_numbers(
+        self, numbers: dsa.DSAPublicNumbers
+    ) -> dsa.DSAPublicKey:
+        dsa._check_dsa_parameters(numbers.parameter_numbers)
+        return rust_openssl.dsa.from_public_numbers(numbers)
+
+    def load_dsa_parameter_numbers(
+        self, numbers: dsa.DSAParameterNumbers
+    ) -> dsa.DSAParameters:
+        dsa._check_dsa_parameters(numbers)
+        return rust_openssl.dsa.from_parameter_numbers(numbers)
+
+    def dsa_supported(self) -> bool:
+        return (
+            not self._lib.CRYPTOGRAPHY_IS_BORINGSSL and not self._fips_enabled
+        )
+
+    def dsa_hash_supported(self, algorithm: hashes.HashAlgorithm) -> bool:
+        if not self.dsa_supported():
+            return False
+        return self.signature_hash_supported(algorithm)
+
+    def cmac_algorithm_supported(self, algorithm) -> bool:
+        return self.cipher_supported(
+            algorithm, CBC(b"\x00" * algorithm.block_size)
+        )
+
+    def create_cmac_ctx(self, algorithm: BlockCipherAlgorithm) -> _CMACContext:
+        return _CMACContext(self, algorithm)
+
+    def load_pem_private_key(
+        self,
+        data: bytes,
+        password: typing.Optional[bytes],
+        unsafe_skip_rsa_key_validation: bool,
+    ) -> PrivateKeyTypes:
+        return self._load_key(
+            self._lib.PEM_read_bio_PrivateKey,
+            data,
+            password,
+            unsafe_skip_rsa_key_validation,
+        )
+
+    def load_pem_public_key(self, data: bytes) -> PublicKeyTypes:
+        mem_bio = self._bytes_to_bio(data)
+        # In OpenSSL 3.0.x the PEM_read_bio_PUBKEY function will invoke
+        # the default password callback if you pass an encrypted private
+        # key. This is very, very, very bad as the default callback can
+        # trigger an interactive console prompt, which will hang the
+        # Python process. We therefore provide our own callback to
+        # catch this and error out properly.
+        userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *")
+        evp_pkey = self._lib.PEM_read_bio_PUBKEY(
+            mem_bio.bio,
+            self._ffi.NULL,
+            self._ffi.addressof(
+                self._lib._original_lib, "Cryptography_pem_password_cb"
+            ),
+            userdata,
+        )
+        if evp_pkey != self._ffi.NULL:
+            evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
+            return self._evp_pkey_to_public_key(evp_pkey)
+        else:
+            # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still
+            # need to check to see if it is a pure PKCS1 RSA public key (not
+            # embedded in a subjectPublicKeyInfo)
+            self._consume_errors()
+            res = self._lib.BIO_reset(mem_bio.bio)
+            self.openssl_assert(res == 1)
+            rsa_cdata = self._lib.PEM_read_bio_RSAPublicKey(
+                mem_bio.bio,
+                self._ffi.NULL,
+                self._ffi.addressof(
+                    self._lib._original_lib, "Cryptography_pem_password_cb"
+                ),
+                userdata,
+            )
+            if rsa_cdata != self._ffi.NULL:
+                rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+                evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata)
+                return _RSAPublicKey(self, rsa_cdata, evp_pkey)
+            else:
+                self._handle_key_loading_error()
+
+    def load_pem_parameters(self, data: bytes) -> dh.DHParameters:
+        return rust_openssl.dh.from_pem_parameters(data)
+
+    def load_der_private_key(
+        self,
+        data: bytes,
+        password: typing.Optional[bytes],
+        unsafe_skip_rsa_key_validation: bool,
+    ) -> PrivateKeyTypes:
+        # OpenSSL has a function called d2i_AutoPrivateKey that in theory
+        # handles this automatically, however it doesn't handle encrypted
+        # private keys. Instead we try to load the key two different ways.
+        # First we'll try to load it as a traditional key.
+        bio_data = self._bytes_to_bio(data)
+        key = self._evp_pkey_from_der_traditional_key(bio_data, password)
+        if key:
+            return self._evp_pkey_to_private_key(
+                key, unsafe_skip_rsa_key_validation
+            )
+        else:
+            # Finally we try to load it with the method that handles encrypted
+            # PKCS8 properly.
+            return self._load_key(
+                self._lib.d2i_PKCS8PrivateKey_bio,
+                data,
+                password,
+                unsafe_skip_rsa_key_validation,
+            )
+
+    def _evp_pkey_from_der_traditional_key(self, bio_data, password):
+        key = self._lib.d2i_PrivateKey_bio(bio_data.bio, self._ffi.NULL)
+        if key != self._ffi.NULL:
+            key = self._ffi.gc(key, self._lib.EVP_PKEY_free)
+            if password is not None:
+                raise TypeError(
+                    "Password was given but private key is not encrypted."
+                )
+
+            return key
+        else:
+            self._consume_errors()
+            return None
+
+    def load_der_public_key(self, data: bytes) -> PublicKeyTypes:
+        mem_bio = self._bytes_to_bio(data)
+        evp_pkey = self._lib.d2i_PUBKEY_bio(mem_bio.bio, self._ffi.NULL)
+        if evp_pkey != self._ffi.NULL:
+            evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
+            return self._evp_pkey_to_public_key(evp_pkey)
+        else:
+            # It's not a (RSA/DSA/ECDSA) subjectPublicKeyInfo, but we still
+            # need to check to see if it is a pure PKCS1 RSA public key (not
+            # embedded in a subjectPublicKeyInfo)
+            self._consume_errors()
+            res = self._lib.BIO_reset(mem_bio.bio)
+            self.openssl_assert(res == 1)
+            rsa_cdata = self._lib.d2i_RSAPublicKey_bio(
+                mem_bio.bio, self._ffi.NULL
+            )
+            if rsa_cdata != self._ffi.NULL:
+                rsa_cdata = self._ffi.gc(rsa_cdata, self._lib.RSA_free)
+                evp_pkey = self._rsa_cdata_to_evp_pkey(rsa_cdata)
+                return _RSAPublicKey(self, rsa_cdata, evp_pkey)
+            else:
+                self._handle_key_loading_error()
+
+    def load_der_parameters(self, data: bytes) -> dh.DHParameters:
+        return rust_openssl.dh.from_der_parameters(data)
+
+    def _cert2ossl(self, cert: x509.Certificate) -> typing.Any:
+        data = cert.public_bytes(serialization.Encoding.DER)
+        mem_bio = self._bytes_to_bio(data)
+        x509 = self._lib.d2i_X509_bio(mem_bio.bio, self._ffi.NULL)
+        self.openssl_assert(x509 != self._ffi.NULL)
+        x509 = self._ffi.gc(x509, self._lib.X509_free)
+        return x509
+
+    def _ossl2cert(self, x509_ptr: typing.Any) -> x509.Certificate:
+        bio = self._create_mem_bio_gc()
+        res = self._lib.i2d_X509_bio(bio, x509_ptr)
+        self.openssl_assert(res == 1)
+        return x509.load_der_x509_certificate(self._read_mem_bio(bio))
+
+    def _key2ossl(self, key: PKCS12PrivateKeyTypes) -> typing.Any:
+        data = key.private_bytes(
+            serialization.Encoding.DER,
+            serialization.PrivateFormat.PKCS8,
+            serialization.NoEncryption(),
+        )
+        mem_bio = self._bytes_to_bio(data)
+
+        evp_pkey = self._lib.d2i_PrivateKey_bio(
+            mem_bio.bio,
+            self._ffi.NULL,
+        )
+        self.openssl_assert(evp_pkey != self._ffi.NULL)
+        return self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
+
+    def _load_key(
+        self, openssl_read_func, data, password, unsafe_skip_rsa_key_validation
+    ) -> PrivateKeyTypes:
+        mem_bio = self._bytes_to_bio(data)
+
+        userdata = self._ffi.new("CRYPTOGRAPHY_PASSWORD_DATA *")
+        if password is not None:
+            utils._check_byteslike("password", password)
+            password_ptr = self._ffi.from_buffer(password)
+            userdata.password = password_ptr
+            userdata.length = len(password)
+
+        evp_pkey = openssl_read_func(
+            mem_bio.bio,
+            self._ffi.NULL,
+            self._ffi.addressof(
+                self._lib._original_lib, "Cryptography_pem_password_cb"
+            ),
+            userdata,
+        )
+
+        if evp_pkey == self._ffi.NULL:
+            if userdata.error != 0:
+                self._consume_errors()
+                if userdata.error == -1:
+                    raise TypeError(
+                        "Password was not given but private key is encrypted"
+                    )
+                else:
+                    assert userdata.error == -2
+                    raise ValueError(
+                        "Passwords longer than {} bytes are not supported "
+                        "by this backend.".format(userdata.maxsize - 1)
+                    )
+            else:
+                self._handle_key_loading_error()
+
+        evp_pkey = self._ffi.gc(evp_pkey, self._lib.EVP_PKEY_free)
+
+        if password is not None and userdata.called == 0:
+            raise TypeError(
+                "Password was given but private key is not encrypted."
+            )
+
+        assert (
+            password is not None and userdata.called == 1
+        ) or password is None
+
+        return self._evp_pkey_to_private_key(
+            evp_pkey, unsafe_skip_rsa_key_validation
+        )
+
+    def _handle_key_loading_error(self) -> typing.NoReturn:
+        errors = self._consume_errors()
+
+        if not errors:
+            raise ValueError(
+                "Could not deserialize key data. The data may be in an "
+                "incorrect format or it may be encrypted with an unsupported "
+                "algorithm."
+            )
+
+        elif (
+            errors[0]._lib_reason_match(
+                self._lib.ERR_LIB_EVP, self._lib.EVP_R_BAD_DECRYPT
+            )
+            or errors[0]._lib_reason_match(
+                self._lib.ERR_LIB_PKCS12,
+                self._lib.PKCS12_R_PKCS12_CIPHERFINAL_ERROR,
+            )
+            or (
+                self._lib.Cryptography_HAS_PROVIDERS
+                and errors[0]._lib_reason_match(
+                    self._lib.ERR_LIB_PROV,
+                    self._lib.PROV_R_BAD_DECRYPT,
+                )
+            )
+        ):
+            raise ValueError("Bad decrypt. Incorrect password?")
+
+        elif any(
+            error._lib_reason_match(
+                self._lib.ERR_LIB_EVP,
+                self._lib.EVP_R_UNSUPPORTED_PRIVATE_KEY_ALGORITHM,
+            )
+            for error in errors
+        ):
+            raise ValueError("Unsupported public key algorithm.")
+
+        else:
+            raise ValueError(
+                "Could not deserialize key data. The data may be in an "
+                "incorrect format, it may be encrypted with an unsupported "
+                "algorithm, or it may be an unsupported key type (e.g. EC "
+                "curves with explicit parameters).",
+                errors,
+            )
+
+    def elliptic_curve_supported(self, curve: ec.EllipticCurve) -> bool:
+        try:
+            curve_nid = self._elliptic_curve_to_nid(curve)
+        except UnsupportedAlgorithm:
+            curve_nid = self._lib.NID_undef
+
+        group = self._lib.EC_GROUP_new_by_curve_name(curve_nid)
+
+        if group == self._ffi.NULL:
+            self._consume_errors()
+            return False
+        else:
+            self.openssl_assert(curve_nid != self._lib.NID_undef)
+            self._lib.EC_GROUP_free(group)
+            return True
+
+    def elliptic_curve_signature_algorithm_supported(
+        self,
+        signature_algorithm: ec.EllipticCurveSignatureAlgorithm,
+        curve: ec.EllipticCurve,
+    ) -> bool:
+        # We only support ECDSA right now.
+        if not isinstance(signature_algorithm, ec.ECDSA):
+            return False
+
+        return self.elliptic_curve_supported(curve)
+
+    def generate_elliptic_curve_private_key(
+        self, curve: ec.EllipticCurve
+    ) -> ec.EllipticCurvePrivateKey:
+        """
+        Generate a new private key on the named curve.
+        """
+
+        if self.elliptic_curve_supported(curve):
+            ec_cdata = self._ec_key_new_by_curve(curve)
+
+            res = self._lib.EC_KEY_generate_key(ec_cdata)
+            self.openssl_assert(res == 1)
+
+            evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
+
+            return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey)
+        else:
+            raise UnsupportedAlgorithm(
+                f"Backend object does not support {curve.name}.",
+                _Reasons.UNSUPPORTED_ELLIPTIC_CURVE,
+            )
+
+    def load_elliptic_curve_private_numbers(
+        self, numbers: ec.EllipticCurvePrivateNumbers
+    ) -> ec.EllipticCurvePrivateKey:
+        public = numbers.public_numbers
+
+        ec_cdata = self._ec_key_new_by_curve(public.curve)
+
+        private_value = self._ffi.gc(
+            self._int_to_bn(numbers.private_value), self._lib.BN_clear_free
+        )
+        res = self._lib.EC_KEY_set_private_key(ec_cdata, private_value)
+        if res != 1:
+            self._consume_errors()
+            raise ValueError("Invalid EC key.")
+
+        with self._tmp_bn_ctx() as bn_ctx:
+            self._ec_key_set_public_key_affine_coordinates(
+                ec_cdata, public.x, public.y, bn_ctx
+            )
+            # derive the expected public point and compare it to the one we
+            # just set based on the values we were given. If they don't match
+            # this isn't a valid key pair.
+            group = self._lib.EC_KEY_get0_group(ec_cdata)
+            self.openssl_assert(group != self._ffi.NULL)
+            set_point = backend._lib.EC_KEY_get0_public_key(ec_cdata)
+            self.openssl_assert(set_point != self._ffi.NULL)
+            computed_point = self._lib.EC_POINT_new(group)
+            self.openssl_assert(computed_point != self._ffi.NULL)
+            computed_point = self._ffi.gc(
+                computed_point, self._lib.EC_POINT_free
+            )
+            res = self._lib.EC_POINT_mul(
+                group,
+                computed_point,
+                private_value,
+                self._ffi.NULL,
+                self._ffi.NULL,
+                bn_ctx,
+            )
+            self.openssl_assert(res == 1)
+            if (
+                self._lib.EC_POINT_cmp(
+                    group, set_point, computed_point, bn_ctx
+                )
+                != 0
+            ):
+                raise ValueError("Invalid EC key.")
+
+        evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
+
+        return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey)
+
+    def load_elliptic_curve_public_numbers(
+        self, numbers: ec.EllipticCurvePublicNumbers
+    ) -> ec.EllipticCurvePublicKey:
+        ec_cdata = self._ec_key_new_by_curve(numbers.curve)
+        with self._tmp_bn_ctx() as bn_ctx:
+            self._ec_key_set_public_key_affine_coordinates(
+                ec_cdata, numbers.x, numbers.y, bn_ctx
+            )
+        evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
+
+        return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey)
+
+    def load_elliptic_curve_public_bytes(
+        self, curve: ec.EllipticCurve, point_bytes: bytes
+    ) -> ec.EllipticCurvePublicKey:
+        ec_cdata = self._ec_key_new_by_curve(curve)
+        group = self._lib.EC_KEY_get0_group(ec_cdata)
+        self.openssl_assert(group != self._ffi.NULL)
+        point = self._lib.EC_POINT_new(group)
+        self.openssl_assert(point != self._ffi.NULL)
+        point = self._ffi.gc(point, self._lib.EC_POINT_free)
+        with self._tmp_bn_ctx() as bn_ctx:
+            res = self._lib.EC_POINT_oct2point(
+                group, point, point_bytes, len(point_bytes), bn_ctx
+            )
+            if res != 1:
+                self._consume_errors()
+                raise ValueError("Invalid public bytes for the given curve")
+
+        res = self._lib.EC_KEY_set_public_key(ec_cdata, point)
+        self.openssl_assert(res == 1)
+        evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
+        return _EllipticCurvePublicKey(self, ec_cdata, evp_pkey)
+
+    def derive_elliptic_curve_private_key(
+        self, private_value: int, curve: ec.EllipticCurve
+    ) -> ec.EllipticCurvePrivateKey:
+        ec_cdata = self._ec_key_new_by_curve(curve)
+
+        group = self._lib.EC_KEY_get0_group(ec_cdata)
+        self.openssl_assert(group != self._ffi.NULL)
+
+        point = self._lib.EC_POINT_new(group)
+        self.openssl_assert(point != self._ffi.NULL)
+        point = self._ffi.gc(point, self._lib.EC_POINT_free)
+
+        value = self._int_to_bn(private_value)
+        value = self._ffi.gc(value, self._lib.BN_clear_free)
+
+        with self._tmp_bn_ctx() as bn_ctx:
+            res = self._lib.EC_POINT_mul(
+                group, point, value, self._ffi.NULL, self._ffi.NULL, bn_ctx
+            )
+            self.openssl_assert(res == 1)
+
+            bn_x = self._lib.BN_CTX_get(bn_ctx)
+            bn_y = self._lib.BN_CTX_get(bn_ctx)
+
+            res = self._lib.EC_POINT_get_affine_coordinates(
+                group, point, bn_x, bn_y, bn_ctx
+            )
+            if res != 1:
+                self._consume_errors()
+                raise ValueError("Unable to derive key from private_value")
+
+        res = self._lib.EC_KEY_set_public_key(ec_cdata, point)
+        self.openssl_assert(res == 1)
+        private = self._int_to_bn(private_value)
+        private = self._ffi.gc(private, self._lib.BN_clear_free)
+        res = self._lib.EC_KEY_set_private_key(ec_cdata, private)
+        self.openssl_assert(res == 1)
+
+        evp_pkey = self._ec_cdata_to_evp_pkey(ec_cdata)
+
+        return _EllipticCurvePrivateKey(self, ec_cdata, evp_pkey)
+
+    def _ec_key_new_by_curve(self, curve: ec.EllipticCurve):
+        curve_nid = self._elliptic_curve_to_nid(curve)
+        return self._ec_key_new_by_curve_nid(curve_nid)
+
+    def _ec_key_new_by_curve_nid(self, curve_nid: int):
+        ec_cdata = self._lib.EC_KEY_new_by_curve_name(curve_nid)
+        self.openssl_assert(ec_cdata != self._ffi.NULL)
+        return self._ffi.gc(ec_cdata, self._lib.EC_KEY_free)
+
+    def elliptic_curve_exchange_algorithm_supported(
+        self, algorithm: ec.ECDH, curve: ec.EllipticCurve
+    ) -> bool:
+        if self._fips_enabled and not isinstance(
+            curve, self._fips_ecdh_curves
+        ):
+            return False
+
+        return self.elliptic_curve_supported(curve) and isinstance(
+            algorithm, ec.ECDH
+        )
+
+    def _ec_cdata_to_evp_pkey(self, ec_cdata):
+        evp_pkey = self._create_evp_pkey_gc()
+        res = self._lib.EVP_PKEY_set1_EC_KEY(evp_pkey, ec_cdata)
+        self.openssl_assert(res == 1)
+        return evp_pkey
+
+    def _elliptic_curve_to_nid(self, curve: ec.EllipticCurve) -> int:
+        """
+        Get the NID for a curve name.
+        """
+
+        curve_aliases = {"secp192r1": "prime192v1", "secp256r1": "prime256v1"}
+
+        curve_name = curve_aliases.get(curve.name, curve.name)
+
+        curve_nid = self._lib.OBJ_sn2nid(curve_name.encode())
+        if curve_nid == self._lib.NID_undef:
+            raise UnsupportedAlgorithm(
+                f"{curve.name} is not a supported elliptic curve",
+                _Reasons.UNSUPPORTED_ELLIPTIC_CURVE,
+            )
+        return curve_nid
+
+    @contextmanager
+    def _tmp_bn_ctx(self):
+        bn_ctx = self._lib.BN_CTX_new()
+        self.openssl_assert(bn_ctx != self._ffi.NULL)
+        bn_ctx = self._ffi.gc(bn_ctx, self._lib.BN_CTX_free)
+        self._lib.BN_CTX_start(bn_ctx)
+        try:
+            yield bn_ctx
+        finally:
+            self._lib.BN_CTX_end(bn_ctx)
+
+    def _ec_key_set_public_key_affine_coordinates(
+        self,
+        ec_cdata,
+        x: int,
+        y: int,
+        bn_ctx,
+    ) -> None:
+        """
+        Sets the public key point in the EC_KEY context to the affine x and y
+        values.
+        """
+
+        if x < 0 or y < 0:
+            raise ValueError(
+                "Invalid EC key. Both x and y must be non-negative."
+            )
+
+        x = self._ffi.gc(self._int_to_bn(x), self._lib.BN_free)
+        y = self._ffi.gc(self._int_to_bn(y), self._lib.BN_free)
+        group = self._lib.EC_KEY_get0_group(ec_cdata)
+        self.openssl_assert(group != self._ffi.NULL)
+        point = self._lib.EC_POINT_new(group)
+        self.openssl_assert(point != self._ffi.NULL)
+        point = self._ffi.gc(point, self._lib.EC_POINT_free)
+        res = self._lib.EC_POINT_set_affine_coordinates(
+            group, point, x, y, bn_ctx
+        )
+        if res != 1:
+            self._consume_errors()
+            raise ValueError("Invalid EC key.")
+        res = self._lib.EC_KEY_set_public_key(ec_cdata, point)
+        self.openssl_assert(res == 1)
+
+    def _private_key_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PrivateFormat,
+        encryption_algorithm: serialization.KeySerializationEncryption,
+        key,
+        evp_pkey,
+        cdata,
+    ) -> bytes:
+        # validate argument types
+        if not isinstance(encoding, serialization.Encoding):
+            raise TypeError("encoding must be an item from the Encoding enum")
+        if not isinstance(format, serialization.PrivateFormat):
+            raise TypeError(
+                "format must be an item from the PrivateFormat enum"
+            )
+        if not isinstance(
+            encryption_algorithm, serialization.KeySerializationEncryption
+        ):
+            raise TypeError(
+                "Encryption algorithm must be a KeySerializationEncryption "
+                "instance"
+            )
+
+        # validate password
+        if isinstance(encryption_algorithm, serialization.NoEncryption):
+            password = b""
+        elif isinstance(
+            encryption_algorithm, serialization.BestAvailableEncryption
+        ):
+            password = encryption_algorithm.password
+            if len(password) > 1023:
+                raise ValueError(
+                    "Passwords longer than 1023 bytes are not supported by "
+                    "this backend"
+                )
+        elif (
+            isinstance(
+                encryption_algorithm, serialization._KeySerializationEncryption
+            )
+            and encryption_algorithm._format
+            is format
+            is serialization.PrivateFormat.OpenSSH
+        ):
+            password = encryption_algorithm.password
+        else:
+            raise ValueError("Unsupported encryption type")
+
+        # PKCS8 + PEM/DER
+        if format is serialization.PrivateFormat.PKCS8:
+            if encoding is serialization.Encoding.PEM:
+                write_bio = self._lib.PEM_write_bio_PKCS8PrivateKey
+            elif encoding is serialization.Encoding.DER:
+                write_bio = self._lib.i2d_PKCS8PrivateKey_bio
+            else:
+                raise ValueError("Unsupported encoding for PKCS8")
+            return self._private_key_bytes_via_bio(
+                write_bio, evp_pkey, password
+            )
+
+        # TraditionalOpenSSL + PEM/DER
+        if format is serialization.PrivateFormat.TraditionalOpenSSL:
+            if self._fips_enabled and not isinstance(
+                encryption_algorithm, serialization.NoEncryption
+            ):
+                raise ValueError(
+                    "Encrypted traditional OpenSSL format is not "
+                    "supported in FIPS mode."
+                )
+            key_type = self._lib.EVP_PKEY_id(evp_pkey)
+
+            if encoding is serialization.Encoding.PEM:
+                if key_type == self._lib.EVP_PKEY_RSA:
+                    write_bio = self._lib.PEM_write_bio_RSAPrivateKey
+                else:
+                    assert key_type == self._lib.EVP_PKEY_EC
+                    write_bio = self._lib.PEM_write_bio_ECPrivateKey
+                return self._private_key_bytes_via_bio(
+                    write_bio, cdata, password
+                )
+
+            if encoding is serialization.Encoding.DER:
+                if password:
+                    raise ValueError(
+                        "Encryption is not supported for DER encoded "
+                        "traditional OpenSSL keys"
+                    )
+                if key_type == self._lib.EVP_PKEY_RSA:
+                    write_bio = self._lib.i2d_RSAPrivateKey_bio
+                else:
+                    assert key_type == self._lib.EVP_PKEY_EC
+                    write_bio = self._lib.i2d_ECPrivateKey_bio
+                return self._bio_func_output(write_bio, cdata)
+
+            raise ValueError("Unsupported encoding for TraditionalOpenSSL")
+
+        # OpenSSH + PEM
+        if format is serialization.PrivateFormat.OpenSSH:
+            if encoding is serialization.Encoding.PEM:
+                return ssh._serialize_ssh_private_key(
+                    key, password, encryption_algorithm
+                )
+
+            raise ValueError(
+                "OpenSSH private key format can only be used"
+                " with PEM encoding"
+            )
+
+        # Anything that key-specific code was supposed to handle earlier,
+        # like Raw.
+        raise ValueError("format is invalid with this key")
+
+    def _private_key_bytes_via_bio(
+        self, write_bio, evp_pkey, password
+    ) -> bytes:
+        if not password:
+            evp_cipher = self._ffi.NULL
+        else:
+            # This is a curated value that we will update over time.
+            evp_cipher = self._lib.EVP_get_cipherbyname(b"aes-256-cbc")
+
+        return self._bio_func_output(
+            write_bio,
+            evp_pkey,
+            evp_cipher,
+            password,
+            len(password),
+            self._ffi.NULL,
+            self._ffi.NULL,
+        )
+
+    def _bio_func_output(self, write_bio, *args) -> bytes:
+        bio = self._create_mem_bio_gc()
+        res = write_bio(bio, *args)
+        self.openssl_assert(res == 1)
+        return self._read_mem_bio(bio)
+
+    def _public_key_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PublicFormat,
+        key,
+        evp_pkey,
+        cdata,
+    ) -> bytes:
+        if not isinstance(encoding, serialization.Encoding):
+            raise TypeError("encoding must be an item from the Encoding enum")
+        if not isinstance(format, serialization.PublicFormat):
+            raise TypeError(
+                "format must be an item from the PublicFormat enum"
+            )
+
+        # SubjectPublicKeyInfo + PEM/DER
+        if format is serialization.PublicFormat.SubjectPublicKeyInfo:
+            if encoding is serialization.Encoding.PEM:
+                write_bio = self._lib.PEM_write_bio_PUBKEY
+            elif encoding is serialization.Encoding.DER:
+                write_bio = self._lib.i2d_PUBKEY_bio
+            else:
+                raise ValueError(
+                    "SubjectPublicKeyInfo works only with PEM or DER encoding"
+                )
+            return self._bio_func_output(write_bio, evp_pkey)
+
+        # PKCS1 + PEM/DER
+        if format is serialization.PublicFormat.PKCS1:
+            # Only RSA is supported here.
+            key_type = self._lib.EVP_PKEY_id(evp_pkey)
+            if key_type != self._lib.EVP_PKEY_RSA:
+                raise ValueError("PKCS1 format is supported only for RSA keys")
+
+            if encoding is serialization.Encoding.PEM:
+                write_bio = self._lib.PEM_write_bio_RSAPublicKey
+            elif encoding is serialization.Encoding.DER:
+                write_bio = self._lib.i2d_RSAPublicKey_bio
+            else:
+                raise ValueError("PKCS1 works only with PEM or DER encoding")
+            return self._bio_func_output(write_bio, cdata)
+
+        # OpenSSH + OpenSSH
+        if format is serialization.PublicFormat.OpenSSH:
+            if encoding is serialization.Encoding.OpenSSH:
+                return ssh.serialize_ssh_public_key(key)
+
+            raise ValueError(
+                "OpenSSH format must be used with OpenSSH encoding"
+            )
+
+        # Anything that key-specific code was supposed to handle earlier,
+        # like Raw, CompressedPoint, UncompressedPoint
+        raise ValueError("format is invalid with this key")
+
+    def dh_supported(self) -> bool:
+        return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+
+    def generate_dh_parameters(
+        self, generator: int, key_size: int
+    ) -> dh.DHParameters:
+        return rust_openssl.dh.generate_parameters(generator, key_size)
+
+    def generate_dh_private_key(
+        self, parameters: dh.DHParameters
+    ) -> dh.DHPrivateKey:
+        return parameters.generate_private_key()
+
+    def generate_dh_private_key_and_parameters(
+        self, generator: int, key_size: int
+    ) -> dh.DHPrivateKey:
+        return self.generate_dh_private_key(
+            self.generate_dh_parameters(generator, key_size)
+        )
+
+    def load_dh_private_numbers(
+        self, numbers: dh.DHPrivateNumbers
+    ) -> dh.DHPrivateKey:
+        return rust_openssl.dh.from_private_numbers(numbers)
+
+    def load_dh_public_numbers(
+        self, numbers: dh.DHPublicNumbers
+    ) -> dh.DHPublicKey:
+        return rust_openssl.dh.from_public_numbers(numbers)
+
+    def load_dh_parameter_numbers(
+        self, numbers: dh.DHParameterNumbers
+    ) -> dh.DHParameters:
+        return rust_openssl.dh.from_parameter_numbers(numbers)
+
+    def dh_parameters_supported(
+        self, p: int, g: int, q: typing.Optional[int] = None
+    ) -> bool:
+        try:
+            rust_openssl.dh.from_parameter_numbers(
+                dh.DHParameterNumbers(p=p, g=g, q=q)
+            )
+        except ValueError:
+            return False
+        else:
+            return True
+
+    def dh_x942_serialization_supported(self) -> bool:
+        return self._lib.Cryptography_HAS_EVP_PKEY_DHX == 1
+
+    def x25519_load_public_bytes(self, data: bytes) -> x25519.X25519PublicKey:
+        return rust_openssl.x25519.from_public_bytes(data)
+
+    def x25519_load_private_bytes(
+        self, data: bytes
+    ) -> x25519.X25519PrivateKey:
+        return rust_openssl.x25519.from_private_bytes(data)
+
+    def x25519_generate_key(self) -> x25519.X25519PrivateKey:
+        return rust_openssl.x25519.generate_key()
+
+    def x25519_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        return not self._lib.CRYPTOGRAPHY_LIBRESSL_LESS_THAN_370
+
+    def x448_load_public_bytes(self, data: bytes) -> x448.X448PublicKey:
+        return rust_openssl.x448.from_public_bytes(data)
+
+    def x448_load_private_bytes(self, data: bytes) -> x448.X448PrivateKey:
+        return rust_openssl.x448.from_private_bytes(data)
+
+    def x448_generate_key(self) -> x448.X448PrivateKey:
+        return rust_openssl.x448.generate_key()
+
+    def x448_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        return (
+            not self._lib.CRYPTOGRAPHY_IS_LIBRESSL
+            and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+        )
+
+    def ed25519_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        return self._lib.CRYPTOGRAPHY_HAS_WORKING_ED25519
+
+    def ed25519_load_public_bytes(
+        self, data: bytes
+    ) -> ed25519.Ed25519PublicKey:
+        return rust_openssl.ed25519.from_public_bytes(data)
+
+    def ed25519_load_private_bytes(
+        self, data: bytes
+    ) -> ed25519.Ed25519PrivateKey:
+        return rust_openssl.ed25519.from_private_bytes(data)
+
+    def ed25519_generate_key(self) -> ed25519.Ed25519PrivateKey:
+        return rust_openssl.ed25519.generate_key()
+
+    def ed448_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        return (
+            not self._lib.CRYPTOGRAPHY_IS_LIBRESSL
+            and not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+        )
+
+    def ed448_load_public_bytes(self, data: bytes) -> ed448.Ed448PublicKey:
+        return rust_openssl.ed448.from_public_bytes(data)
+
+    def ed448_load_private_bytes(self, data: bytes) -> ed448.Ed448PrivateKey:
+        return rust_openssl.ed448.from_private_bytes(data)
+
+    def ed448_generate_key(self) -> ed448.Ed448PrivateKey:
+        return rust_openssl.ed448.generate_key()
+
+    def aead_cipher_supported(self, cipher) -> bool:
+        return aead._aead_cipher_supported(self, cipher)
+
+    def _zero_data(self, data, length: int) -> None:
+        # We clear things this way because at the moment we're not
+        # sure of a better way that can guarantee it overwrites the
+        # memory of a bytearray and doesn't just replace the underlying char *.
+        for i in range(length):
+            data[i] = 0
+
+    @contextlib.contextmanager
+    def _zeroed_null_terminated_buf(self, data):
+        """
+        This method takes bytes, which can be a bytestring or a mutable
+        buffer like a bytearray, and yields a null-terminated version of that
+        data. This is required because PKCS12_parse doesn't take a length with
+        its password char * and ffi.from_buffer doesn't provide null
+        termination. So, to support zeroing the data via bytearray we
+        need to build this ridiculous construct that copies the memory, but
+        zeroes it after use.
+        """
+        if data is None:
+            yield self._ffi.NULL
+        else:
+            data_len = len(data)
+            buf = self._ffi.new("char[]", data_len + 1)
+            self._ffi.memmove(buf, data, data_len)
+            try:
+                yield buf
+            finally:
+                # Cast to a uint8_t * so we can assign by integer
+                self._zero_data(self._ffi.cast("uint8_t *", buf), data_len)
+
+    def load_key_and_certificates_from_pkcs12(
+        self, data: bytes, password: typing.Optional[bytes]
+    ) -> typing.Tuple[
+        typing.Optional[PrivateKeyTypes],
+        typing.Optional[x509.Certificate],
+        typing.List[x509.Certificate],
+    ]:
+        pkcs12 = self.load_pkcs12(data, password)
+        return (
+            pkcs12.key,
+            pkcs12.cert.certificate if pkcs12.cert else None,
+            [cert.certificate for cert in pkcs12.additional_certs],
+        )
+
+    def load_pkcs12(
+        self, data: bytes, password: typing.Optional[bytes]
+    ) -> PKCS12KeyAndCertificates:
+        if password is not None:
+            utils._check_byteslike("password", password)
+
+        bio = self._bytes_to_bio(data)
+        p12 = self._lib.d2i_PKCS12_bio(bio.bio, self._ffi.NULL)
+        if p12 == self._ffi.NULL:
+            self._consume_errors()
+            raise ValueError("Could not deserialize PKCS12 data")
+
+        p12 = self._ffi.gc(p12, self._lib.PKCS12_free)
+        evp_pkey_ptr = self._ffi.new("EVP_PKEY **")
+        x509_ptr = self._ffi.new("X509 **")
+        sk_x509_ptr = self._ffi.new("Cryptography_STACK_OF_X509 **")
+        with self._zeroed_null_terminated_buf(password) as password_buf:
+            res = self._lib.PKCS12_parse(
+                p12, password_buf, evp_pkey_ptr, x509_ptr, sk_x509_ptr
+            )
+        if res == 0:
+            self._consume_errors()
+            raise ValueError("Invalid password or PKCS12 data")
+
+        cert = None
+        key = None
+        additional_certificates = []
+
+        if evp_pkey_ptr[0] != self._ffi.NULL:
+            evp_pkey = self._ffi.gc(evp_pkey_ptr[0], self._lib.EVP_PKEY_free)
+            # We don't support turning off RSA key validation when loading
+            # PKCS12 keys
+            key = self._evp_pkey_to_private_key(
+                evp_pkey, unsafe_skip_rsa_key_validation=False
+            )
+
+        if x509_ptr[0] != self._ffi.NULL:
+            x509 = self._ffi.gc(x509_ptr[0], self._lib.X509_free)
+            cert_obj = self._ossl2cert(x509)
+            name = None
+            maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL)
+            if maybe_name != self._ffi.NULL:
+                name = self._ffi.string(maybe_name)
+            cert = PKCS12Certificate(cert_obj, name)
+
+        if sk_x509_ptr[0] != self._ffi.NULL:
+            sk_x509 = self._ffi.gc(sk_x509_ptr[0], self._lib.sk_X509_free)
+            num = self._lib.sk_X509_num(sk_x509_ptr[0])
+
+            # In OpenSSL < 3.0.0 PKCS12 parsing reverses the order of the
+            # certificates.
+            indices: typing.Iterable[int]
+            if (
+                self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER
+                or self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+            ):
+                indices = range(num)
+            else:
+                indices = reversed(range(num))
+
+            for i in indices:
+                x509 = self._lib.sk_X509_value(sk_x509, i)
+                self.openssl_assert(x509 != self._ffi.NULL)
+                x509 = self._ffi.gc(x509, self._lib.X509_free)
+                addl_cert = self._ossl2cert(x509)
+                addl_name = None
+                maybe_name = self._lib.X509_alias_get0(x509, self._ffi.NULL)
+                if maybe_name != self._ffi.NULL:
+                    addl_name = self._ffi.string(maybe_name)
+                additional_certificates.append(
+                    PKCS12Certificate(addl_cert, addl_name)
+                )
+
+        return PKCS12KeyAndCertificates(key, cert, additional_certificates)
+
+    def serialize_key_and_certificates_to_pkcs12(
+        self,
+        name: typing.Optional[bytes],
+        key: typing.Optional[PKCS12PrivateKeyTypes],
+        cert: typing.Optional[x509.Certificate],
+        cas: typing.Optional[typing.List[_PKCS12CATypes]],
+        encryption_algorithm: serialization.KeySerializationEncryption,
+    ) -> bytes:
+        password = None
+        if name is not None:
+            utils._check_bytes("name", name)
+
+        if isinstance(encryption_algorithm, serialization.NoEncryption):
+            nid_cert = -1
+            nid_key = -1
+            pkcs12_iter = 0
+            mac_iter = 0
+            mac_alg = self._ffi.NULL
+        elif isinstance(
+            encryption_algorithm, serialization.BestAvailableEncryption
+        ):
+            # PKCS12 encryption is hopeless trash and can never be fixed.
+            # OpenSSL 3 supports PBESv2, but Libre and Boring do not, so
+            # we use PBESv1 with 3DES on the older paths.
+            if self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER:
+                nid_cert = self._lib.NID_aes_256_cbc
+                nid_key = self._lib.NID_aes_256_cbc
+            else:
+                nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC
+                nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC
+            # At least we can set this higher than OpenSSL's default
+            pkcs12_iter = 20000
+            # mac_iter chosen for compatibility reasons, see:
+            # https://www.openssl.org/docs/man1.1.1/man3/PKCS12_create.html
+            # Did we mention how lousy PKCS12 encryption is?
+            mac_iter = 1
+            # MAC algorithm can only be set on OpenSSL 3.0.0+
+            mac_alg = self._ffi.NULL
+            password = encryption_algorithm.password
+        elif (
+            isinstance(
+                encryption_algorithm, serialization._KeySerializationEncryption
+            )
+            and encryption_algorithm._format
+            is serialization.PrivateFormat.PKCS12
+        ):
+            # Default to OpenSSL's defaults. Behavior will vary based on the
+            # version of OpenSSL cryptography is compiled against.
+            nid_cert = 0
+            nid_key = 0
+            # Use the default iters we use in best available
+            pkcs12_iter = 20000
+            # See the Best Available comment for why this is 1
+            mac_iter = 1
+            password = encryption_algorithm.password
+            keycertalg = encryption_algorithm._key_cert_algorithm
+            if keycertalg is PBES.PBESv1SHA1And3KeyTripleDESCBC:
+                nid_cert = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC
+                nid_key = self._lib.NID_pbe_WithSHA1And3_Key_TripleDES_CBC
+            elif keycertalg is PBES.PBESv2SHA256AndAES256CBC:
+                if not self._lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER:
+                    raise UnsupportedAlgorithm(
+                        "PBESv2 is not supported by this version of OpenSSL"
+                    )
+                nid_cert = self._lib.NID_aes_256_cbc
+                nid_key = self._lib.NID_aes_256_cbc
+            else:
+                assert keycertalg is None
+                # We use OpenSSL's defaults
+
+            if encryption_algorithm._hmac_hash is not None:
+                if not self._lib.Cryptography_HAS_PKCS12_SET_MAC:
+                    raise UnsupportedAlgorithm(
+                        "Setting MAC algorithm is not supported by this "
+                        "version of OpenSSL."
+                    )
+                mac_alg = self._evp_md_non_null_from_algorithm(
+                    encryption_algorithm._hmac_hash
+                )
+                self.openssl_assert(mac_alg != self._ffi.NULL)
+            else:
+                mac_alg = self._ffi.NULL
+
+            if encryption_algorithm._kdf_rounds is not None:
+                pkcs12_iter = encryption_algorithm._kdf_rounds
+
+        else:
+            raise ValueError("Unsupported key encryption type")
+
+        if cas is None or len(cas) == 0:
+            sk_x509 = self._ffi.NULL
+        else:
+            sk_x509 = self._lib.sk_X509_new_null()
+            sk_x509 = self._ffi.gc(sk_x509, self._lib.sk_X509_free)
+
+            # This list is to keep the x509 values alive until end of function
+            ossl_cas = []
+            for ca in cas:
+                if isinstance(ca, PKCS12Certificate):
+                    ca_alias = ca.friendly_name
+                    ossl_ca = self._cert2ossl(ca.certificate)
+                    if ca_alias is None:
+                        res = self._lib.X509_alias_set1(
+                            ossl_ca, self._ffi.NULL, -1
+                        )
+                    else:
+                        res = self._lib.X509_alias_set1(
+                            ossl_ca, ca_alias, len(ca_alias)
+                        )
+                    self.openssl_assert(res == 1)
+                else:
+                    ossl_ca = self._cert2ossl(ca)
+                ossl_cas.append(ossl_ca)
+                res = self._lib.sk_X509_push(sk_x509, ossl_ca)
+                backend.openssl_assert(res >= 1)
+
+        with self._zeroed_null_terminated_buf(password) as password_buf:
+            with self._zeroed_null_terminated_buf(name) as name_buf:
+                ossl_cert = self._cert2ossl(cert) if cert else self._ffi.NULL
+                ossl_pkey = (
+                    self._key2ossl(key) if key is not None else self._ffi.NULL
+                )
+
+                p12 = self._lib.PKCS12_create(
+                    password_buf,
+                    name_buf,
+                    ossl_pkey,
+                    ossl_cert,
+                    sk_x509,
+                    nid_key,
+                    nid_cert,
+                    pkcs12_iter,
+                    mac_iter,
+                    0,
+                )
+
+            if (
+                self._lib.Cryptography_HAS_PKCS12_SET_MAC
+                and mac_alg != self._ffi.NULL
+            ):
+                self._lib.PKCS12_set_mac(
+                    p12,
+                    password_buf,
+                    -1,
+                    self._ffi.NULL,
+                    0,
+                    mac_iter,
+                    mac_alg,
+                )
+
+        self.openssl_assert(p12 != self._ffi.NULL)
+        p12 = self._ffi.gc(p12, self._lib.PKCS12_free)
+
+        bio = self._create_mem_bio_gc()
+        res = self._lib.i2d_PKCS12_bio(bio, p12)
+        self.openssl_assert(res > 0)
+        return self._read_mem_bio(bio)
+
+    def poly1305_supported(self) -> bool:
+        if self._fips_enabled:
+            return False
+        return self._lib.Cryptography_HAS_POLY1305 == 1
+
+    def pkcs7_supported(self) -> bool:
+        return not self._lib.CRYPTOGRAPHY_IS_BORINGSSL
+
+    def load_pem_pkcs7_certificates(
+        self, data: bytes
+    ) -> typing.List[x509.Certificate]:
+        utils._check_bytes("data", data)
+        bio = self._bytes_to_bio(data)
+        p7 = self._lib.PEM_read_bio_PKCS7(
+            bio.bio, self._ffi.NULL, self._ffi.NULL, self._ffi.NULL
+        )
+        if p7 == self._ffi.NULL:
+            self._consume_errors()
+            raise ValueError("Unable to parse PKCS7 data")
+
+        p7 = self._ffi.gc(p7, self._lib.PKCS7_free)
+        return self._load_pkcs7_certificates(p7)
+
+    def load_der_pkcs7_certificates(
+        self, data: bytes
+    ) -> typing.List[x509.Certificate]:
+        utils._check_bytes("data", data)
+        bio = self._bytes_to_bio(data)
+        p7 = self._lib.d2i_PKCS7_bio(bio.bio, self._ffi.NULL)
+        if p7 == self._ffi.NULL:
+            self._consume_errors()
+            raise ValueError("Unable to parse PKCS7 data")
+
+        p7 = self._ffi.gc(p7, self._lib.PKCS7_free)
+        return self._load_pkcs7_certificates(p7)
+
+    def _load_pkcs7_certificates(self, p7) -> typing.List[x509.Certificate]:
+        nid = self._lib.OBJ_obj2nid(p7.type)
+        self.openssl_assert(nid != self._lib.NID_undef)
+        if nid != self._lib.NID_pkcs7_signed:
+            raise UnsupportedAlgorithm(
+                "Only basic signed structures are currently supported. NID"
+                " for this data was {}".format(nid),
+                _Reasons.UNSUPPORTED_SERIALIZATION,
+            )
+
+        sk_x509 = p7.d.sign.cert
+        num = self._lib.sk_X509_num(sk_x509)
+        certs = []
+        for i in range(num):
+            x509 = self._lib.sk_X509_value(sk_x509, i)
+            self.openssl_assert(x509 != self._ffi.NULL)
+            cert = self._ossl2cert(x509)
+            certs.append(cert)
+
+        return certs
+
+
+class GetCipherByName:
+    def __init__(self, fmt: str):
+        self._fmt = fmt
+
+    def __call__(self, backend: Backend, cipher: CipherAlgorithm, mode: Mode):
+        cipher_name = self._fmt.format(cipher=cipher, mode=mode).lower()
+        evp_cipher = backend._lib.EVP_get_cipherbyname(
+            cipher_name.encode("ascii")
+        )
+
+        # try EVP_CIPHER_fetch if present
+        if (
+            evp_cipher == backend._ffi.NULL
+            and backend._lib.Cryptography_HAS_300_EVP_CIPHER
+        ):
+            evp_cipher = backend._lib.EVP_CIPHER_fetch(
+                backend._ffi.NULL,
+                cipher_name.encode("ascii"),
+                backend._ffi.NULL,
+            )
+
+        backend._consume_errors()
+        return evp_cipher
+
+
+def _get_xts_cipher(backend: Backend, cipher: AES, mode):
+    cipher_name = f"aes-{cipher.key_size // 2}-xts"
+    return backend._lib.EVP_get_cipherbyname(cipher_name.encode("ascii"))
+
+
+backend = Backend()
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ciphers.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ciphers.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc42adbd49a52f21bae6594e364f212188332d27
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ciphers.py
@@ -0,0 +1,281 @@
+# 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 annotations
+
+import typing
+
+from cryptography.exceptions import InvalidTag, UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.primitives import ciphers
+from cryptography.hazmat.primitives.ciphers import algorithms, modes
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+
+
+class _CipherContext:
+    _ENCRYPT = 1
+    _DECRYPT = 0
+    _MAX_CHUNK_SIZE = 2**30 - 1
+
+    def __init__(self, backend: Backend, cipher, mode, operation: int) -> None:
+        self._backend = backend
+        self._cipher = cipher
+        self._mode = mode
+        self._operation = operation
+        self._tag: typing.Optional[bytes] = None
+
+        if isinstance(self._cipher, ciphers.BlockCipherAlgorithm):
+            self._block_size_bytes = self._cipher.block_size // 8
+        else:
+            self._block_size_bytes = 1
+
+        ctx = self._backend._lib.EVP_CIPHER_CTX_new()
+        ctx = self._backend._ffi.gc(
+            ctx, self._backend._lib.EVP_CIPHER_CTX_free
+        )
+
+        registry = self._backend._cipher_registry
+        try:
+            adapter = registry[type(cipher), type(mode)]
+        except KeyError:
+            raise UnsupportedAlgorithm(
+                "cipher {} in {} mode is not supported "
+                "by this backend.".format(
+                    cipher.name, mode.name if mode else mode
+                ),
+                _Reasons.UNSUPPORTED_CIPHER,
+            )
+
+        evp_cipher = adapter(self._backend, cipher, mode)
+        if evp_cipher == self._backend._ffi.NULL:
+            msg = f"cipher {cipher.name} "
+            if mode is not None:
+                msg += f"in {mode.name} mode "
+            msg += (
+                "is not supported by this backend (Your version of OpenSSL "
+                "may be too old. Current version: {}.)"
+            ).format(self._backend.openssl_version_text())
+            raise UnsupportedAlgorithm(msg, _Reasons.UNSUPPORTED_CIPHER)
+
+        if isinstance(mode, modes.ModeWithInitializationVector):
+            iv_nonce = self._backend._ffi.from_buffer(
+                mode.initialization_vector
+            )
+        elif isinstance(mode, modes.ModeWithTweak):
+            iv_nonce = self._backend._ffi.from_buffer(mode.tweak)
+        elif isinstance(mode, modes.ModeWithNonce):
+            iv_nonce = self._backend._ffi.from_buffer(mode.nonce)
+        elif isinstance(cipher, algorithms.ChaCha20):
+            iv_nonce = self._backend._ffi.from_buffer(cipher.nonce)
+        else:
+            iv_nonce = self._backend._ffi.NULL
+        # begin init with cipher and operation type
+        res = self._backend._lib.EVP_CipherInit_ex(
+            ctx,
+            evp_cipher,
+            self._backend._ffi.NULL,
+            self._backend._ffi.NULL,
+            self._backend._ffi.NULL,
+            operation,
+        )
+        self._backend.openssl_assert(res != 0)
+        # set the key length to handle variable key ciphers
+        res = self._backend._lib.EVP_CIPHER_CTX_set_key_length(
+            ctx, len(cipher.key)
+        )
+        self._backend.openssl_assert(res != 0)
+        if isinstance(mode, modes.GCM):
+            res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
+                ctx,
+                self._backend._lib.EVP_CTRL_AEAD_SET_IVLEN,
+                len(iv_nonce),
+                self._backend._ffi.NULL,
+            )
+            self._backend.openssl_assert(res != 0)
+            if mode.tag is not None:
+                res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
+                    ctx,
+                    self._backend._lib.EVP_CTRL_AEAD_SET_TAG,
+                    len(mode.tag),
+                    mode.tag,
+                )
+                self._backend.openssl_assert(res != 0)
+                self._tag = mode.tag
+
+        # pass key/iv
+        res = self._backend._lib.EVP_CipherInit_ex(
+            ctx,
+            self._backend._ffi.NULL,
+            self._backend._ffi.NULL,
+            self._backend._ffi.from_buffer(cipher.key),
+            iv_nonce,
+            operation,
+        )
+
+        # Check for XTS mode duplicate keys error
+        errors = self._backend._consume_errors()
+        lib = self._backend._lib
+        if res == 0 and (
+            (
+                not lib.CRYPTOGRAPHY_IS_LIBRESSL
+                and errors[0]._lib_reason_match(
+                    lib.ERR_LIB_EVP, lib.EVP_R_XTS_DUPLICATED_KEYS
+                )
+            )
+            or (
+                lib.Cryptography_HAS_PROVIDERS
+                and errors[0]._lib_reason_match(
+                    lib.ERR_LIB_PROV, lib.PROV_R_XTS_DUPLICATED_KEYS
+                )
+            )
+        ):
+            raise ValueError("In XTS mode duplicated keys are not allowed")
+
+        self._backend.openssl_assert(res != 0, errors=errors)
+
+        # We purposely disable padding here as it's handled higher up in the
+        # API.
+        self._backend._lib.EVP_CIPHER_CTX_set_padding(ctx, 0)
+        self._ctx = ctx
+
+    def update(self, data: bytes) -> bytes:
+        buf = bytearray(len(data) + self._block_size_bytes - 1)
+        n = self.update_into(data, buf)
+        return bytes(buf[:n])
+
+    def update_into(self, data: bytes, buf: bytes) -> int:
+        total_data_len = len(data)
+        if len(buf) < (total_data_len + self._block_size_bytes - 1):
+            raise ValueError(
+                "buffer must be at least {} bytes for this "
+                "payload".format(len(data) + self._block_size_bytes - 1)
+            )
+
+        data_processed = 0
+        total_out = 0
+        outlen = self._backend._ffi.new("int *")
+        baseoutbuf = self._backend._ffi.from_buffer(buf, require_writable=True)
+        baseinbuf = self._backend._ffi.from_buffer(data)
+
+        while data_processed != total_data_len:
+            outbuf = baseoutbuf + total_out
+            inbuf = baseinbuf + data_processed
+            inlen = min(self._MAX_CHUNK_SIZE, total_data_len - data_processed)
+
+            res = self._backend._lib.EVP_CipherUpdate(
+                self._ctx, outbuf, outlen, inbuf, inlen
+            )
+            if res == 0 and isinstance(self._mode, modes.XTS):
+                self._backend._consume_errors()
+                raise ValueError(
+                    "In XTS mode you must supply at least a full block in the "
+                    "first update call. For AES this is 16 bytes."
+                )
+            else:
+                self._backend.openssl_assert(res != 0)
+            data_processed += inlen
+            total_out += outlen[0]
+
+        return total_out
+
+    def finalize(self) -> bytes:
+        if (
+            self._operation == self._DECRYPT
+            and isinstance(self._mode, modes.ModeWithAuthenticationTag)
+            and self.tag is None
+        ):
+            raise ValueError(
+                "Authentication tag must be provided when decrypting."
+            )
+
+        buf = self._backend._ffi.new("unsigned char[]", self._block_size_bytes)
+        outlen = self._backend._ffi.new("int *")
+        res = self._backend._lib.EVP_CipherFinal_ex(self._ctx, buf, outlen)
+        if res == 0:
+            errors = self._backend._consume_errors()
+
+            if not errors and isinstance(self._mode, modes.GCM):
+                raise InvalidTag
+
+            lib = self._backend._lib
+            self._backend.openssl_assert(
+                errors[0]._lib_reason_match(
+                    lib.ERR_LIB_EVP,
+                    lib.EVP_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH,
+                )
+                or (
+                    lib.Cryptography_HAS_PROVIDERS
+                    and errors[0]._lib_reason_match(
+                        lib.ERR_LIB_PROV,
+                        lib.PROV_R_WRONG_FINAL_BLOCK_LENGTH,
+                    )
+                )
+                or (
+                    lib.CRYPTOGRAPHY_IS_BORINGSSL
+                    and errors[0].reason
+                    == lib.CIPHER_R_DATA_NOT_MULTIPLE_OF_BLOCK_LENGTH
+                ),
+                errors=errors,
+            )
+            raise ValueError(
+                "The length of the provided data is not a multiple of "
+                "the block length."
+            )
+
+        if (
+            isinstance(self._mode, modes.GCM)
+            and self._operation == self._ENCRYPT
+        ):
+            tag_buf = self._backend._ffi.new(
+                "unsigned char[]", self._block_size_bytes
+            )
+            res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
+                self._ctx,
+                self._backend._lib.EVP_CTRL_AEAD_GET_TAG,
+                self._block_size_bytes,
+                tag_buf,
+            )
+            self._backend.openssl_assert(res != 0)
+            self._tag = self._backend._ffi.buffer(tag_buf)[:]
+
+        res = self._backend._lib.EVP_CIPHER_CTX_reset(self._ctx)
+        self._backend.openssl_assert(res == 1)
+        return self._backend._ffi.buffer(buf)[: outlen[0]]
+
+    def finalize_with_tag(self, tag: bytes) -> bytes:
+        tag_len = len(tag)
+        if tag_len < self._mode._min_tag_length:
+            raise ValueError(
+                "Authentication tag must be {} bytes or longer.".format(
+                    self._mode._min_tag_length
+                )
+            )
+        elif tag_len > self._block_size_bytes:
+            raise ValueError(
+                "Authentication tag cannot be more than {} bytes.".format(
+                    self._block_size_bytes
+                )
+            )
+        res = self._backend._lib.EVP_CIPHER_CTX_ctrl(
+            self._ctx, self._backend._lib.EVP_CTRL_AEAD_SET_TAG, len(tag), tag
+        )
+        self._backend.openssl_assert(res != 0)
+        self._tag = tag
+        return self.finalize()
+
+    def authenticate_additional_data(self, data: bytes) -> None:
+        outlen = self._backend._ffi.new("int *")
+        res = self._backend._lib.EVP_CipherUpdate(
+            self._ctx,
+            self._backend._ffi.NULL,
+            outlen,
+            self._backend._ffi.from_buffer(data),
+            len(data),
+        )
+        self._backend.openssl_assert(res != 0)
+
+    @property
+    def tag(self) -> typing.Optional[bytes]:
+        return self._tag
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/cmac.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/cmac.py
new file mode 100644
index 0000000000000000000000000000000000000000..bdd7fec611d194ec50a3df3efab9adf34b6373e6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/cmac.py
@@ -0,0 +1,89 @@
+# 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 annotations
+
+import typing
+
+from cryptography.exceptions import (
+    InvalidSignature,
+    UnsupportedAlgorithm,
+    _Reasons,
+)
+from cryptography.hazmat.primitives import constant_time
+from cryptography.hazmat.primitives.ciphers.modes import CBC
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+    from cryptography.hazmat.primitives import ciphers
+
+
+class _CMACContext:
+    def __init__(
+        self,
+        backend: Backend,
+        algorithm: ciphers.BlockCipherAlgorithm,
+        ctx=None,
+    ) -> None:
+        if not backend.cmac_algorithm_supported(algorithm):
+            raise UnsupportedAlgorithm(
+                "This backend does not support CMAC.",
+                _Reasons.UNSUPPORTED_CIPHER,
+            )
+
+        self._backend = backend
+        self._key = algorithm.key
+        self._algorithm = algorithm
+        self._output_length = algorithm.block_size // 8
+
+        if ctx is None:
+            registry = self._backend._cipher_registry
+            adapter = registry[type(algorithm), CBC]
+
+            evp_cipher = adapter(self._backend, algorithm, CBC)
+
+            ctx = self._backend._lib.CMAC_CTX_new()
+
+            self._backend.openssl_assert(ctx != self._backend._ffi.NULL)
+            ctx = self._backend._ffi.gc(ctx, self._backend._lib.CMAC_CTX_free)
+
+            key_ptr = self._backend._ffi.from_buffer(self._key)
+            res = self._backend._lib.CMAC_Init(
+                ctx,
+                key_ptr,
+                len(self._key),
+                evp_cipher,
+                self._backend._ffi.NULL,
+            )
+            self._backend.openssl_assert(res == 1)
+
+        self._ctx = ctx
+
+    def update(self, data: bytes) -> None:
+        res = self._backend._lib.CMAC_Update(self._ctx, data, len(data))
+        self._backend.openssl_assert(res == 1)
+
+    def finalize(self) -> bytes:
+        buf = self._backend._ffi.new("unsigned char[]", self._output_length)
+        length = self._backend._ffi.new("size_t *", self._output_length)
+        res = self._backend._lib.CMAC_Final(self._ctx, buf, length)
+        self._backend.openssl_assert(res == 1)
+
+        self._ctx = None
+
+        return self._backend._ffi.buffer(buf)[:]
+
+    def copy(self) -> _CMACContext:
+        copied_ctx = self._backend._lib.CMAC_CTX_new()
+        copied_ctx = self._backend._ffi.gc(
+            copied_ctx, self._backend._lib.CMAC_CTX_free
+        )
+        res = self._backend._lib.CMAC_CTX_copy(copied_ctx, self._ctx)
+        self._backend.openssl_assert(res == 1)
+        return _CMACContext(self._backend, self._algorithm, ctx=copied_ctx)
+
+    def verify(self, signature: bytes) -> None:
+        digest = self.finalize()
+        if not constant_time.bytes_eq(digest, signature):
+            raise InvalidSignature("Signature did not match digest.")
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/decode_asn1.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/decode_asn1.py
new file mode 100644
index 0000000000000000000000000000000000000000..bf123b6285b64a5ac5a64c00c47975ea2285b9dc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/decode_asn1.py
@@ -0,0 +1,32 @@
+# 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 annotations
+
+from cryptography import x509
+
+#    CRLReason ::= ENUMERATED {
+#        unspecified             (0),
+#        keyCompromise           (1),
+#        cACompromise            (2),
+#        affiliationChanged      (3),
+#        superseded              (4),
+#        cessationOfOperation    (5),
+#        certificateHold         (6),
+#             -- value 7 is not used
+#        removeFromCRL           (8),
+#        privilegeWithdrawn      (9),
+#        aACompromise           (10) }
+_CRL_ENTRY_REASON_ENUM_TO_CODE = {
+    x509.ReasonFlags.unspecified: 0,
+    x509.ReasonFlags.key_compromise: 1,
+    x509.ReasonFlags.ca_compromise: 2,
+    x509.ReasonFlags.affiliation_changed: 3,
+    x509.ReasonFlags.superseded: 4,
+    x509.ReasonFlags.cessation_of_operation: 5,
+    x509.ReasonFlags.certificate_hold: 6,
+    x509.ReasonFlags.remove_from_crl: 8,
+    x509.ReasonFlags.privilege_withdrawn: 9,
+    x509.ReasonFlags.aa_compromise: 10,
+}
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ec.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ec.py
new file mode 100644
index 0000000000000000000000000000000000000000..9821bd193e2954a916e80140b832b958c8368914
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/ec.py
@@ -0,0 +1,328 @@
+# 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 annotations
+
+import typing
+
+from cryptography.exceptions import (
+    InvalidSignature,
+    UnsupportedAlgorithm,
+    _Reasons,
+)
+from cryptography.hazmat.backends.openssl.utils import (
+    _calculate_digest_and_algorithm,
+    _evp_pkey_derive,
+)
+from cryptography.hazmat.primitives import serialization
+from cryptography.hazmat.primitives.asymmetric import ec
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+
+
+def _check_signature_algorithm(
+    signature_algorithm: ec.EllipticCurveSignatureAlgorithm,
+) -> None:
+    if not isinstance(signature_algorithm, ec.ECDSA):
+        raise UnsupportedAlgorithm(
+            "Unsupported elliptic curve signature algorithm.",
+            _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+        )
+
+
+def _ec_key_curve_sn(backend: Backend, ec_key) -> str:
+    group = backend._lib.EC_KEY_get0_group(ec_key)
+    backend.openssl_assert(group != backend._ffi.NULL)
+
+    nid = backend._lib.EC_GROUP_get_curve_name(group)
+    # The following check is to find EC keys with unnamed curves and raise
+    # an error for now.
+    if nid == backend._lib.NID_undef:
+        raise ValueError(
+            "ECDSA keys with explicit parameters are unsupported at this time"
+        )
+
+    # This is like the above check, but it also catches the case where you
+    # explicitly encoded a curve with the same parameters as a named curve.
+    # Don't do that.
+    if (
+        not backend._lib.CRYPTOGRAPHY_IS_LIBRESSL
+        and backend._lib.EC_GROUP_get_asn1_flag(group) == 0
+    ):
+        raise ValueError(
+            "ECDSA keys with explicit parameters are unsupported at this time"
+        )
+
+    curve_name = backend._lib.OBJ_nid2sn(nid)
+    backend.openssl_assert(curve_name != backend._ffi.NULL)
+
+    sn = backend._ffi.string(curve_name).decode("ascii")
+    return sn
+
+
+def _mark_asn1_named_ec_curve(backend: Backend, ec_cdata):
+    """
+    Set the named curve flag on the EC_KEY. This causes OpenSSL to
+    serialize EC keys along with their curve OID which makes
+    deserialization easier.
+    """
+
+    backend._lib.EC_KEY_set_asn1_flag(
+        ec_cdata, backend._lib.OPENSSL_EC_NAMED_CURVE
+    )
+
+
+def _check_key_infinity(backend: Backend, ec_cdata) -> None:
+    point = backend._lib.EC_KEY_get0_public_key(ec_cdata)
+    backend.openssl_assert(point != backend._ffi.NULL)
+    group = backend._lib.EC_KEY_get0_group(ec_cdata)
+    backend.openssl_assert(group != backend._ffi.NULL)
+    if backend._lib.EC_POINT_is_at_infinity(group, point):
+        raise ValueError(
+            "Cannot load an EC public key where the point is at infinity"
+        )
+
+
+def _sn_to_elliptic_curve(backend: Backend, sn: str) -> ec.EllipticCurve:
+    try:
+        return ec._CURVE_TYPES[sn]()
+    except KeyError:
+        raise UnsupportedAlgorithm(
+            f"{sn} is not a supported elliptic curve",
+            _Reasons.UNSUPPORTED_ELLIPTIC_CURVE,
+        )
+
+
+def _ecdsa_sig_sign(
+    backend: Backend, private_key: _EllipticCurvePrivateKey, data: bytes
+) -> bytes:
+    max_size = backend._lib.ECDSA_size(private_key._ec_key)
+    backend.openssl_assert(max_size > 0)
+
+    sigbuf = backend._ffi.new("unsigned char[]", max_size)
+    siglen_ptr = backend._ffi.new("unsigned int[]", 1)
+    res = backend._lib.ECDSA_sign(
+        0, data, len(data), sigbuf, siglen_ptr, private_key._ec_key
+    )
+    backend.openssl_assert(res == 1)
+    return backend._ffi.buffer(sigbuf)[: siglen_ptr[0]]
+
+
+def _ecdsa_sig_verify(
+    backend: Backend,
+    public_key: _EllipticCurvePublicKey,
+    signature: bytes,
+    data: bytes,
+) -> None:
+    res = backend._lib.ECDSA_verify(
+        0, data, len(data), signature, len(signature), public_key._ec_key
+    )
+    if res != 1:
+        backend._consume_errors()
+        raise InvalidSignature
+
+
+class _EllipticCurvePrivateKey(ec.EllipticCurvePrivateKey):
+    def __init__(self, backend: Backend, ec_key_cdata, evp_pkey):
+        self._backend = backend
+        self._ec_key = ec_key_cdata
+        self._evp_pkey = evp_pkey
+
+        sn = _ec_key_curve_sn(backend, ec_key_cdata)
+        self._curve = _sn_to_elliptic_curve(backend, sn)
+        _mark_asn1_named_ec_curve(backend, ec_key_cdata)
+        _check_key_infinity(backend, ec_key_cdata)
+
+    @property
+    def curve(self) -> ec.EllipticCurve:
+        return self._curve
+
+    @property
+    def key_size(self) -> int:
+        return self.curve.key_size
+
+    def exchange(
+        self, algorithm: ec.ECDH, peer_public_key: ec.EllipticCurvePublicKey
+    ) -> bytes:
+        if not (
+            self._backend.elliptic_curve_exchange_algorithm_supported(
+                algorithm, self.curve
+            )
+        ):
+            raise UnsupportedAlgorithm(
+                "This backend does not support the ECDH algorithm.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+
+        if peer_public_key.curve.name != self.curve.name:
+            raise ValueError(
+                "peer_public_key and self are not on the same curve"
+            )
+
+        return _evp_pkey_derive(self._backend, self._evp_pkey, peer_public_key)
+
+    def public_key(self) -> ec.EllipticCurvePublicKey:
+        group = self._backend._lib.EC_KEY_get0_group(self._ec_key)
+        self._backend.openssl_assert(group != self._backend._ffi.NULL)
+
+        curve_nid = self._backend._lib.EC_GROUP_get_curve_name(group)
+        public_ec_key = self._backend._ec_key_new_by_curve_nid(curve_nid)
+
+        point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key)
+        self._backend.openssl_assert(point != self._backend._ffi.NULL)
+
+        res = self._backend._lib.EC_KEY_set_public_key(public_ec_key, point)
+        self._backend.openssl_assert(res == 1)
+
+        evp_pkey = self._backend._ec_cdata_to_evp_pkey(public_ec_key)
+
+        return _EllipticCurvePublicKey(self._backend, public_ec_key, evp_pkey)
+
+    def private_numbers(self) -> ec.EllipticCurvePrivateNumbers:
+        bn = self._backend._lib.EC_KEY_get0_private_key(self._ec_key)
+        private_value = self._backend._bn_to_int(bn)
+        return ec.EllipticCurvePrivateNumbers(
+            private_value=private_value,
+            public_numbers=self.public_key().public_numbers(),
+        )
+
+    def private_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PrivateFormat,
+        encryption_algorithm: serialization.KeySerializationEncryption,
+    ) -> bytes:
+        return self._backend._private_key_bytes(
+            encoding,
+            format,
+            encryption_algorithm,
+            self,
+            self._evp_pkey,
+            self._ec_key,
+        )
+
+    def sign(
+        self,
+        data: bytes,
+        signature_algorithm: ec.EllipticCurveSignatureAlgorithm,
+    ) -> bytes:
+        _check_signature_algorithm(signature_algorithm)
+        data, _ = _calculate_digest_and_algorithm(
+            data,
+            signature_algorithm.algorithm,
+        )
+        return _ecdsa_sig_sign(self._backend, self, data)
+
+
+class _EllipticCurvePublicKey(ec.EllipticCurvePublicKey):
+    def __init__(self, backend: Backend, ec_key_cdata, evp_pkey):
+        self._backend = backend
+        self._ec_key = ec_key_cdata
+        self._evp_pkey = evp_pkey
+
+        sn = _ec_key_curve_sn(backend, ec_key_cdata)
+        self._curve = _sn_to_elliptic_curve(backend, sn)
+        _mark_asn1_named_ec_curve(backend, ec_key_cdata)
+        _check_key_infinity(backend, ec_key_cdata)
+
+    @property
+    def curve(self) -> ec.EllipticCurve:
+        return self._curve
+
+    @property
+    def key_size(self) -> int:
+        return self.curve.key_size
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, _EllipticCurvePublicKey):
+            return NotImplemented
+
+        return (
+            self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey)
+            == 1
+        )
+
+    def public_numbers(self) -> ec.EllipticCurvePublicNumbers:
+        group = self._backend._lib.EC_KEY_get0_group(self._ec_key)
+        self._backend.openssl_assert(group != self._backend._ffi.NULL)
+
+        point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key)
+        self._backend.openssl_assert(point != self._backend._ffi.NULL)
+
+        with self._backend._tmp_bn_ctx() as bn_ctx:
+            bn_x = self._backend._lib.BN_CTX_get(bn_ctx)
+            bn_y = self._backend._lib.BN_CTX_get(bn_ctx)
+
+            res = self._backend._lib.EC_POINT_get_affine_coordinates(
+                group, point, bn_x, bn_y, bn_ctx
+            )
+            self._backend.openssl_assert(res == 1)
+
+            x = self._backend._bn_to_int(bn_x)
+            y = self._backend._bn_to_int(bn_y)
+
+        return ec.EllipticCurvePublicNumbers(x=x, y=y, curve=self._curve)
+
+    def _encode_point(self, format: serialization.PublicFormat) -> bytes:
+        if format is serialization.PublicFormat.CompressedPoint:
+            conversion = self._backend._lib.POINT_CONVERSION_COMPRESSED
+        else:
+            assert format is serialization.PublicFormat.UncompressedPoint
+            conversion = self._backend._lib.POINT_CONVERSION_UNCOMPRESSED
+
+        group = self._backend._lib.EC_KEY_get0_group(self._ec_key)
+        self._backend.openssl_assert(group != self._backend._ffi.NULL)
+        point = self._backend._lib.EC_KEY_get0_public_key(self._ec_key)
+        self._backend.openssl_assert(point != self._backend._ffi.NULL)
+        with self._backend._tmp_bn_ctx() as bn_ctx:
+            buflen = self._backend._lib.EC_POINT_point2oct(
+                group, point, conversion, self._backend._ffi.NULL, 0, bn_ctx
+            )
+            self._backend.openssl_assert(buflen > 0)
+            buf = self._backend._ffi.new("char[]", buflen)
+            res = self._backend._lib.EC_POINT_point2oct(
+                group, point, conversion, buf, buflen, bn_ctx
+            )
+            self._backend.openssl_assert(buflen == res)
+
+        return self._backend._ffi.buffer(buf)[:]
+
+    def public_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PublicFormat,
+    ) -> bytes:
+        if (
+            encoding is serialization.Encoding.X962
+            or format is serialization.PublicFormat.CompressedPoint
+            or format is serialization.PublicFormat.UncompressedPoint
+        ):
+            if encoding is not serialization.Encoding.X962 or format not in (
+                serialization.PublicFormat.CompressedPoint,
+                serialization.PublicFormat.UncompressedPoint,
+            ):
+                raise ValueError(
+                    "X962 encoding must be used with CompressedPoint or "
+                    "UncompressedPoint format"
+                )
+
+            return self._encode_point(format)
+        else:
+            return self._backend._public_key_bytes(
+                encoding, format, self, self._evp_pkey, None
+            )
+
+    def verify(
+        self,
+        signature: bytes,
+        data: bytes,
+        signature_algorithm: ec.EllipticCurveSignatureAlgorithm,
+    ) -> None:
+        _check_signature_algorithm(signature_algorithm)
+        data, _ = _calculate_digest_and_algorithm(
+            data,
+            signature_algorithm.algorithm,
+        )
+        _ecdsa_sig_verify(self._backend, self, signature, data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/rsa.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/rsa.py
new file mode 100644
index 0000000000000000000000000000000000000000..ef27d4ead570f94d7c7b2cd3847d62e816a44e96
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/rsa.py
@@ -0,0 +1,599 @@
+# 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 annotations
+
+import threading
+import typing
+
+from cryptography.exceptions import (
+    InvalidSignature,
+    UnsupportedAlgorithm,
+    _Reasons,
+)
+from cryptography.hazmat.backends.openssl.utils import (
+    _calculate_digest_and_algorithm,
+)
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
+from cryptography.hazmat.primitives.asymmetric.padding import (
+    MGF1,
+    OAEP,
+    PSS,
+    AsymmetricPadding,
+    PKCS1v15,
+    _Auto,
+    _DigestLength,
+    _MaxLength,
+    calculate_max_pss_salt_length,
+)
+from cryptography.hazmat.primitives.asymmetric.rsa import (
+    RSAPrivateKey,
+    RSAPrivateNumbers,
+    RSAPublicKey,
+    RSAPublicNumbers,
+)
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+
+
+def _get_rsa_pss_salt_length(
+    backend: Backend,
+    pss: PSS,
+    key: typing.Union[RSAPrivateKey, RSAPublicKey],
+    hash_algorithm: hashes.HashAlgorithm,
+) -> int:
+    salt = pss._salt_length
+
+    if isinstance(salt, _MaxLength):
+        return calculate_max_pss_salt_length(key, hash_algorithm)
+    elif isinstance(salt, _DigestLength):
+        return hash_algorithm.digest_size
+    elif isinstance(salt, _Auto):
+        if isinstance(key, RSAPrivateKey):
+            raise ValueError(
+                "PSS salt length can only be set to AUTO when verifying"
+            )
+        return backend._lib.RSA_PSS_SALTLEN_AUTO
+    else:
+        return salt
+
+
+def _enc_dec_rsa(
+    backend: Backend,
+    key: typing.Union[_RSAPrivateKey, _RSAPublicKey],
+    data: bytes,
+    padding: AsymmetricPadding,
+) -> bytes:
+    if not isinstance(padding, AsymmetricPadding):
+        raise TypeError("Padding must be an instance of AsymmetricPadding.")
+
+    if isinstance(padding, PKCS1v15):
+        padding_enum = backend._lib.RSA_PKCS1_PADDING
+    elif isinstance(padding, OAEP):
+        padding_enum = backend._lib.RSA_PKCS1_OAEP_PADDING
+
+        if not isinstance(padding._mgf, MGF1):
+            raise UnsupportedAlgorithm(
+                "Only MGF1 is supported by this backend.",
+                _Reasons.UNSUPPORTED_MGF,
+            )
+
+        if not backend.rsa_padding_supported(padding):
+            raise UnsupportedAlgorithm(
+                "This combination of padding and hash algorithm is not "
+                "supported by this backend.",
+                _Reasons.UNSUPPORTED_PADDING,
+            )
+
+    else:
+        raise UnsupportedAlgorithm(
+            f"{padding.name} is not supported by this backend.",
+            _Reasons.UNSUPPORTED_PADDING,
+        )
+
+    return _enc_dec_rsa_pkey_ctx(backend, key, data, padding_enum, padding)
+
+
+def _enc_dec_rsa_pkey_ctx(
+    backend: Backend,
+    key: typing.Union[_RSAPrivateKey, _RSAPublicKey],
+    data: bytes,
+    padding_enum: int,
+    padding: AsymmetricPadding,
+) -> bytes:
+    init: typing.Callable[[typing.Any], int]
+    crypt: typing.Callable[[typing.Any, typing.Any, int, bytes, int], int]
+    if isinstance(key, _RSAPublicKey):
+        init = backend._lib.EVP_PKEY_encrypt_init
+        crypt = backend._lib.EVP_PKEY_encrypt
+    else:
+        init = backend._lib.EVP_PKEY_decrypt_init
+        crypt = backend._lib.EVP_PKEY_decrypt
+
+    pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL)
+    backend.openssl_assert(pkey_ctx != backend._ffi.NULL)
+    pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free)
+    res = init(pkey_ctx)
+    backend.openssl_assert(res == 1)
+    res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum)
+    backend.openssl_assert(res > 0)
+    buf_size = backend._lib.EVP_PKEY_size(key._evp_pkey)
+    backend.openssl_assert(buf_size > 0)
+    if isinstance(padding, OAEP):
+        mgf1_md = backend._evp_md_non_null_from_algorithm(
+            padding._mgf._algorithm
+        )
+        res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md)
+        backend.openssl_assert(res > 0)
+        oaep_md = backend._evp_md_non_null_from_algorithm(padding._algorithm)
+        res = backend._lib.EVP_PKEY_CTX_set_rsa_oaep_md(pkey_ctx, oaep_md)
+        backend.openssl_assert(res > 0)
+
+    if (
+        isinstance(padding, OAEP)
+        and padding._label is not None
+        and len(padding._label) > 0
+    ):
+        # set0_rsa_oaep_label takes ownership of the char * so we need to
+        # copy it into some new memory
+        labelptr = backend._lib.OPENSSL_malloc(len(padding._label))
+        backend.openssl_assert(labelptr != backend._ffi.NULL)
+        backend._ffi.memmove(labelptr, padding._label, len(padding._label))
+        res = backend._lib.EVP_PKEY_CTX_set0_rsa_oaep_label(
+            pkey_ctx, labelptr, len(padding._label)
+        )
+        backend.openssl_assert(res == 1)
+
+    outlen = backend._ffi.new("size_t *", buf_size)
+    buf = backend._ffi.new("unsigned char[]", buf_size)
+    # Everything from this line onwards is written with the goal of being as
+    # constant-time as is practical given the constraints of Python and our
+    # API. See Bleichenbacher's '98 attack on RSA, and its many many variants.
+    # As such, you should not attempt to change this (particularly to "clean it
+    # up") without understanding why it was written this way (see
+    # Chesterton's Fence), and without measuring to verify you have not
+    # introduced observable time differences.
+    res = crypt(pkey_ctx, buf, outlen, data, len(data))
+    resbuf = backend._ffi.buffer(buf)[: outlen[0]]
+    backend._lib.ERR_clear_error()
+    if res <= 0:
+        raise ValueError("Encryption/decryption failed.")
+    return resbuf
+
+
+def _rsa_sig_determine_padding(
+    backend: Backend,
+    key: typing.Union[_RSAPrivateKey, _RSAPublicKey],
+    padding: AsymmetricPadding,
+    algorithm: typing.Optional[hashes.HashAlgorithm],
+) -> int:
+    if not isinstance(padding, AsymmetricPadding):
+        raise TypeError("Expected provider of AsymmetricPadding.")
+
+    pkey_size = backend._lib.EVP_PKEY_size(key._evp_pkey)
+    backend.openssl_assert(pkey_size > 0)
+
+    if isinstance(padding, PKCS1v15):
+        # Hash algorithm is ignored for PKCS1v15-padding, may be None.
+        padding_enum = backend._lib.RSA_PKCS1_PADDING
+    elif isinstance(padding, PSS):
+        if not isinstance(padding._mgf, MGF1):
+            raise UnsupportedAlgorithm(
+                "Only MGF1 is supported by this backend.",
+                _Reasons.UNSUPPORTED_MGF,
+            )
+
+        # PSS padding requires a hash algorithm
+        if not isinstance(algorithm, hashes.HashAlgorithm):
+            raise TypeError("Expected instance of hashes.HashAlgorithm.")
+
+        # Size of key in bytes - 2 is the maximum
+        # PSS signature length (salt length is checked later)
+        if pkey_size - algorithm.digest_size - 2 < 0:
+            raise ValueError(
+                "Digest too large for key size. Use a larger "
+                "key or different digest."
+            )
+
+        padding_enum = backend._lib.RSA_PKCS1_PSS_PADDING
+    else:
+        raise UnsupportedAlgorithm(
+            f"{padding.name} is not supported by this backend.",
+            _Reasons.UNSUPPORTED_PADDING,
+        )
+
+    return padding_enum
+
+
+# Hash algorithm can be absent (None) to initialize the context without setting
+# any message digest algorithm. This is currently only valid for the PKCS1v15
+# padding type, where it means that the signature data is encoded/decoded
+# as provided, without being wrapped in a DigestInfo structure.
+def _rsa_sig_setup(
+    backend: Backend,
+    padding: AsymmetricPadding,
+    algorithm: typing.Optional[hashes.HashAlgorithm],
+    key: typing.Union[_RSAPublicKey, _RSAPrivateKey],
+    init_func: typing.Callable[[typing.Any], int],
+):
+    padding_enum = _rsa_sig_determine_padding(backend, key, padding, algorithm)
+    pkey_ctx = backend._lib.EVP_PKEY_CTX_new(key._evp_pkey, backend._ffi.NULL)
+    backend.openssl_assert(pkey_ctx != backend._ffi.NULL)
+    pkey_ctx = backend._ffi.gc(pkey_ctx, backend._lib.EVP_PKEY_CTX_free)
+    res = init_func(pkey_ctx)
+    if res != 1:
+        errors = backend._consume_errors()
+        raise ValueError("Unable to sign/verify with this key", errors)
+
+    if algorithm is not None:
+        evp_md = backend._evp_md_non_null_from_algorithm(algorithm)
+        res = backend._lib.EVP_PKEY_CTX_set_signature_md(pkey_ctx, evp_md)
+        if res <= 0:
+            backend._consume_errors()
+            raise UnsupportedAlgorithm(
+                "{} is not supported by this backend for RSA signing.".format(
+                    algorithm.name
+                ),
+                _Reasons.UNSUPPORTED_HASH,
+            )
+    res = backend._lib.EVP_PKEY_CTX_set_rsa_padding(pkey_ctx, padding_enum)
+    if res <= 0:
+        backend._consume_errors()
+        raise UnsupportedAlgorithm(
+            "{} is not supported for the RSA signature operation.".format(
+                padding.name
+            ),
+            _Reasons.UNSUPPORTED_PADDING,
+        )
+    if isinstance(padding, PSS):
+        assert isinstance(algorithm, hashes.HashAlgorithm)
+        res = backend._lib.EVP_PKEY_CTX_set_rsa_pss_saltlen(
+            pkey_ctx,
+            _get_rsa_pss_salt_length(backend, padding, key, algorithm),
+        )
+        backend.openssl_assert(res > 0)
+
+        mgf1_md = backend._evp_md_non_null_from_algorithm(
+            padding._mgf._algorithm
+        )
+        res = backend._lib.EVP_PKEY_CTX_set_rsa_mgf1_md(pkey_ctx, mgf1_md)
+        backend.openssl_assert(res > 0)
+
+    return pkey_ctx
+
+
+def _rsa_sig_sign(
+    backend: Backend,
+    padding: AsymmetricPadding,
+    algorithm: hashes.HashAlgorithm,
+    private_key: _RSAPrivateKey,
+    data: bytes,
+) -> bytes:
+    pkey_ctx = _rsa_sig_setup(
+        backend,
+        padding,
+        algorithm,
+        private_key,
+        backend._lib.EVP_PKEY_sign_init,
+    )
+    buflen = backend._ffi.new("size_t *")
+    res = backend._lib.EVP_PKEY_sign(
+        pkey_ctx, backend._ffi.NULL, buflen, data, len(data)
+    )
+    backend.openssl_assert(res == 1)
+    buf = backend._ffi.new("unsigned char[]", buflen[0])
+    res = backend._lib.EVP_PKEY_sign(pkey_ctx, buf, buflen, data, len(data))
+    if res != 1:
+        errors = backend._consume_errors()
+        raise ValueError(
+            "Digest or salt length too long for key size. Use a larger key "
+            "or shorter salt length if you are specifying a PSS salt",
+            errors,
+        )
+
+    return backend._ffi.buffer(buf)[:]
+
+
+def _rsa_sig_verify(
+    backend: Backend,
+    padding: AsymmetricPadding,
+    algorithm: hashes.HashAlgorithm,
+    public_key: _RSAPublicKey,
+    signature: bytes,
+    data: bytes,
+) -> None:
+    pkey_ctx = _rsa_sig_setup(
+        backend,
+        padding,
+        algorithm,
+        public_key,
+        backend._lib.EVP_PKEY_verify_init,
+    )
+    res = backend._lib.EVP_PKEY_verify(
+        pkey_ctx, signature, len(signature), data, len(data)
+    )
+    # The previous call can return negative numbers in the event of an
+    # error. This is not a signature failure but we need to fail if it
+    # occurs.
+    backend.openssl_assert(res >= 0)
+    if res == 0:
+        backend._consume_errors()
+        raise InvalidSignature
+
+
+def _rsa_sig_recover(
+    backend: Backend,
+    padding: AsymmetricPadding,
+    algorithm: typing.Optional[hashes.HashAlgorithm],
+    public_key: _RSAPublicKey,
+    signature: bytes,
+) -> bytes:
+    pkey_ctx = _rsa_sig_setup(
+        backend,
+        padding,
+        algorithm,
+        public_key,
+        backend._lib.EVP_PKEY_verify_recover_init,
+    )
+
+    # Attempt to keep the rest of the code in this function as constant/time
+    # as possible. See the comment in _enc_dec_rsa_pkey_ctx. Note that the
+    # buflen parameter is used even though its value may be undefined in the
+    # error case. Due to the tolerant nature of Python slicing this does not
+    # trigger any exceptions.
+    maxlen = backend._lib.EVP_PKEY_size(public_key._evp_pkey)
+    backend.openssl_assert(maxlen > 0)
+    buf = backend._ffi.new("unsigned char[]", maxlen)
+    buflen = backend._ffi.new("size_t *", maxlen)
+    res = backend._lib.EVP_PKEY_verify_recover(
+        pkey_ctx, buf, buflen, signature, len(signature)
+    )
+    resbuf = backend._ffi.buffer(buf)[: buflen[0]]
+    backend._lib.ERR_clear_error()
+    # Assume that all parameter errors are handled during the setup phase and
+    # any error here is due to invalid signature.
+    if res != 1:
+        raise InvalidSignature
+    return resbuf
+
+
+class _RSAPrivateKey(RSAPrivateKey):
+    _evp_pkey: object
+    _rsa_cdata: object
+    _key_size: int
+
+    def __init__(
+        self,
+        backend: Backend,
+        rsa_cdata,
+        evp_pkey,
+        *,
+        unsafe_skip_rsa_key_validation: bool,
+    ):
+        res: int
+        # RSA_check_key is slower in OpenSSL 3.0.0 due to improved
+        # primality checking. In normal use this is unlikely to be a problem
+        # since users don't load new keys constantly, but for TESTING we've
+        # added an init arg that allows skipping the checks. You should not
+        # use this in production code unless you understand the consequences.
+        if not unsafe_skip_rsa_key_validation:
+            res = backend._lib.RSA_check_key(rsa_cdata)
+            if res != 1:
+                errors = backend._consume_errors()
+                raise ValueError("Invalid private key", errors)
+            # 2 is prime and passes an RSA key check, so we also check
+            # if p and q are odd just to be safe.
+            p = backend._ffi.new("BIGNUM **")
+            q = backend._ffi.new("BIGNUM **")
+            backend._lib.RSA_get0_factors(rsa_cdata, p, q)
+            backend.openssl_assert(p[0] != backend._ffi.NULL)
+            backend.openssl_assert(q[0] != backend._ffi.NULL)
+            p_odd = backend._lib.BN_is_odd(p[0])
+            q_odd = backend._lib.BN_is_odd(q[0])
+            if p_odd != 1 or q_odd != 1:
+                errors = backend._consume_errors()
+                raise ValueError("Invalid private key", errors)
+
+        self._backend = backend
+        self._rsa_cdata = rsa_cdata
+        self._evp_pkey = evp_pkey
+        # Used for lazy blinding
+        self._blinded = False
+        self._blinding_lock = threading.Lock()
+
+        n = self._backend._ffi.new("BIGNUM **")
+        self._backend._lib.RSA_get0_key(
+            self._rsa_cdata,
+            n,
+            self._backend._ffi.NULL,
+            self._backend._ffi.NULL,
+        )
+        self._backend.openssl_assert(n[0] != self._backend._ffi.NULL)
+        self._key_size = self._backend._lib.BN_num_bits(n[0])
+
+    def _enable_blinding(self) -> None:
+        # If you call blind on an already blinded RSA key OpenSSL will turn
+        # it off and back on, which is a performance hit we want to avoid.
+        if not self._blinded:
+            with self._blinding_lock:
+                self._non_threadsafe_enable_blinding()
+
+    def _non_threadsafe_enable_blinding(self) -> None:
+        # This is only a separate function to allow for testing to cover both
+        # branches. It should never be invoked except through _enable_blinding.
+        # Check if it's not True again in case another thread raced past the
+        # first non-locked check.
+        if not self._blinded:
+            res = self._backend._lib.RSA_blinding_on(
+                self._rsa_cdata, self._backend._ffi.NULL
+            )
+            self._backend.openssl_assert(res == 1)
+            self._blinded = True
+
+    @property
+    def key_size(self) -> int:
+        return self._key_size
+
+    def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes:
+        self._enable_blinding()
+        key_size_bytes = (self.key_size + 7) // 8
+        if key_size_bytes != len(ciphertext):
+            raise ValueError("Ciphertext length must be equal to key size.")
+
+        return _enc_dec_rsa(self._backend, self, ciphertext, padding)
+
+    def public_key(self) -> RSAPublicKey:
+        ctx = self._backend._lib.RSAPublicKey_dup(self._rsa_cdata)
+        self._backend.openssl_assert(ctx != self._backend._ffi.NULL)
+        ctx = self._backend._ffi.gc(ctx, self._backend._lib.RSA_free)
+        evp_pkey = self._backend._rsa_cdata_to_evp_pkey(ctx)
+        return _RSAPublicKey(self._backend, ctx, evp_pkey)
+
+    def private_numbers(self) -> RSAPrivateNumbers:
+        n = self._backend._ffi.new("BIGNUM **")
+        e = self._backend._ffi.new("BIGNUM **")
+        d = self._backend._ffi.new("BIGNUM **")
+        p = self._backend._ffi.new("BIGNUM **")
+        q = self._backend._ffi.new("BIGNUM **")
+        dmp1 = self._backend._ffi.new("BIGNUM **")
+        dmq1 = self._backend._ffi.new("BIGNUM **")
+        iqmp = self._backend._ffi.new("BIGNUM **")
+        self._backend._lib.RSA_get0_key(self._rsa_cdata, n, e, d)
+        self._backend.openssl_assert(n[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(e[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(d[0] != self._backend._ffi.NULL)
+        self._backend._lib.RSA_get0_factors(self._rsa_cdata, p, q)
+        self._backend.openssl_assert(p[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(q[0] != self._backend._ffi.NULL)
+        self._backend._lib.RSA_get0_crt_params(
+            self._rsa_cdata, dmp1, dmq1, iqmp
+        )
+        self._backend.openssl_assert(dmp1[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(dmq1[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(iqmp[0] != self._backend._ffi.NULL)
+        return RSAPrivateNumbers(
+            p=self._backend._bn_to_int(p[0]),
+            q=self._backend._bn_to_int(q[0]),
+            d=self._backend._bn_to_int(d[0]),
+            dmp1=self._backend._bn_to_int(dmp1[0]),
+            dmq1=self._backend._bn_to_int(dmq1[0]),
+            iqmp=self._backend._bn_to_int(iqmp[0]),
+            public_numbers=RSAPublicNumbers(
+                e=self._backend._bn_to_int(e[0]),
+                n=self._backend._bn_to_int(n[0]),
+            ),
+        )
+
+    def private_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PrivateFormat,
+        encryption_algorithm: serialization.KeySerializationEncryption,
+    ) -> bytes:
+        return self._backend._private_key_bytes(
+            encoding,
+            format,
+            encryption_algorithm,
+            self,
+            self._evp_pkey,
+            self._rsa_cdata,
+        )
+
+    def sign(
+        self,
+        data: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> bytes:
+        self._enable_blinding()
+        data, algorithm = _calculate_digest_and_algorithm(data, algorithm)
+        return _rsa_sig_sign(self._backend, padding, algorithm, self, data)
+
+
+class _RSAPublicKey(RSAPublicKey):
+    _evp_pkey: object
+    _rsa_cdata: object
+    _key_size: int
+
+    def __init__(self, backend: Backend, rsa_cdata, evp_pkey):
+        self._backend = backend
+        self._rsa_cdata = rsa_cdata
+        self._evp_pkey = evp_pkey
+
+        n = self._backend._ffi.new("BIGNUM **")
+        self._backend._lib.RSA_get0_key(
+            self._rsa_cdata,
+            n,
+            self._backend._ffi.NULL,
+            self._backend._ffi.NULL,
+        )
+        self._backend.openssl_assert(n[0] != self._backend._ffi.NULL)
+        self._key_size = self._backend._lib.BN_num_bits(n[0])
+
+    @property
+    def key_size(self) -> int:
+        return self._key_size
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, _RSAPublicKey):
+            return NotImplemented
+
+        return (
+            self._backend._lib.EVP_PKEY_cmp(self._evp_pkey, other._evp_pkey)
+            == 1
+        )
+
+    def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes:
+        return _enc_dec_rsa(self._backend, self, plaintext, padding)
+
+    def public_numbers(self) -> RSAPublicNumbers:
+        n = self._backend._ffi.new("BIGNUM **")
+        e = self._backend._ffi.new("BIGNUM **")
+        self._backend._lib.RSA_get0_key(
+            self._rsa_cdata, n, e, self._backend._ffi.NULL
+        )
+        self._backend.openssl_assert(n[0] != self._backend._ffi.NULL)
+        self._backend.openssl_assert(e[0] != self._backend._ffi.NULL)
+        return RSAPublicNumbers(
+            e=self._backend._bn_to_int(e[0]),
+            n=self._backend._bn_to_int(n[0]),
+        )
+
+    def public_bytes(
+        self,
+        encoding: serialization.Encoding,
+        format: serialization.PublicFormat,
+    ) -> bytes:
+        return self._backend._public_key_bytes(
+            encoding, format, self, self._evp_pkey, self._rsa_cdata
+        )
+
+    def verify(
+        self,
+        signature: bytes,
+        data: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> None:
+        data, algorithm = _calculate_digest_and_algorithm(data, algorithm)
+        _rsa_sig_verify(
+            self._backend, padding, algorithm, self, signature, data
+        )
+
+    def recover_data_from_signature(
+        self,
+        signature: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Optional[hashes.HashAlgorithm],
+    ) -> bytes:
+        if isinstance(algorithm, asym_utils.Prehashed):
+            raise TypeError(
+                "Prehashed is only supported in the sign and verify methods. "
+                "It cannot be used with recover_data_from_signature."
+            )
+        return _rsa_sig_recover(
+            self._backend, padding, algorithm, self, signature
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/utils.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b404defde33449e33da554a80aa28ac23230938
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/backends/openssl/utils.py
@@ -0,0 +1,63 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives.asymmetric.utils import Prehashed
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.backend import Backend
+
+
+def _evp_pkey_derive(backend: Backend, evp_pkey, peer_public_key) -> bytes:
+    ctx = backend._lib.EVP_PKEY_CTX_new(evp_pkey, backend._ffi.NULL)
+    backend.openssl_assert(ctx != backend._ffi.NULL)
+    ctx = backend._ffi.gc(ctx, backend._lib.EVP_PKEY_CTX_free)
+    res = backend._lib.EVP_PKEY_derive_init(ctx)
+    backend.openssl_assert(res == 1)
+
+    if backend._lib.Cryptography_HAS_EVP_PKEY_SET_PEER_EX:
+        res = backend._lib.EVP_PKEY_derive_set_peer_ex(
+            ctx, peer_public_key._evp_pkey, 0
+        )
+    else:
+        res = backend._lib.EVP_PKEY_derive_set_peer(
+            ctx, peer_public_key._evp_pkey
+        )
+    backend.openssl_assert(res == 1)
+
+    keylen = backend._ffi.new("size_t *")
+    res = backend._lib.EVP_PKEY_derive(ctx, backend._ffi.NULL, keylen)
+    backend.openssl_assert(res == 1)
+    backend.openssl_assert(keylen[0] > 0)
+    buf = backend._ffi.new("unsigned char[]", keylen[0])
+    res = backend._lib.EVP_PKEY_derive(ctx, buf, keylen)
+    if res != 1:
+        errors = backend._consume_errors()
+        raise ValueError("Error computing shared key.", errors)
+
+    return backend._ffi.buffer(buf, keylen[0])[:]
+
+
+def _calculate_digest_and_algorithm(
+    data: bytes,
+    algorithm: typing.Union[Prehashed, hashes.HashAlgorithm],
+) -> typing.Tuple[bytes, hashes.HashAlgorithm]:
+    if not isinstance(algorithm, Prehashed):
+        hash_ctx = hashes.Hash(algorithm)
+        hash_ctx.update(data)
+        data = hash_ctx.finalize()
+    else:
+        algorithm = algorithm._algorithm
+
+    if len(data) != algorithm.digest_size:
+        raise ValueError(
+            "The provided data must be the same length as the hash "
+            "algorithm's digest size."
+        )
+
+    return (data, algorithm)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b509336233c2fafe4185a49da5909c8bbb38dfd7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__init__.py
@@ -0,0 +1,3 @@
+# 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.
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0d2ab5783781823ebc1064d414df5701d1ff14ce
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so
new file mode 100755
index 0000000000000000000000000000000000000000..f5bcc316b031b6667bbcb815f38036e70adbce43
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust.abi3.so differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..94a37a20aa962dccf5d403dcad17c69ffd57c455
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/__init__.pyi
@@ -0,0 +1,34 @@
+# 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 types
+import typing
+
+def check_pkcs7_padding(data: bytes) -> bool: ...
+def check_ansix923_padding(data: bytes) -> bool: ...
+
+class ObjectIdentifier:
+    def __init__(self, val: str) -> None: ...
+    @property
+    def dotted_string(self) -> str: ...
+    @property
+    def _name(self) -> str: ...
+
+T = typing.TypeVar("T")
+
+class FixedPool(typing.Generic[T]):
+    def __init__(
+        self,
+        create: typing.Callable[[], T],
+    ) -> None: ...
+    def acquire(self) -> PoolAcquisition[T]: ...
+
+class PoolAcquisition(typing.Generic[T]):
+    def __enter__(self) -> T: ...
+    def __exit__(
+        self,
+        exc_type: typing.Optional[typing.Type[BaseException]],
+        exc_value: typing.Optional[BaseException],
+        exc_tb: typing.Optional[types.TracebackType],
+    ) -> None: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..80100082acd30b6bc69e5b8ab0972d77a33dc11a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/_openssl.pyi
@@ -0,0 +1,8 @@
+# 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 typing
+
+lib = typing.Any
+ffi = typing.Any
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..a8369ba8383e639c2b1173008051ecc72450bf8a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/asn1.pyi
@@ -0,0 +1,16 @@
+# 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 typing
+
+class TestCertificate:
+    not_after_tag: int
+    not_before_tag: int
+    issuer_value_tags: typing.List[int]
+    subject_value_tags: typing.List[int]
+
+def decode_dss_signature(signature: bytes) -> typing.Tuple[int, int]: ...
+def encode_dss_signature(r: int, s: int) -> bytes: ...
+def parse_spki_for_data(data: bytes) -> bytes: ...
+def test_parse_certificate(data: bytes) -> TestCertificate: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..09f46b1e817f806873c4a4bdd7b8466046b5f64d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/exceptions.pyi
@@ -0,0 +1,17 @@
+# 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 _Reasons:
+    BACKEND_MISSING_INTERFACE: _Reasons
+    UNSUPPORTED_HASH: _Reasons
+    UNSUPPORTED_CIPHER: _Reasons
+    UNSUPPORTED_PADDING: _Reasons
+    UNSUPPORTED_MGF: _Reasons
+    UNSUPPORTED_PUBLIC_KEY_ALGORITHM: _Reasons
+    UNSUPPORTED_ELLIPTIC_CURVE: _Reasons
+    UNSUPPORTED_SERIALIZATION: _Reasons
+    UNSUPPORTED_X509: _Reasons
+    UNSUPPORTED_EXCHANGE_ALGORITHM: _Reasons
+    UNSUPPORTED_DIFFIE_HELLMAN: _Reasons
+    UNSUPPORTED_MAC: _Reasons
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..4671eb9ba34df990a5e95c2aad354f67b500ba0c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/ocsp.pyi
@@ -0,0 +1,25 @@
+# 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 typing
+
+from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
+from cryptography.x509.ocsp import (
+    OCSPRequest,
+    OCSPRequestBuilder,
+    OCSPResponse,
+    OCSPResponseBuilder,
+    OCSPResponseStatus,
+)
+
+def load_der_ocsp_request(data: bytes) -> OCSPRequest: ...
+def load_der_ocsp_response(data: bytes) -> OCSPResponse: ...
+def create_ocsp_request(builder: OCSPRequestBuilder) -> OCSPRequest: ...
+def create_ocsp_response(
+    status: OCSPResponseStatus,
+    builder: typing.Optional[OCSPResponseBuilder],
+    private_key: typing.Optional[PrivateKeyTypes],
+    hash_algorithm: typing.Optional[hashes.HashAlgorithm],
+) -> OCSPResponse: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..82f30d20b0ab2a349fc160d55454854bb1362d5e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/__init__.pyi
@@ -0,0 +1,47 @@
+# 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 typing
+
+from cryptography.hazmat.bindings._rust.openssl import (
+    dh,
+    dsa,
+    ed448,
+    ed25519,
+    hashes,
+    hmac,
+    kdf,
+    poly1305,
+    x448,
+    x25519,
+)
+
+__all__ = [
+    "openssl_version",
+    "raise_openssl_error",
+    "dh",
+    "dsa",
+    "hashes",
+    "hmac",
+    "kdf",
+    "ed448",
+    "ed25519",
+    "poly1305",
+    "x448",
+    "x25519",
+]
+
+def openssl_version() -> int: ...
+def raise_openssl_error() -> typing.NoReturn: ...
+def capture_error_stack() -> typing.List[OpenSSLError]: ...
+def is_fips_enabled() -> bool: ...
+
+class OpenSSLError:
+    @property
+    def lib(self) -> int: ...
+    @property
+    def reason(self) -> int: ...
+    @property
+    def reason_text(self) -> bytes: ...
+    def _lib_reason_match(self, lib: int, reason: int) -> bool: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..bfd005d99fec9f8f218ba055ef8c8aaae03e72e8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dh.pyi
@@ -0,0 +1,22 @@
+# 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 cryptography.hazmat.primitives.asymmetric import dh
+
+MIN_MODULUS_SIZE: int
+
+class DHPrivateKey: ...
+class DHPublicKey: ...
+class DHParameters: ...
+
+def generate_parameters(generator: int, key_size: int) -> dh.DHParameters: ...
+def private_key_from_ptr(ptr: int) -> dh.DHPrivateKey: ...
+def public_key_from_ptr(ptr: int) -> dh.DHPublicKey: ...
+def from_pem_parameters(data: bytes) -> dh.DHParameters: ...
+def from_der_parameters(data: bytes) -> dh.DHParameters: ...
+def from_private_numbers(numbers: dh.DHPrivateNumbers) -> dh.DHPrivateKey: ...
+def from_public_numbers(numbers: dh.DHPublicNumbers) -> dh.DHPublicKey: ...
+def from_parameter_numbers(
+    numbers: dh.DHParameterNumbers,
+) -> dh.DHParameters: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..5a56f256d52df9a5a3760df21ea26fce4a5b7070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/dsa.pyi
@@ -0,0 +1,20 @@
+# 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 cryptography.hazmat.primitives.asymmetric import dsa
+
+class DSAPrivateKey: ...
+class DSAPublicKey: ...
+class DSAParameters: ...
+
+def generate_parameters(key_size: int) -> dsa.DSAParameters: ...
+def private_key_from_ptr(ptr: int) -> dsa.DSAPrivateKey: ...
+def public_key_from_ptr(ptr: int) -> dsa.DSAPublicKey: ...
+def from_private_numbers(
+    numbers: dsa.DSAPrivateNumbers,
+) -> dsa.DSAPrivateKey: ...
+def from_public_numbers(numbers: dsa.DSAPublicNumbers) -> dsa.DSAPublicKey: ...
+def from_parameter_numbers(
+    numbers: dsa.DSAParameterNumbers,
+) -> dsa.DSAParameters: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..c7f127f0b157cf2c17804e218795f2363a8b0339
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed25519.pyi
@@ -0,0 +1,14 @@
+# 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 cryptography.hazmat.primitives.asymmetric import ed25519
+
+class Ed25519PrivateKey: ...
+class Ed25519PublicKey: ...
+
+def generate_key() -> ed25519.Ed25519PrivateKey: ...
+def private_key_from_ptr(ptr: int) -> ed25519.Ed25519PrivateKey: ...
+def public_key_from_ptr(ptr: int) -> ed25519.Ed25519PublicKey: ...
+def from_private_bytes(data: bytes) -> ed25519.Ed25519PrivateKey: ...
+def from_public_bytes(data: bytes) -> ed25519.Ed25519PublicKey: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..1cf5f1773a0bb86ffaec212e96f500b8ace26b5b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/ed448.pyi
@@ -0,0 +1,14 @@
+# 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 cryptography.hazmat.primitives.asymmetric import ed448
+
+class Ed448PrivateKey: ...
+class Ed448PublicKey: ...
+
+def generate_key() -> ed448.Ed448PrivateKey: ...
+def private_key_from_ptr(ptr: int) -> ed448.Ed448PrivateKey: ...
+def public_key_from_ptr(ptr: int) -> ed448.Ed448PublicKey: ...
+def from_private_bytes(data: bytes) -> ed448.Ed448PrivateKey: ...
+def from_public_bytes(data: bytes) -> ed448.Ed448PublicKey: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..ca5f42a006158f9cddbaddc2d5b581d556f2914d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hashes.pyi
@@ -0,0 +1,17 @@
+# 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 typing
+
+from cryptography.hazmat.primitives import hashes
+
+class Hash(hashes.HashContext):
+    def __init__(
+        self, algorithm: hashes.HashAlgorithm, backend: typing.Any = None
+    ) -> None: ...
+    @property
+    def algorithm(self) -> hashes.HashAlgorithm: ...
+    def update(self, data: bytes) -> None: ...
+    def finalize(self) -> bytes: ...
+    def copy(self) -> Hash: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..e38d9b54d01bc6e5baea24c2ac6c3d8631941f80
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/hmac.pyi
@@ -0,0 +1,21 @@
+# 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 typing
+
+from cryptography.hazmat.primitives import hashes
+
+class HMAC(hashes.HashContext):
+    def __init__(
+        self,
+        key: bytes,
+        algorithm: hashes.HashAlgorithm,
+        backend: typing.Any = None,
+    ) -> None: ...
+    @property
+    def algorithm(self) -> hashes.HashAlgorithm: ...
+    def update(self, data: bytes) -> None: ...
+    def finalize(self) -> bytes: ...
+    def verify(self, signature: bytes) -> None: ...
+    def copy(self) -> HMAC: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..034a8fed2e7898baa5acb56ce01d96ba9fcbb89e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/kdf.pyi
@@ -0,0 +1,22 @@
+# 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 cryptography.hazmat.primitives.hashes import HashAlgorithm
+
+def derive_pbkdf2_hmac(
+    key_material: bytes,
+    algorithm: HashAlgorithm,
+    salt: bytes,
+    iterations: int,
+    length: int,
+) -> bytes: ...
+def derive_scrypt(
+    key_material: bytes,
+    salt: bytes,
+    n: int,
+    r: int,
+    p: int,
+    max_mem: int,
+    length: int,
+) -> bytes: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..2e9b0a9e1254361860942722a03281e9bb8a3bb3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/poly1305.pyi
@@ -0,0 +1,13 @@
+# 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 Poly1305:
+    def __init__(self, key: bytes) -> None: ...
+    @staticmethod
+    def generate_tag(key: bytes, data: bytes) -> bytes: ...
+    @staticmethod
+    def verify_tag(key: bytes, data: bytes, tag: bytes) -> None: ...
+    def update(self, data: bytes) -> None: ...
+    def finalize(self) -> bytes: ...
+    def verify(self, tag: bytes) -> None: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..90f7cbdda950b10e2fc160353e15fdb30f7250cf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x25519.pyi
@@ -0,0 +1,14 @@
+# 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 cryptography.hazmat.primitives.asymmetric import x25519
+
+class X25519PrivateKey: ...
+class X25519PublicKey: ...
+
+def generate_key() -> x25519.X25519PrivateKey: ...
+def private_key_from_ptr(ptr: int) -> x25519.X25519PrivateKey: ...
+def public_key_from_ptr(ptr: int) -> x25519.X25519PublicKey: ...
+def from_private_bytes(data: bytes) -> x25519.X25519PrivateKey: ...
+def from_public_bytes(data: bytes) -> x25519.X25519PublicKey: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..d326c8d2d7c585d8522eca0fac931673c1047a45
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/openssl/x448.pyi
@@ -0,0 +1,14 @@
+# 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 cryptography.hazmat.primitives.asymmetric import x448
+
+class X448PrivateKey: ...
+class X448PublicKey: ...
+
+def generate_key() -> x448.X448PrivateKey: ...
+def private_key_from_ptr(ptr: int) -> x448.X448PrivateKey: ...
+def public_key_from_ptr(ptr: int) -> x448.X448PublicKey: ...
+def from_private_bytes(data: bytes) -> x448.X448PrivateKey: ...
+def from_public_bytes(data: bytes) -> x448.X448PublicKey: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..66bd850981a6fa06eb7c7ecdec0e443c22b82c08
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/pkcs7.pyi
@@ -0,0 +1,15 @@
+import typing
+
+from cryptography import x509
+from cryptography.hazmat.primitives import serialization
+from cryptography.hazmat.primitives.serialization import pkcs7
+
+def serialize_certificates(
+    certs: typing.List[x509.Certificate],
+    encoding: serialization.Encoding,
+) -> bytes: ...
+def sign_and_serialize(
+    builder: pkcs7.PKCS7SignatureBuilder,
+    encoding: serialization.Encoding,
+    options: typing.Iterable[pkcs7.PKCS7Options],
+) -> bytes: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi
new file mode 100644
index 0000000000000000000000000000000000000000..24b2f5e3a78c97622e8a4353de09934dde0d4026
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/_rust/x509.pyi
@@ -0,0 +1,44 @@
+# 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 typing
+
+from cryptography import x509
+from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives.asymmetric.padding import PSS, PKCS1v15
+from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
+
+def load_pem_x509_certificate(data: bytes) -> x509.Certificate: ...
+def load_pem_x509_certificates(
+    data: bytes,
+) -> typing.List[x509.Certificate]: ...
+def load_der_x509_certificate(data: bytes) -> x509.Certificate: ...
+def load_pem_x509_crl(data: bytes) -> x509.CertificateRevocationList: ...
+def load_der_x509_crl(data: bytes) -> x509.CertificateRevocationList: ...
+def load_pem_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ...
+def load_der_x509_csr(data: bytes) -> x509.CertificateSigningRequest: ...
+def encode_name_bytes(name: x509.Name) -> bytes: ...
+def encode_extension_value(extension: x509.ExtensionType) -> bytes: ...
+def create_x509_certificate(
+    builder: x509.CertificateBuilder,
+    private_key: PrivateKeyTypes,
+    hash_algorithm: typing.Optional[hashes.HashAlgorithm],
+    padding: typing.Optional[typing.Union[PKCS1v15, PSS]],
+) -> x509.Certificate: ...
+def create_x509_csr(
+    builder: x509.CertificateSigningRequestBuilder,
+    private_key: PrivateKeyTypes,
+    hash_algorithm: typing.Optional[hashes.HashAlgorithm],
+) -> x509.CertificateSigningRequest: ...
+def create_x509_crl(
+    builder: x509.CertificateRevocationListBuilder,
+    private_key: PrivateKeyTypes,
+    hash_algorithm: typing.Optional[hashes.HashAlgorithm],
+) -> x509.CertificateRevocationList: ...
+
+class Sct: ...
+class Certificate: ...
+class RevokedCertificate: ...
+class CertificateRevocationList: ...
+class CertificateSigningRequest: ...
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b509336233c2fafe4185a49da5909c8bbb38dfd7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__init__.py
@@ -0,0 +1,3 @@
+# 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.
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f89834e7a2f97cfd3c3f89b639ceeb91c28555c1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..155550affa02ae5882b8876bd4b1f3d377ebd961
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/_conditional.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..79f252ccf868c7cffb028326ef7b88d0c552b844
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/__pycache__/binding.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py
new file mode 100644
index 0000000000000000000000000000000000000000..5e8ecd04182ca6768b5a54bfac152e0b7a85baa7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/_conditional.py
@@ -0,0 +1,329 @@
+# 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 annotations
+
+import typing
+
+
+def cryptography_has_set_cert_cb() -> typing.List[str]:
+    return [
+        "SSL_CTX_set_cert_cb",
+        "SSL_set_cert_cb",
+    ]
+
+
+def cryptography_has_ssl_st() -> typing.List[str]:
+    return [
+        "SSL_ST_BEFORE",
+        "SSL_ST_OK",
+        "SSL_ST_INIT",
+        "SSL_ST_RENEGOTIATE",
+    ]
+
+
+def cryptography_has_tls_st() -> typing.List[str]:
+    return [
+        "TLS_ST_BEFORE",
+        "TLS_ST_OK",
+    ]
+
+
+def cryptography_has_evp_pkey_dhx() -> typing.List[str]:
+    return [
+        "EVP_PKEY_DHX",
+    ]
+
+
+def cryptography_has_mem_functions() -> typing.List[str]:
+    return [
+        "Cryptography_CRYPTO_set_mem_functions",
+    ]
+
+
+def cryptography_has_x509_store_ctx_get_issuer() -> typing.List[str]:
+    return [
+        "X509_STORE_set_get_issuer",
+    ]
+
+
+def cryptography_has_ed448() -> typing.List[str]:
+    return [
+        "EVP_PKEY_ED448",
+        "NID_ED448",
+    ]
+
+
+def cryptography_has_ed25519() -> typing.List[str]:
+    return [
+        "NID_ED25519",
+        "EVP_PKEY_ED25519",
+    ]
+
+
+def cryptography_has_poly1305() -> typing.List[str]:
+    return [
+        "NID_poly1305",
+        "EVP_PKEY_POLY1305",
+    ]
+
+
+def cryptography_has_evp_digestfinal_xof() -> typing.List[str]:
+    return [
+        "EVP_DigestFinalXOF",
+    ]
+
+
+def cryptography_has_fips() -> typing.List[str]:
+    return [
+        "FIPS_mode_set",
+        "FIPS_mode",
+    ]
+
+
+def cryptography_has_ssl_sigalgs() -> typing.List[str]:
+    return [
+        "SSL_CTX_set1_sigalgs_list",
+    ]
+
+
+def cryptography_has_psk() -> typing.List[str]:
+    return [
+        "SSL_CTX_use_psk_identity_hint",
+        "SSL_CTX_set_psk_server_callback",
+        "SSL_CTX_set_psk_client_callback",
+    ]
+
+
+def cryptography_has_psk_tlsv13() -> typing.List[str]:
+    return [
+        "SSL_CTX_set_psk_find_session_callback",
+        "SSL_CTX_set_psk_use_session_callback",
+        "Cryptography_SSL_SESSION_new",
+        "SSL_CIPHER_find",
+        "SSL_SESSION_set1_master_key",
+        "SSL_SESSION_set_cipher",
+        "SSL_SESSION_set_protocol_version",
+    ]
+
+
+def cryptography_has_custom_ext() -> typing.List[str]:
+    return [
+        "SSL_CTX_add_client_custom_ext",
+        "SSL_CTX_add_server_custom_ext",
+        "SSL_extension_supported",
+    ]
+
+
+def cryptography_has_tlsv13_functions() -> typing.List[str]:
+    return [
+        "SSL_VERIFY_POST_HANDSHAKE",
+        "SSL_CTX_set_ciphersuites",
+        "SSL_verify_client_post_handshake",
+        "SSL_CTX_set_post_handshake_auth",
+        "SSL_set_post_handshake_auth",
+        "SSL_SESSION_get_max_early_data",
+        "SSL_write_early_data",
+        "SSL_read_early_data",
+        "SSL_CTX_set_max_early_data",
+    ]
+
+
+def cryptography_has_raw_key() -> typing.List[str]:
+    return [
+        "EVP_PKEY_new_raw_private_key",
+        "EVP_PKEY_new_raw_public_key",
+        "EVP_PKEY_get_raw_private_key",
+        "EVP_PKEY_get_raw_public_key",
+    ]
+
+
+def cryptography_has_engine() -> typing.List[str]:
+    return [
+        "ENGINE_by_id",
+        "ENGINE_init",
+        "ENGINE_finish",
+        "ENGINE_get_default_RAND",
+        "ENGINE_set_default_RAND",
+        "ENGINE_unregister_RAND",
+        "ENGINE_ctrl_cmd",
+        "ENGINE_free",
+        "ENGINE_get_name",
+        "ENGINE_ctrl_cmd_string",
+        "ENGINE_load_builtin_engines",
+        "ENGINE_load_private_key",
+        "ENGINE_load_public_key",
+        "SSL_CTX_set_client_cert_engine",
+    ]
+
+
+def cryptography_has_verified_chain() -> typing.List[str]:
+    return [
+        "SSL_get0_verified_chain",
+    ]
+
+
+def cryptography_has_srtp() -> typing.List[str]:
+    return [
+        "SSL_CTX_set_tlsext_use_srtp",
+        "SSL_set_tlsext_use_srtp",
+        "SSL_get_selected_srtp_profile",
+    ]
+
+
+def cryptography_has_providers() -> typing.List[str]:
+    return [
+        "OSSL_PROVIDER_load",
+        "OSSL_PROVIDER_unload",
+        "ERR_LIB_PROV",
+        "PROV_R_WRONG_FINAL_BLOCK_LENGTH",
+        "PROV_R_BAD_DECRYPT",
+    ]
+
+
+def cryptography_has_op_no_renegotiation() -> typing.List[str]:
+    return [
+        "SSL_OP_NO_RENEGOTIATION",
+    ]
+
+
+def cryptography_has_dtls_get_data_mtu() -> typing.List[str]:
+    return [
+        "DTLS_get_data_mtu",
+    ]
+
+
+def cryptography_has_300_fips() -> typing.List[str]:
+    return [
+        "EVP_default_properties_is_fips_enabled",
+        "EVP_default_properties_enable_fips",
+    ]
+
+
+def cryptography_has_ssl_cookie() -> typing.List[str]:
+    return [
+        "SSL_OP_COOKIE_EXCHANGE",
+        "DTLSv1_listen",
+        "SSL_CTX_set_cookie_generate_cb",
+        "SSL_CTX_set_cookie_verify_cb",
+    ]
+
+
+def cryptography_has_pkcs7_funcs() -> typing.List[str]:
+    return [
+        "SMIME_write_PKCS7",
+        "PEM_write_bio_PKCS7_stream",
+        "PKCS7_sign_add_signer",
+        "PKCS7_final",
+        "PKCS7_verify",
+        "SMIME_read_PKCS7",
+        "PKCS7_get0_signers",
+    ]
+
+
+def cryptography_has_bn_flags() -> typing.List[str]:
+    return [
+        "BN_FLG_CONSTTIME",
+        "BN_set_flags",
+        "BN_prime_checks_for_size",
+    ]
+
+
+def cryptography_has_evp_pkey_dh() -> typing.List[str]:
+    return [
+        "EVP_PKEY_set1_DH",
+    ]
+
+
+def cryptography_has_300_evp_cipher() -> typing.List[str]:
+    return ["EVP_CIPHER_fetch", "EVP_CIPHER_free"]
+
+
+def cryptography_has_unexpected_eof_while_reading() -> typing.List[str]:
+    return ["SSL_R_UNEXPECTED_EOF_WHILE_READING"]
+
+
+def cryptography_has_pkcs12_set_mac() -> typing.List[str]:
+    return ["PKCS12_set_mac"]
+
+
+def cryptography_has_ssl_op_ignore_unexpected_eof() -> typing.List[str]:
+    return [
+        "SSL_OP_IGNORE_UNEXPECTED_EOF",
+    ]
+
+
+def cryptography_has_get_extms_support() -> typing.List[str]:
+    return ["SSL_get_extms_support"]
+
+
+def cryptography_has_evp_pkey_set_peer_ex() -> typing.List[str]:
+    return ["EVP_PKEY_derive_set_peer_ex"]
+
+
+def cryptography_has_evp_aead() -> typing.List[str]:
+    return [
+        "EVP_aead_chacha20_poly1305",
+        "EVP_AEAD_CTX_free",
+        "EVP_AEAD_CTX_seal",
+        "EVP_AEAD_CTX_open",
+        "EVP_AEAD_max_overhead",
+        "Cryptography_EVP_AEAD_CTX_new",
+    ]
+
+
+# This is a mapping of
+# {condition: function-returning-names-dependent-on-that-condition} so we can
+# loop over them and delete unsupported names at runtime. It will be removed
+# when cffi supports #if in cdef. We use functions instead of just a dict of
+# lists so we can use coverage to measure which are used.
+CONDITIONAL_NAMES = {
+    "Cryptography_HAS_SET_CERT_CB": cryptography_has_set_cert_cb,
+    "Cryptography_HAS_SSL_ST": cryptography_has_ssl_st,
+    "Cryptography_HAS_TLS_ST": cryptography_has_tls_st,
+    "Cryptography_HAS_EVP_PKEY_DHX": cryptography_has_evp_pkey_dhx,
+    "Cryptography_HAS_MEM_FUNCTIONS": cryptography_has_mem_functions,
+    "Cryptography_HAS_X509_STORE_CTX_GET_ISSUER": (
+        cryptography_has_x509_store_ctx_get_issuer
+    ),
+    "Cryptography_HAS_ED448": cryptography_has_ed448,
+    "Cryptography_HAS_ED25519": cryptography_has_ed25519,
+    "Cryptography_HAS_POLY1305": cryptography_has_poly1305,
+    "Cryptography_HAS_FIPS": cryptography_has_fips,
+    "Cryptography_HAS_SIGALGS": cryptography_has_ssl_sigalgs,
+    "Cryptography_HAS_PSK": cryptography_has_psk,
+    "Cryptography_HAS_PSK_TLSv1_3": cryptography_has_psk_tlsv13,
+    "Cryptography_HAS_CUSTOM_EXT": cryptography_has_custom_ext,
+    "Cryptography_HAS_TLSv1_3_FUNCTIONS": cryptography_has_tlsv13_functions,
+    "Cryptography_HAS_RAW_KEY": cryptography_has_raw_key,
+    "Cryptography_HAS_EVP_DIGESTFINAL_XOF": (
+        cryptography_has_evp_digestfinal_xof
+    ),
+    "Cryptography_HAS_ENGINE": cryptography_has_engine,
+    "Cryptography_HAS_VERIFIED_CHAIN": cryptography_has_verified_chain,
+    "Cryptography_HAS_SRTP": cryptography_has_srtp,
+    "Cryptography_HAS_PROVIDERS": cryptography_has_providers,
+    "Cryptography_HAS_OP_NO_RENEGOTIATION": (
+        cryptography_has_op_no_renegotiation
+    ),
+    "Cryptography_HAS_DTLS_GET_DATA_MTU": cryptography_has_dtls_get_data_mtu,
+    "Cryptography_HAS_300_FIPS": cryptography_has_300_fips,
+    "Cryptography_HAS_SSL_COOKIE": cryptography_has_ssl_cookie,
+    "Cryptography_HAS_PKCS7_FUNCS": cryptography_has_pkcs7_funcs,
+    "Cryptography_HAS_BN_FLAGS": cryptography_has_bn_flags,
+    "Cryptography_HAS_EVP_PKEY_DH": cryptography_has_evp_pkey_dh,
+    "Cryptography_HAS_300_EVP_CIPHER": cryptography_has_300_evp_cipher,
+    "Cryptography_HAS_UNEXPECTED_EOF_WHILE_READING": (
+        cryptography_has_unexpected_eof_while_reading
+    ),
+    "Cryptography_HAS_PKCS12_SET_MAC": cryptography_has_pkcs12_set_mac,
+    "Cryptography_HAS_SSL_OP_IGNORE_UNEXPECTED_EOF": (
+        cryptography_has_ssl_op_ignore_unexpected_eof
+    ),
+    "Cryptography_HAS_GET_EXTMS_SUPPORT": cryptography_has_get_extms_support,
+    "Cryptography_HAS_EVP_PKEY_SET_PEER_EX": (
+        cryptography_has_evp_pkey_set_peer_ex
+    ),
+    "Cryptography_HAS_EVP_AEAD": (cryptography_has_evp_aead),
+}
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py
new file mode 100644
index 0000000000000000000000000000000000000000..b50d631518c1ac7fe8d5e18d1a9ff86fcf661245
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/bindings/openssl/binding.py
@@ -0,0 +1,179 @@
+# 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 annotations
+
+import os
+import sys
+import threading
+import types
+import typing
+import warnings
+
+import cryptography
+from cryptography.exceptions import InternalError
+from cryptography.hazmat.bindings._rust import _openssl, openssl
+from cryptography.hazmat.bindings.openssl._conditional import CONDITIONAL_NAMES
+
+
+def _openssl_assert(
+    lib,
+    ok: bool,
+    errors: typing.Optional[typing.List[openssl.OpenSSLError]] = None,
+) -> None:
+    if not ok:
+        if errors is None:
+            errors = openssl.capture_error_stack()
+
+        raise InternalError(
+            "Unknown OpenSSL error. This error is commonly encountered when "
+            "another library is not cleaning up the OpenSSL error stack. If "
+            "you are using cryptography with another library that uses "
+            "OpenSSL try disabling it before reporting a bug. Otherwise "
+            "please file an issue at https://github.com/pyca/cryptography/"
+            "issues with information on how to reproduce "
+            "this. ({!r})".format(errors),
+            errors,
+        )
+
+
+def _legacy_provider_error(loaded: bool) -> None:
+    if not loaded:
+        raise RuntimeError(
+            "OpenSSL 3.0's legacy provider failed to load. This is a fatal "
+            "error by default, but cryptography supports running without "
+            "legacy algorithms by setting the environment variable "
+            "CRYPTOGRAPHY_OPENSSL_NO_LEGACY. If you did not expect this error,"
+            " you have likely made a mistake with your OpenSSL configuration."
+        )
+
+
+def build_conditional_library(
+    lib: typing.Any,
+    conditional_names: typing.Dict[str, typing.Callable[[], typing.List[str]]],
+) -> typing.Any:
+    conditional_lib = types.ModuleType("lib")
+    conditional_lib._original_lib = lib  # type: ignore[attr-defined]
+    excluded_names = set()
+    for condition, names_cb in conditional_names.items():
+        if not getattr(lib, condition):
+            excluded_names.update(names_cb())
+
+    for attr in dir(lib):
+        if attr not in excluded_names:
+            setattr(conditional_lib, attr, getattr(lib, attr))
+
+    return conditional_lib
+
+
+class Binding:
+    """
+    OpenSSL API wrapper.
+    """
+
+    lib: typing.ClassVar = None
+    ffi = _openssl.ffi
+    _lib_loaded = False
+    _init_lock = threading.Lock()
+    _legacy_provider: typing.Any = ffi.NULL
+    _legacy_provider_loaded = False
+    _default_provider: typing.Any = ffi.NULL
+
+    def __init__(self) -> None:
+        self._ensure_ffi_initialized()
+
+    def _enable_fips(self) -> None:
+        # This function enables FIPS mode for OpenSSL 3.0.0 on installs that
+        # have the FIPS provider installed properly.
+        _openssl_assert(self.lib, self.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER)
+        self._base_provider = self.lib.OSSL_PROVIDER_load(
+            self.ffi.NULL, b"base"
+        )
+        _openssl_assert(self.lib, self._base_provider != self.ffi.NULL)
+        self.lib._fips_provider = self.lib.OSSL_PROVIDER_load(
+            self.ffi.NULL, b"fips"
+        )
+        _openssl_assert(self.lib, self.lib._fips_provider != self.ffi.NULL)
+
+        res = self.lib.EVP_default_properties_enable_fips(self.ffi.NULL, 1)
+        _openssl_assert(self.lib, res == 1)
+
+    @classmethod
+    def _ensure_ffi_initialized(cls) -> None:
+        with cls._init_lock:
+            if not cls._lib_loaded:
+                cls.lib = build_conditional_library(
+                    _openssl.lib, CONDITIONAL_NAMES
+                )
+                cls._lib_loaded = True
+                # As of OpenSSL 3.0.0 we must register a legacy cipher provider
+                # to get RC2 (needed for junk asymmetric private key
+                # serialization), RC4, Blowfish, IDEA, SEED, etc. These things
+                # are ugly legacy, but we aren't going to get rid of them
+                # any time soon.
+                if cls.lib.CRYPTOGRAPHY_OPENSSL_300_OR_GREATER:
+                    if not os.environ.get("CRYPTOGRAPHY_OPENSSL_NO_LEGACY"):
+                        cls._legacy_provider = cls.lib.OSSL_PROVIDER_load(
+                            cls.ffi.NULL, b"legacy"
+                        )
+                        cls._legacy_provider_loaded = (
+                            cls._legacy_provider != cls.ffi.NULL
+                        )
+                        _legacy_provider_error(cls._legacy_provider_loaded)
+
+                    cls._default_provider = cls.lib.OSSL_PROVIDER_load(
+                        cls.ffi.NULL, b"default"
+                    )
+                    _openssl_assert(
+                        cls.lib, cls._default_provider != cls.ffi.NULL
+                    )
+
+    @classmethod
+    def init_static_locks(cls) -> None:
+        cls._ensure_ffi_initialized()
+
+
+def _verify_package_version(version: str) -> None:
+    # Occasionally we run into situations where the version of the Python
+    # package does not match the version of the shared object that is loaded.
+    # This may occur in environments where multiple versions of cryptography
+    # are installed and available in the python path. To avoid errors cropping
+    # up later this code checks that the currently imported package and the
+    # shared object that were loaded have the same version and raise an
+    # ImportError if they do not
+    so_package_version = _openssl.ffi.string(
+        _openssl.lib.CRYPTOGRAPHY_PACKAGE_VERSION
+    )
+    if version.encode("ascii") != so_package_version:
+        raise ImportError(
+            "The version of cryptography does not match the loaded "
+            "shared object. This can happen if you have multiple copies of "
+            "cryptography installed in your Python path. Please try creating "
+            "a new virtual environment to resolve this issue. "
+            "Loaded python version: {}, shared object version: {}".format(
+                version, so_package_version
+            )
+        )
+
+    _openssl_assert(
+        _openssl.lib,
+        _openssl.lib.OpenSSL_version_num() == openssl.openssl_version(),
+    )
+
+
+_verify_package_version(cryptography.__version__)
+
+Binding.init_static_locks()
+
+if (
+    sys.platform == "win32"
+    and os.environ.get("PROCESSOR_ARCHITEW6432") is not None
+):
+    warnings.warn(
+        "You are using cryptography on a 32-bit Python on a 64-bit Windows "
+        "Operating System. Cryptography will be significantly faster if you "
+        "switch to using a 64-bit Python.",
+        UserWarning,
+        stacklevel=2,
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b509336233c2fafe4185a49da5909c8bbb38dfd7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__init__.py
@@ -0,0 +1,3 @@
+# 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.
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a45d555d1c10981b9f5daa0a59456653875a4779
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5d78ccc15244d9f11cfad43d68bc0752c460b8cb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_asymmetric.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ef1f8d61033cea591201da32c71294866870a457
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_cipheralgorithm.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4ac9528c8970898fdc304ec18deb121f2d35585f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/_serialization.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/cmac.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/cmac.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..46cd11d8a9884e97130c8a8a877b76dc27ede9a7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/cmac.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bd58929aa407be512305b13a71dd7c9080921383
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/constant_time.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hashes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hashes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..31e53550d5df4db9833a360452f2d3d02ffc7e04
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hashes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hmac.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hmac.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..998375edad6f8ebb6aa06db12bb9b3d4a4f25c6f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/hmac.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..15555a290f6150b3cb334f635bb40b4abe867875
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/keywrap.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/padding.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/padding.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ebe64d643478cffb2a7d8aa46923f8986eb85c18
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/padding.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..74a7bae5de819c83686ce0fc77f11fc0df1b2d68
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/__pycache__/poly1305.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_asymmetric.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_asymmetric.py
new file mode 100644
index 0000000000000000000000000000000000000000..ea55ffdf1a721f8fd2de8ae67de913bc47cbf55d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_asymmetric.py
@@ -0,0 +1,19 @@
+# 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 annotations
+
+import abc
+
+# This exists to break an import cycle. It is normally accessible from the
+# asymmetric padding module.
+
+
+class AsymmetricPadding(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def name(self) -> str:
+        """
+        A string naming this padding (e.g. "PSS", "PKCS1").
+        """
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b880b64884954a46dcf2c513264e87cb6d6ed07
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_cipheralgorithm.py
@@ -0,0 +1,45 @@
+# 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 annotations
+
+import abc
+import typing
+
+# This exists to break an import cycle. It is normally accessible from the
+# ciphers module.
+
+
+class CipherAlgorithm(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def name(self) -> str:
+        """
+        A string naming this mode (e.g. "AES", "Camellia").
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_sizes(self) -> typing.FrozenSet[int]:
+        """
+        Valid key sizes for this algorithm in bits
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The size of the key being used as an integer in bits (e.g. 128, 256).
+        """
+
+
+class BlockCipherAlgorithm(CipherAlgorithm):
+    key: bytes
+
+    @property
+    @abc.abstractmethod
+    def block_size(self) -> int:
+        """
+        The size of a block as an integer in bits (e.g. 64, 128).
+        """
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_serialization.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_serialization.py
new file mode 100644
index 0000000000000000000000000000000000000000..34f3fbc860266d28e80275fe9e3900c8eba7eb59
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/_serialization.py
@@ -0,0 +1,170 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography import utils
+from cryptography.hazmat.primitives.hashes import HashAlgorithm
+
+# This exists to break an import cycle. These classes are normally accessible
+# from the serialization module.
+
+
+class PBES(utils.Enum):
+    PBESv1SHA1And3KeyTripleDESCBC = "PBESv1 using SHA1 and 3-Key TripleDES"
+    PBESv2SHA256AndAES256CBC = "PBESv2 using SHA256 PBKDF2 and AES256 CBC"
+
+
+class Encoding(utils.Enum):
+    PEM = "PEM"
+    DER = "DER"
+    OpenSSH = "OpenSSH"
+    Raw = "Raw"
+    X962 = "ANSI X9.62"
+    SMIME = "S/MIME"
+
+
+class PrivateFormat(utils.Enum):
+    PKCS8 = "PKCS8"
+    TraditionalOpenSSL = "TraditionalOpenSSL"
+    Raw = "Raw"
+    OpenSSH = "OpenSSH"
+    PKCS12 = "PKCS12"
+
+    def encryption_builder(self) -> KeySerializationEncryptionBuilder:
+        if self not in (PrivateFormat.OpenSSH, PrivateFormat.PKCS12):
+            raise ValueError(
+                "encryption_builder only supported with PrivateFormat.OpenSSH"
+                " and PrivateFormat.PKCS12"
+            )
+        return KeySerializationEncryptionBuilder(self)
+
+
+class PublicFormat(utils.Enum):
+    SubjectPublicKeyInfo = "X.509 subjectPublicKeyInfo with PKCS#1"
+    PKCS1 = "Raw PKCS#1"
+    OpenSSH = "OpenSSH"
+    Raw = "Raw"
+    CompressedPoint = "X9.62 Compressed Point"
+    UncompressedPoint = "X9.62 Uncompressed Point"
+
+
+class ParameterFormat(utils.Enum):
+    PKCS3 = "PKCS3"
+
+
+class KeySerializationEncryption(metaclass=abc.ABCMeta):
+    pass
+
+
+class BestAvailableEncryption(KeySerializationEncryption):
+    def __init__(self, password: bytes):
+        if not isinstance(password, bytes) or len(password) == 0:
+            raise ValueError("Password must be 1 or more bytes.")
+
+        self.password = password
+
+
+class NoEncryption(KeySerializationEncryption):
+    pass
+
+
+class KeySerializationEncryptionBuilder:
+    def __init__(
+        self,
+        format: PrivateFormat,
+        *,
+        _kdf_rounds: typing.Optional[int] = None,
+        _hmac_hash: typing.Optional[HashAlgorithm] = None,
+        _key_cert_algorithm: typing.Optional[PBES] = None,
+    ) -> None:
+        self._format = format
+
+        self._kdf_rounds = _kdf_rounds
+        self._hmac_hash = _hmac_hash
+        self._key_cert_algorithm = _key_cert_algorithm
+
+    def kdf_rounds(self, rounds: int) -> KeySerializationEncryptionBuilder:
+        if self._kdf_rounds is not None:
+            raise ValueError("kdf_rounds already set")
+
+        if not isinstance(rounds, int):
+            raise TypeError("kdf_rounds must be an integer")
+
+        if rounds < 1:
+            raise ValueError("kdf_rounds must be a positive integer")
+
+        return KeySerializationEncryptionBuilder(
+            self._format,
+            _kdf_rounds=rounds,
+            _hmac_hash=self._hmac_hash,
+            _key_cert_algorithm=self._key_cert_algorithm,
+        )
+
+    def hmac_hash(
+        self, algorithm: HashAlgorithm
+    ) -> KeySerializationEncryptionBuilder:
+        if self._format is not PrivateFormat.PKCS12:
+            raise TypeError(
+                "hmac_hash only supported with PrivateFormat.PKCS12"
+            )
+
+        if self._hmac_hash is not None:
+            raise ValueError("hmac_hash already set")
+        return KeySerializationEncryptionBuilder(
+            self._format,
+            _kdf_rounds=self._kdf_rounds,
+            _hmac_hash=algorithm,
+            _key_cert_algorithm=self._key_cert_algorithm,
+        )
+
+    def key_cert_algorithm(
+        self, algorithm: PBES
+    ) -> KeySerializationEncryptionBuilder:
+        if self._format is not PrivateFormat.PKCS12:
+            raise TypeError(
+                "key_cert_algorithm only supported with "
+                "PrivateFormat.PKCS12"
+            )
+        if self._key_cert_algorithm is not None:
+            raise ValueError("key_cert_algorithm already set")
+        return KeySerializationEncryptionBuilder(
+            self._format,
+            _kdf_rounds=self._kdf_rounds,
+            _hmac_hash=self._hmac_hash,
+            _key_cert_algorithm=algorithm,
+        )
+
+    def build(self, password: bytes) -> KeySerializationEncryption:
+        if not isinstance(password, bytes) or len(password) == 0:
+            raise ValueError("Password must be 1 or more bytes.")
+
+        return _KeySerializationEncryption(
+            self._format,
+            password,
+            kdf_rounds=self._kdf_rounds,
+            hmac_hash=self._hmac_hash,
+            key_cert_algorithm=self._key_cert_algorithm,
+        )
+
+
+class _KeySerializationEncryption(KeySerializationEncryption):
+    def __init__(
+        self,
+        format: PrivateFormat,
+        password: bytes,
+        *,
+        kdf_rounds: typing.Optional[int],
+        hmac_hash: typing.Optional[HashAlgorithm],
+        key_cert_algorithm: typing.Optional[PBES],
+    ):
+        self._format = format
+        self.password = password
+
+        self._kdf_rounds = kdf_rounds
+        self._hmac_hash = hmac_hash
+        self._key_cert_algorithm = key_cert_algorithm
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b509336233c2fafe4185a49da5909c8bbb38dfd7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__init__.py
@@ -0,0 +1,3 @@
+# 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.
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..692806a7aa4900a94d67695bca2bb2b097515126
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dc4f9241f227d1c83742933bcea920a308229ed0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dh.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..60bd8c6511ffa06dfbca32f44f14dcdbd73ac5fe
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/dsa.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1c6c31466e7467a466ed9e0063dd0473fbc8a292
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ec.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..46b9a27f9381f9c2c59fc1c9505cf88d632d2b3e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed25519.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..07d6ae5d332bbf358ad3d61ee17652a4d7952650
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/ed448.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..15ab9fab7066f381f7d625c647776023f09aa5c8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/padding.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..de664843cca1c340aee6b72f0c5c831a3f65d0e8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/rsa.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5603eccb7059283995be86ac05c8cc1cebc1199d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/types.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a2fd600207c812a619593dfdca44e357da8a497a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..60be8e6f65ce7892caa8b97777d8f3a10a3aba46
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x25519.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..94dc1119fa714e17c5525f24054fef43427dad00
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/__pycache__/x448.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dh.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dh.py
new file mode 100644
index 0000000000000000000000000000000000000000..751bcc402e9417b6e7b9a72e92052c83fcc65751
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dh.py
@@ -0,0 +1,261 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization
+
+
+def generate_parameters(
+    generator: int, key_size: int, backend: typing.Any = None
+) -> DHParameters:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.generate_dh_parameters(generator, key_size)
+
+
+class DHParameterNumbers:
+    def __init__(self, p: int, g: int, q: typing.Optional[int] = None) -> None:
+        if not isinstance(p, int) or not isinstance(g, int):
+            raise TypeError("p and g must be integers")
+        if q is not None and not isinstance(q, int):
+            raise TypeError("q must be integer or None")
+
+        if g < 2:
+            raise ValueError("DH generator must be 2 or greater")
+
+        if p.bit_length() < rust_openssl.dh.MIN_MODULUS_SIZE:
+            raise ValueError(
+                f"p (modulus) must be at least "
+                f"{rust_openssl.dh.MIN_MODULUS_SIZE}-bit"
+            )
+
+        self._p = p
+        self._g = g
+        self._q = q
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DHParameterNumbers):
+            return NotImplemented
+
+        return (
+            self._p == other._p and self._g == other._g and self._q == other._q
+        )
+
+    def parameters(self, backend: typing.Any = None) -> DHParameters:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dh_parameter_numbers(self)
+
+    @property
+    def p(self) -> int:
+        return self._p
+
+    @property
+    def g(self) -> int:
+        return self._g
+
+    @property
+    def q(self) -> typing.Optional[int]:
+        return self._q
+
+
+class DHPublicNumbers:
+    def __init__(self, y: int, parameter_numbers: DHParameterNumbers) -> None:
+        if not isinstance(y, int):
+            raise TypeError("y must be an integer.")
+
+        if not isinstance(parameter_numbers, DHParameterNumbers):
+            raise TypeError(
+                "parameters must be an instance of DHParameterNumbers."
+            )
+
+        self._y = y
+        self._parameter_numbers = parameter_numbers
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DHPublicNumbers):
+            return NotImplemented
+
+        return (
+            self._y == other._y
+            and self._parameter_numbers == other._parameter_numbers
+        )
+
+    def public_key(self, backend: typing.Any = None) -> DHPublicKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dh_public_numbers(self)
+
+    @property
+    def y(self) -> int:
+        return self._y
+
+    @property
+    def parameter_numbers(self) -> DHParameterNumbers:
+        return self._parameter_numbers
+
+
+class DHPrivateNumbers:
+    def __init__(self, x: int, public_numbers: DHPublicNumbers) -> None:
+        if not isinstance(x, int):
+            raise TypeError("x must be an integer.")
+
+        if not isinstance(public_numbers, DHPublicNumbers):
+            raise TypeError(
+                "public_numbers must be an instance of " "DHPublicNumbers."
+            )
+
+        self._x = x
+        self._public_numbers = public_numbers
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DHPrivateNumbers):
+            return NotImplemented
+
+        return (
+            self._x == other._x
+            and self._public_numbers == other._public_numbers
+        )
+
+    def private_key(self, backend: typing.Any = None) -> DHPrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dh_private_numbers(self)
+
+    @property
+    def public_numbers(self) -> DHPublicNumbers:
+        return self._public_numbers
+
+    @property
+    def x(self) -> int:
+        return self._x
+
+
+class DHParameters(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def generate_private_key(self) -> DHPrivateKey:
+        """
+        Generates and returns a DHPrivateKey.
+        """
+
+    @abc.abstractmethod
+    def parameter_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.ParameterFormat,
+    ) -> bytes:
+        """
+        Returns the parameters serialized as bytes.
+        """
+
+    @abc.abstractmethod
+    def parameter_numbers(self) -> DHParameterNumbers:
+        """
+        Returns a DHParameterNumbers.
+        """
+
+
+DHParametersWithSerialization = DHParameters
+DHParameters.register(rust_openssl.dh.DHParameters)
+
+
+class DHPublicKey(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the prime modulus.
+        """
+
+    @abc.abstractmethod
+    def parameters(self) -> DHParameters:
+        """
+        The DHParameters object associated with this public key.
+        """
+
+    @abc.abstractmethod
+    def public_numbers(self) -> DHPublicNumbers:
+        """
+        Returns a DHPublicNumbers.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+DHPublicKeyWithSerialization = DHPublicKey
+DHPublicKey.register(rust_openssl.dh.DHPublicKey)
+
+
+class DHPrivateKey(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the prime modulus.
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> DHPublicKey:
+        """
+        The DHPublicKey associated with this private key.
+        """
+
+    @abc.abstractmethod
+    def parameters(self) -> DHParameters:
+        """
+        The DHParameters object associated with this private key.
+        """
+
+    @abc.abstractmethod
+    def exchange(self, peer_public_key: DHPublicKey) -> bytes:
+        """
+        Given peer's DHPublicKey, carry out the key exchange and
+        return shared key as bytes.
+        """
+
+    @abc.abstractmethod
+    def private_numbers(self) -> DHPrivateNumbers:
+        """
+        Returns a DHPrivateNumbers.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+
+DHPrivateKeyWithSerialization = DHPrivateKey
+DHPrivateKey.register(rust_openssl.dh.DHPrivateKey)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py
new file mode 100644
index 0000000000000000000000000000000000000000..a8c52de4fb49fb1129e0acb806af1834be9d6b7d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/dsa.py
@@ -0,0 +1,299 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization, hashes
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
+
+
+class DSAParameters(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def generate_private_key(self) -> DSAPrivateKey:
+        """
+        Generates and returns a DSAPrivateKey.
+        """
+
+    @abc.abstractmethod
+    def parameter_numbers(self) -> DSAParameterNumbers:
+        """
+        Returns a DSAParameterNumbers.
+        """
+
+
+DSAParametersWithNumbers = DSAParameters
+DSAParameters.register(rust_openssl.dsa.DSAParameters)
+
+
+class DSAPrivateKey(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the prime modulus.
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> DSAPublicKey:
+        """
+        The DSAPublicKey associated with this private key.
+        """
+
+    @abc.abstractmethod
+    def parameters(self) -> DSAParameters:
+        """
+        The DSAParameters object associated with this private key.
+        """
+
+    @abc.abstractmethod
+    def sign(
+        self,
+        data: bytes,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> bytes:
+        """
+        Signs the data
+        """
+
+    @abc.abstractmethod
+    def private_numbers(self) -> DSAPrivateNumbers:
+        """
+        Returns a DSAPrivateNumbers.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+
+DSAPrivateKeyWithSerialization = DSAPrivateKey
+DSAPrivateKey.register(rust_openssl.dsa.DSAPrivateKey)
+
+
+class DSAPublicKey(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the prime modulus.
+        """
+
+    @abc.abstractmethod
+    def parameters(self) -> DSAParameters:
+        """
+        The DSAParameters object associated with this public key.
+        """
+
+    @abc.abstractmethod
+    def public_numbers(self) -> DSAPublicNumbers:
+        """
+        Returns a DSAPublicNumbers.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+    @abc.abstractmethod
+    def verify(
+        self,
+        signature: bytes,
+        data: bytes,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> None:
+        """
+        Verifies the signature of the data.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+DSAPublicKeyWithSerialization = DSAPublicKey
+DSAPublicKey.register(rust_openssl.dsa.DSAPublicKey)
+
+
+class DSAParameterNumbers:
+    def __init__(self, p: int, q: int, g: int):
+        if (
+            not isinstance(p, int)
+            or not isinstance(q, int)
+            or not isinstance(g, int)
+        ):
+            raise TypeError(
+                "DSAParameterNumbers p, q, and g arguments must be integers."
+            )
+
+        self._p = p
+        self._q = q
+        self._g = g
+
+    @property
+    def p(self) -> int:
+        return self._p
+
+    @property
+    def q(self) -> int:
+        return self._q
+
+    @property
+    def g(self) -> int:
+        return self._g
+
+    def parameters(self, backend: typing.Any = None) -> DSAParameters:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dsa_parameter_numbers(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DSAParameterNumbers):
+            return NotImplemented
+
+        return self.p == other.p and self.q == other.q and self.g == other.g
+
+    def __repr__(self) -> str:
+        return (
+            "<DSAParameterNumbers(p={self.p}, q={self.q}, "
+            "g={self.g})>".format(self=self)
+        )
+
+
+class DSAPublicNumbers:
+    def __init__(self, y: int, parameter_numbers: DSAParameterNumbers):
+        if not isinstance(y, int):
+            raise TypeError("DSAPublicNumbers y argument must be an integer.")
+
+        if not isinstance(parameter_numbers, DSAParameterNumbers):
+            raise TypeError(
+                "parameter_numbers must be a DSAParameterNumbers instance."
+            )
+
+        self._y = y
+        self._parameter_numbers = parameter_numbers
+
+    @property
+    def y(self) -> int:
+        return self._y
+
+    @property
+    def parameter_numbers(self) -> DSAParameterNumbers:
+        return self._parameter_numbers
+
+    def public_key(self, backend: typing.Any = None) -> DSAPublicKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dsa_public_numbers(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DSAPublicNumbers):
+            return NotImplemented
+
+        return (
+            self.y == other.y
+            and self.parameter_numbers == other.parameter_numbers
+        )
+
+    def __repr__(self) -> str:
+        return (
+            "<DSAPublicNumbers(y={self.y}, "
+            "parameter_numbers={self.parameter_numbers})>".format(self=self)
+        )
+
+
+class DSAPrivateNumbers:
+    def __init__(self, x: int, public_numbers: DSAPublicNumbers):
+        if not isinstance(x, int):
+            raise TypeError("DSAPrivateNumbers x argument must be an integer.")
+
+        if not isinstance(public_numbers, DSAPublicNumbers):
+            raise TypeError(
+                "public_numbers must be a DSAPublicNumbers instance."
+            )
+        self._public_numbers = public_numbers
+        self._x = x
+
+    @property
+    def x(self) -> int:
+        return self._x
+
+    @property
+    def public_numbers(self) -> DSAPublicNumbers:
+        return self._public_numbers
+
+    def private_key(self, backend: typing.Any = None) -> DSAPrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_dsa_private_numbers(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DSAPrivateNumbers):
+            return NotImplemented
+
+        return (
+            self.x == other.x and self.public_numbers == other.public_numbers
+        )
+
+
+def generate_parameters(
+    key_size: int, backend: typing.Any = None
+) -> DSAParameters:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.generate_dsa_parameters(key_size)
+
+
+def generate_private_key(
+    key_size: int, backend: typing.Any = None
+) -> DSAPrivateKey:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.generate_dsa_private_key_and_parameters(key_size)
+
+
+def _check_dsa_parameters(parameters: DSAParameterNumbers) -> None:
+    if parameters.p.bit_length() not in [1024, 2048, 3072, 4096]:
+        raise ValueError(
+            "p must be exactly 1024, 2048, 3072, or 4096 bits long"
+        )
+    if parameters.q.bit_length() not in [160, 224, 256]:
+        raise ValueError("q must be exactly 160, 224, or 256 bits long")
+
+    if not (1 < parameters.g < parameters.p):
+        raise ValueError("g, p don't satisfy 1 < g < p.")
+
+
+def _check_dsa_private_numbers(numbers: DSAPrivateNumbers) -> None:
+    parameters = numbers.public_numbers.parameter_numbers
+    _check_dsa_parameters(parameters)
+    if numbers.x <= 0 or numbers.x >= parameters.q:
+        raise ValueError("x must be > 0 and < q.")
+
+    if numbers.public_numbers.y != pow(parameters.g, numbers.x, parameters.p):
+        raise ValueError("y must be equal to (g ** x % p).")
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py
new file mode 100644
index 0000000000000000000000000000000000000000..ddfaabf4f3e4e9807132e6fd6e1d23278f405f02
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ec.py
@@ -0,0 +1,490 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography import utils
+from cryptography.hazmat._oid import ObjectIdentifier
+from cryptography.hazmat.primitives import _serialization, hashes
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
+
+
+class EllipticCurveOID:
+    SECP192R1 = ObjectIdentifier("1.2.840.10045.3.1.1")
+    SECP224R1 = ObjectIdentifier("1.3.132.0.33")
+    SECP256K1 = ObjectIdentifier("1.3.132.0.10")
+    SECP256R1 = ObjectIdentifier("1.2.840.10045.3.1.7")
+    SECP384R1 = ObjectIdentifier("1.3.132.0.34")
+    SECP521R1 = ObjectIdentifier("1.3.132.0.35")
+    BRAINPOOLP256R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.7")
+    BRAINPOOLP384R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.11")
+    BRAINPOOLP512R1 = ObjectIdentifier("1.3.36.3.3.2.8.1.1.13")
+    SECT163K1 = ObjectIdentifier("1.3.132.0.1")
+    SECT163R2 = ObjectIdentifier("1.3.132.0.15")
+    SECT233K1 = ObjectIdentifier("1.3.132.0.26")
+    SECT233R1 = ObjectIdentifier("1.3.132.0.27")
+    SECT283K1 = ObjectIdentifier("1.3.132.0.16")
+    SECT283R1 = ObjectIdentifier("1.3.132.0.17")
+    SECT409K1 = ObjectIdentifier("1.3.132.0.36")
+    SECT409R1 = ObjectIdentifier("1.3.132.0.37")
+    SECT571K1 = ObjectIdentifier("1.3.132.0.38")
+    SECT571R1 = ObjectIdentifier("1.3.132.0.39")
+
+
+class EllipticCurve(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def name(self) -> str:
+        """
+        The name of the curve. e.g. secp256r1.
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        Bit size of a secret scalar for the curve.
+        """
+
+
+class EllipticCurveSignatureAlgorithm(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def algorithm(
+        self,
+    ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]:
+        """
+        The digest algorithm used with this signature.
+        """
+
+
+class EllipticCurvePrivateKey(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def exchange(
+        self, algorithm: ECDH, peer_public_key: EllipticCurvePublicKey
+    ) -> bytes:
+        """
+        Performs a key exchange operation using the provided algorithm with the
+        provided peer's public key.
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> EllipticCurvePublicKey:
+        """
+        The EllipticCurvePublicKey for this private key.
+        """
+
+    @property
+    @abc.abstractmethod
+    def curve(self) -> EllipticCurve:
+        """
+        The EllipticCurve that this key is on.
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        Bit size of a secret scalar for the curve.
+        """
+
+    @abc.abstractmethod
+    def sign(
+        self,
+        data: bytes,
+        signature_algorithm: EllipticCurveSignatureAlgorithm,
+    ) -> bytes:
+        """
+        Signs the data
+        """
+
+    @abc.abstractmethod
+    def private_numbers(self) -> EllipticCurvePrivateNumbers:
+        """
+        Returns an EllipticCurvePrivateNumbers.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+
+EllipticCurvePrivateKeyWithSerialization = EllipticCurvePrivateKey
+
+
+class EllipticCurvePublicKey(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def curve(self) -> EllipticCurve:
+        """
+        The EllipticCurve that this key is on.
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        Bit size of a secret scalar for the curve.
+        """
+
+    @abc.abstractmethod
+    def public_numbers(self) -> EllipticCurvePublicNumbers:
+        """
+        Returns an EllipticCurvePublicNumbers.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+    @abc.abstractmethod
+    def verify(
+        self,
+        signature: bytes,
+        data: bytes,
+        signature_algorithm: EllipticCurveSignatureAlgorithm,
+    ) -> None:
+        """
+        Verifies the signature of the data.
+        """
+
+    @classmethod
+    def from_encoded_point(
+        cls, curve: EllipticCurve, data: bytes
+    ) -> EllipticCurvePublicKey:
+        utils._check_bytes("data", data)
+
+        if not isinstance(curve, EllipticCurve):
+            raise TypeError("curve must be an EllipticCurve instance")
+
+        if len(data) == 0:
+            raise ValueError("data must not be an empty byte string")
+
+        if data[0] not in [0x02, 0x03, 0x04]:
+            raise ValueError("Unsupported elliptic curve point type")
+
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        return backend.load_elliptic_curve_public_bytes(curve, data)
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+EllipticCurvePublicKeyWithSerialization = EllipticCurvePublicKey
+
+
+class SECT571R1(EllipticCurve):
+    name = "sect571r1"
+    key_size = 570
+
+
+class SECT409R1(EllipticCurve):
+    name = "sect409r1"
+    key_size = 409
+
+
+class SECT283R1(EllipticCurve):
+    name = "sect283r1"
+    key_size = 283
+
+
+class SECT233R1(EllipticCurve):
+    name = "sect233r1"
+    key_size = 233
+
+
+class SECT163R2(EllipticCurve):
+    name = "sect163r2"
+    key_size = 163
+
+
+class SECT571K1(EllipticCurve):
+    name = "sect571k1"
+    key_size = 571
+
+
+class SECT409K1(EllipticCurve):
+    name = "sect409k1"
+    key_size = 409
+
+
+class SECT283K1(EllipticCurve):
+    name = "sect283k1"
+    key_size = 283
+
+
+class SECT233K1(EllipticCurve):
+    name = "sect233k1"
+    key_size = 233
+
+
+class SECT163K1(EllipticCurve):
+    name = "sect163k1"
+    key_size = 163
+
+
+class SECP521R1(EllipticCurve):
+    name = "secp521r1"
+    key_size = 521
+
+
+class SECP384R1(EllipticCurve):
+    name = "secp384r1"
+    key_size = 384
+
+
+class SECP256R1(EllipticCurve):
+    name = "secp256r1"
+    key_size = 256
+
+
+class SECP256K1(EllipticCurve):
+    name = "secp256k1"
+    key_size = 256
+
+
+class SECP224R1(EllipticCurve):
+    name = "secp224r1"
+    key_size = 224
+
+
+class SECP192R1(EllipticCurve):
+    name = "secp192r1"
+    key_size = 192
+
+
+class BrainpoolP256R1(EllipticCurve):
+    name = "brainpoolP256r1"
+    key_size = 256
+
+
+class BrainpoolP384R1(EllipticCurve):
+    name = "brainpoolP384r1"
+    key_size = 384
+
+
+class BrainpoolP512R1(EllipticCurve):
+    name = "brainpoolP512r1"
+    key_size = 512
+
+
+_CURVE_TYPES: typing.Dict[str, typing.Type[EllipticCurve]] = {
+    "prime192v1": SECP192R1,
+    "prime256v1": SECP256R1,
+    "secp192r1": SECP192R1,
+    "secp224r1": SECP224R1,
+    "secp256r1": SECP256R1,
+    "secp384r1": SECP384R1,
+    "secp521r1": SECP521R1,
+    "secp256k1": SECP256K1,
+    "sect163k1": SECT163K1,
+    "sect233k1": SECT233K1,
+    "sect283k1": SECT283K1,
+    "sect409k1": SECT409K1,
+    "sect571k1": SECT571K1,
+    "sect163r2": SECT163R2,
+    "sect233r1": SECT233R1,
+    "sect283r1": SECT283R1,
+    "sect409r1": SECT409R1,
+    "sect571r1": SECT571R1,
+    "brainpoolP256r1": BrainpoolP256R1,
+    "brainpoolP384r1": BrainpoolP384R1,
+    "brainpoolP512r1": BrainpoolP512R1,
+}
+
+
+class ECDSA(EllipticCurveSignatureAlgorithm):
+    def __init__(
+        self,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ):
+        self._algorithm = algorithm
+
+    @property
+    def algorithm(
+        self,
+    ) -> typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm]:
+        return self._algorithm
+
+
+def generate_private_key(
+    curve: EllipticCurve, backend: typing.Any = None
+) -> EllipticCurvePrivateKey:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.generate_elliptic_curve_private_key(curve)
+
+
+def derive_private_key(
+    private_value: int,
+    curve: EllipticCurve,
+    backend: typing.Any = None,
+) -> EllipticCurvePrivateKey:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    if not isinstance(private_value, int):
+        raise TypeError("private_value must be an integer type.")
+
+    if private_value <= 0:
+        raise ValueError("private_value must be a positive integer.")
+
+    if not isinstance(curve, EllipticCurve):
+        raise TypeError("curve must provide the EllipticCurve interface.")
+
+    return ossl.derive_elliptic_curve_private_key(private_value, curve)
+
+
+class EllipticCurvePublicNumbers:
+    def __init__(self, x: int, y: int, curve: EllipticCurve):
+        if not isinstance(x, int) or not isinstance(y, int):
+            raise TypeError("x and y must be integers.")
+
+        if not isinstance(curve, EllipticCurve):
+            raise TypeError("curve must provide the EllipticCurve interface.")
+
+        self._y = y
+        self._x = x
+        self._curve = curve
+
+    def public_key(self, backend: typing.Any = None) -> EllipticCurvePublicKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_elliptic_curve_public_numbers(self)
+
+    @property
+    def curve(self) -> EllipticCurve:
+        return self._curve
+
+    @property
+    def x(self) -> int:
+        return self._x
+
+    @property
+    def y(self) -> int:
+        return self._y
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, EllipticCurvePublicNumbers):
+            return NotImplemented
+
+        return (
+            self.x == other.x
+            and self.y == other.y
+            and self.curve.name == other.curve.name
+            and self.curve.key_size == other.curve.key_size
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.x, self.y, self.curve.name, self.curve.key_size))
+
+    def __repr__(self) -> str:
+        return (
+            "<EllipticCurvePublicNumbers(curve={0.curve.name}, x={0.x}, "
+            "y={0.y}>".format(self)
+        )
+
+
+class EllipticCurvePrivateNumbers:
+    def __init__(
+        self, private_value: int, public_numbers: EllipticCurvePublicNumbers
+    ):
+        if not isinstance(private_value, int):
+            raise TypeError("private_value must be an integer.")
+
+        if not isinstance(public_numbers, EllipticCurvePublicNumbers):
+            raise TypeError(
+                "public_numbers must be an EllipticCurvePublicNumbers "
+                "instance."
+            )
+
+        self._private_value = private_value
+        self._public_numbers = public_numbers
+
+    def private_key(
+        self, backend: typing.Any = None
+    ) -> EllipticCurvePrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_elliptic_curve_private_numbers(self)
+
+    @property
+    def private_value(self) -> int:
+        return self._private_value
+
+    @property
+    def public_numbers(self) -> EllipticCurvePublicNumbers:
+        return self._public_numbers
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, EllipticCurvePrivateNumbers):
+            return NotImplemented
+
+        return (
+            self.private_value == other.private_value
+            and self.public_numbers == other.public_numbers
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.private_value, self.public_numbers))
+
+
+class ECDH:
+    pass
+
+
+_OID_TO_CURVE = {
+    EllipticCurveOID.SECP192R1: SECP192R1,
+    EllipticCurveOID.SECP224R1: SECP224R1,
+    EllipticCurveOID.SECP256K1: SECP256K1,
+    EllipticCurveOID.SECP256R1: SECP256R1,
+    EllipticCurveOID.SECP384R1: SECP384R1,
+    EllipticCurveOID.SECP521R1: SECP521R1,
+    EllipticCurveOID.BRAINPOOLP256R1: BrainpoolP256R1,
+    EllipticCurveOID.BRAINPOOLP384R1: BrainpoolP384R1,
+    EllipticCurveOID.BRAINPOOLP512R1: BrainpoolP512R1,
+    EllipticCurveOID.SECT163K1: SECT163K1,
+    EllipticCurveOID.SECT163R2: SECT163R2,
+    EllipticCurveOID.SECT233K1: SECT233K1,
+    EllipticCurveOID.SECT233R1: SECT233R1,
+    EllipticCurveOID.SECT283K1: SECT283K1,
+    EllipticCurveOID.SECT283R1: SECT283R1,
+    EllipticCurveOID.SECT409K1: SECT409K1,
+    EllipticCurveOID.SECT409R1: SECT409R1,
+    EllipticCurveOID.SECT571K1: SECT571K1,
+    EllipticCurveOID.SECT571R1: SECT571R1,
+}
+
+
+def get_curve_for_oid(oid: ObjectIdentifier) -> typing.Type[EllipticCurve]:
+    try:
+        return _OID_TO_CURVE[oid]
+    except KeyError:
+        raise LookupError(
+            "The provided object identifier has no matching elliptic "
+            "curve class"
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py
new file mode 100644
index 0000000000000000000000000000000000000000..f26e54d24ec50e9dd42abb5dbae75525535a441b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed25519.py
@@ -0,0 +1,118 @@
+# 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 annotations
+
+import abc
+
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization
+
+
+class Ed25519PublicKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def from_public_bytes(cls, data: bytes) -> Ed25519PublicKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed25519_supported():
+            raise UnsupportedAlgorithm(
+                "ed25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+
+        return backend.ed25519_load_public_bytes(data)
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        The serialized bytes of the public key.
+        """
+
+    @abc.abstractmethod
+    def public_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the public key.
+        Equivalent to public_bytes(Raw, Raw).
+        """
+
+    @abc.abstractmethod
+    def verify(self, signature: bytes, data: bytes) -> None:
+        """
+        Verify the signature.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+if hasattr(rust_openssl, "ed25519"):
+    Ed25519PublicKey.register(rust_openssl.ed25519.Ed25519PublicKey)
+
+
+class Ed25519PrivateKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def generate(cls) -> Ed25519PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed25519_supported():
+            raise UnsupportedAlgorithm(
+                "ed25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+
+        return backend.ed25519_generate_key()
+
+    @classmethod
+    def from_private_bytes(cls, data: bytes) -> Ed25519PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed25519_supported():
+            raise UnsupportedAlgorithm(
+                "ed25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+
+        return backend.ed25519_load_private_bytes(data)
+
+    @abc.abstractmethod
+    def public_key(self) -> Ed25519PublicKey:
+        """
+        The Ed25519PublicKey derived from the private key.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        The serialized bytes of the private key.
+        """
+
+    @abc.abstractmethod
+    def private_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the private key.
+        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
+        """
+
+    @abc.abstractmethod
+    def sign(self, data: bytes) -> bytes:
+        """
+        Signs the data.
+        """
+
+
+if hasattr(rust_openssl, "x25519"):
+    Ed25519PrivateKey.register(rust_openssl.ed25519.Ed25519PrivateKey)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed448.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed448.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9a34b251b01178d6211111ee81c036ad908dc97
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/ed448.py
@@ -0,0 +1,117 @@
+# 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 annotations
+
+import abc
+
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization
+
+
+class Ed448PublicKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def from_public_bytes(cls, data: bytes) -> Ed448PublicKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed448_supported():
+            raise UnsupportedAlgorithm(
+                "ed448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+
+        return backend.ed448_load_public_bytes(data)
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        The serialized bytes of the public key.
+        """
+
+    @abc.abstractmethod
+    def public_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the public key.
+        Equivalent to public_bytes(Raw, Raw).
+        """
+
+    @abc.abstractmethod
+    def verify(self, signature: bytes, data: bytes) -> None:
+        """
+        Verify the signature.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+if hasattr(rust_openssl, "ed448"):
+    Ed448PublicKey.register(rust_openssl.ed448.Ed448PublicKey)
+
+
+class Ed448PrivateKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def generate(cls) -> Ed448PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed448_supported():
+            raise UnsupportedAlgorithm(
+                "ed448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+        return backend.ed448_generate_key()
+
+    @classmethod
+    def from_private_bytes(cls, data: bytes) -> Ed448PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.ed448_supported():
+            raise UnsupportedAlgorithm(
+                "ed448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_PUBLIC_KEY_ALGORITHM,
+            )
+
+        return backend.ed448_load_private_bytes(data)
+
+    @abc.abstractmethod
+    def public_key(self) -> Ed448PublicKey:
+        """
+        The Ed448PublicKey derived from the private key.
+        """
+
+    @abc.abstractmethod
+    def sign(self, data: bytes) -> bytes:
+        """
+        Signs the data.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        The serialized bytes of the private key.
+        """
+
+    @abc.abstractmethod
+    def private_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the private key.
+        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
+        """
+
+
+if hasattr(rust_openssl, "x448"):
+    Ed448PrivateKey.register(rust_openssl.ed448.Ed448PrivateKey)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py
new file mode 100644
index 0000000000000000000000000000000000000000..7198808effd0d68a7cac9b338814ac1fb2e30234
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/padding.py
@@ -0,0 +1,102 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives._asymmetric import (
+    AsymmetricPadding as AsymmetricPadding,
+)
+from cryptography.hazmat.primitives.asymmetric import rsa
+
+
+class PKCS1v15(AsymmetricPadding):
+    name = "EMSA-PKCS1-v1_5"
+
+
+class _MaxLength:
+    "Sentinel value for `MAX_LENGTH`."
+
+
+class _Auto:
+    "Sentinel value for `AUTO`."
+
+
+class _DigestLength:
+    "Sentinel value for `DIGEST_LENGTH`."
+
+
+class PSS(AsymmetricPadding):
+    MAX_LENGTH = _MaxLength()
+    AUTO = _Auto()
+    DIGEST_LENGTH = _DigestLength()
+    name = "EMSA-PSS"
+    _salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength]
+
+    def __init__(
+        self,
+        mgf: MGF,
+        salt_length: typing.Union[int, _MaxLength, _Auto, _DigestLength],
+    ) -> None:
+        self._mgf = mgf
+
+        if not isinstance(
+            salt_length, (int, _MaxLength, _Auto, _DigestLength)
+        ):
+            raise TypeError(
+                "salt_length must be an integer, MAX_LENGTH, "
+                "DIGEST_LENGTH, or AUTO"
+            )
+
+        if isinstance(salt_length, int) and salt_length < 0:
+            raise ValueError("salt_length must be zero or greater.")
+
+        self._salt_length = salt_length
+
+
+class OAEP(AsymmetricPadding):
+    name = "EME-OAEP"
+
+    def __init__(
+        self,
+        mgf: MGF,
+        algorithm: hashes.HashAlgorithm,
+        label: typing.Optional[bytes],
+    ):
+        if not isinstance(algorithm, hashes.HashAlgorithm):
+            raise TypeError("Expected instance of hashes.HashAlgorithm.")
+
+        self._mgf = mgf
+        self._algorithm = algorithm
+        self._label = label
+
+
+class MGF(metaclass=abc.ABCMeta):
+    _algorithm: hashes.HashAlgorithm
+
+
+class MGF1(MGF):
+    MAX_LENGTH = _MaxLength()
+
+    def __init__(self, algorithm: hashes.HashAlgorithm):
+        if not isinstance(algorithm, hashes.HashAlgorithm):
+            raise TypeError("Expected instance of hashes.HashAlgorithm.")
+
+        self._algorithm = algorithm
+
+
+def calculate_max_pss_salt_length(
+    key: typing.Union[rsa.RSAPrivateKey, rsa.RSAPublicKey],
+    hash_algorithm: hashes.HashAlgorithm,
+) -> int:
+    if not isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)):
+        raise TypeError("key must be an RSA public or private key")
+    # bit length - 1 per RFC 3447
+    emlen = (key.key_size + 6) // 8
+    salt_length = emlen - hash_algorithm.digest_size - 2
+    assert salt_length >= 0
+    return salt_length
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py
new file mode 100644
index 0000000000000000000000000000000000000000..b740f01f7c4cb67da3d5af4019e0b56d458b2658
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/rsa.py
@@ -0,0 +1,439 @@
+# 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 annotations
+
+import abc
+import typing
+from math import gcd
+
+from cryptography.hazmat.primitives import _serialization, hashes
+from cryptography.hazmat.primitives._asymmetric import AsymmetricPadding
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
+
+
+class RSAPrivateKey(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def decrypt(self, ciphertext: bytes, padding: AsymmetricPadding) -> bytes:
+        """
+        Decrypts the provided ciphertext.
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the public modulus.
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> RSAPublicKey:
+        """
+        The RSAPublicKey associated with this private key.
+        """
+
+    @abc.abstractmethod
+    def sign(
+        self,
+        data: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> bytes:
+        """
+        Signs the data.
+        """
+
+    @abc.abstractmethod
+    def private_numbers(self) -> RSAPrivateNumbers:
+        """
+        Returns an RSAPrivateNumbers.
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+
+RSAPrivateKeyWithSerialization = RSAPrivateKey
+
+
+class RSAPublicKey(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def encrypt(self, plaintext: bytes, padding: AsymmetricPadding) -> bytes:
+        """
+        Encrypts the given plaintext.
+        """
+
+    @property
+    @abc.abstractmethod
+    def key_size(self) -> int:
+        """
+        The bit length of the public modulus.
+        """
+
+    @abc.abstractmethod
+    def public_numbers(self) -> RSAPublicNumbers:
+        """
+        Returns an RSAPublicNumbers
+        """
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        Returns the key serialized as bytes.
+        """
+
+    @abc.abstractmethod
+    def verify(
+        self,
+        signature: bytes,
+        data: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Union[asym_utils.Prehashed, hashes.HashAlgorithm],
+    ) -> None:
+        """
+        Verifies the signature of the data.
+        """
+
+    @abc.abstractmethod
+    def recover_data_from_signature(
+        self,
+        signature: bytes,
+        padding: AsymmetricPadding,
+        algorithm: typing.Optional[hashes.HashAlgorithm],
+    ) -> bytes:
+        """
+        Recovers the original data from the signature.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+RSAPublicKeyWithSerialization = RSAPublicKey
+
+
+def generate_private_key(
+    public_exponent: int,
+    key_size: int,
+    backend: typing.Any = None,
+) -> RSAPrivateKey:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    _verify_rsa_parameters(public_exponent, key_size)
+    return ossl.generate_rsa_private_key(public_exponent, key_size)
+
+
+def _verify_rsa_parameters(public_exponent: int, key_size: int) -> None:
+    if public_exponent not in (3, 65537):
+        raise ValueError(
+            "public_exponent must be either 3 (for legacy compatibility) or "
+            "65537. Almost everyone should choose 65537 here!"
+        )
+
+    if key_size < 512:
+        raise ValueError("key_size must be at least 512-bits.")
+
+
+def _check_private_key_components(
+    p: int,
+    q: int,
+    private_exponent: int,
+    dmp1: int,
+    dmq1: int,
+    iqmp: int,
+    public_exponent: int,
+    modulus: int,
+) -> None:
+    if modulus < 3:
+        raise ValueError("modulus must be >= 3.")
+
+    if p >= modulus:
+        raise ValueError("p must be < modulus.")
+
+    if q >= modulus:
+        raise ValueError("q must be < modulus.")
+
+    if dmp1 >= modulus:
+        raise ValueError("dmp1 must be < modulus.")
+
+    if dmq1 >= modulus:
+        raise ValueError("dmq1 must be < modulus.")
+
+    if iqmp >= modulus:
+        raise ValueError("iqmp must be < modulus.")
+
+    if private_exponent >= modulus:
+        raise ValueError("private_exponent must be < modulus.")
+
+    if public_exponent < 3 or public_exponent >= modulus:
+        raise ValueError("public_exponent must be >= 3 and < modulus.")
+
+    if public_exponent & 1 == 0:
+        raise ValueError("public_exponent must be odd.")
+
+    if dmp1 & 1 == 0:
+        raise ValueError("dmp1 must be odd.")
+
+    if dmq1 & 1 == 0:
+        raise ValueError("dmq1 must be odd.")
+
+    if p * q != modulus:
+        raise ValueError("p*q must equal modulus.")
+
+
+def _check_public_key_components(e: int, n: int) -> None:
+    if n < 3:
+        raise ValueError("n must be >= 3.")
+
+    if e < 3 or e >= n:
+        raise ValueError("e must be >= 3 and < n.")
+
+    if e & 1 == 0:
+        raise ValueError("e must be odd.")
+
+
+def _modinv(e: int, m: int) -> int:
+    """
+    Modular Multiplicative Inverse. Returns x such that: (x*e) mod m == 1
+    """
+    x1, x2 = 1, 0
+    a, b = e, m
+    while b > 0:
+        q, r = divmod(a, b)
+        xn = x1 - q * x2
+        a, b, x1, x2 = b, r, x2, xn
+    return x1 % m
+
+
+def rsa_crt_iqmp(p: int, q: int) -> int:
+    """
+    Compute the CRT (q ** -1) % p value from RSA primes p and q.
+    """
+    return _modinv(q, p)
+
+
+def rsa_crt_dmp1(private_exponent: int, p: int) -> int:
+    """
+    Compute the CRT private_exponent % (p - 1) value from the RSA
+    private_exponent (d) and p.
+    """
+    return private_exponent % (p - 1)
+
+
+def rsa_crt_dmq1(private_exponent: int, q: int) -> int:
+    """
+    Compute the CRT private_exponent % (q - 1) value from the RSA
+    private_exponent (d) and q.
+    """
+    return private_exponent % (q - 1)
+
+
+# Controls the number of iterations rsa_recover_prime_factors will perform
+# to obtain the prime factors. Each iteration increments by 2 so the actual
+# maximum attempts is half this number.
+_MAX_RECOVERY_ATTEMPTS = 1000
+
+
+def rsa_recover_prime_factors(
+    n: int, e: int, d: int
+) -> typing.Tuple[int, int]:
+    """
+    Compute factors p and q from the private exponent d. We assume that n has
+    no more than two factors. This function is adapted from code in PyCrypto.
+    """
+    # See 8.2.2(i) in Handbook of Applied Cryptography.
+    ktot = d * e - 1
+    # The quantity d*e-1 is a multiple of phi(n), even,
+    # and can be represented as t*2^s.
+    t = ktot
+    while t % 2 == 0:
+        t = t // 2
+    # Cycle through all multiplicative inverses in Zn.
+    # The algorithm is non-deterministic, but there is a 50% chance
+    # any candidate a leads to successful factoring.
+    # See "Digitalized Signatures and Public Key Functions as Intractable
+    # as Factorization", M. Rabin, 1979
+    spotted = False
+    a = 2
+    while not spotted and a < _MAX_RECOVERY_ATTEMPTS:
+        k = t
+        # Cycle through all values a^{t*2^i}=a^k
+        while k < ktot:
+            cand = pow(a, k, n)
+            # Check if a^k is a non-trivial root of unity (mod n)
+            if cand != 1 and cand != (n - 1) and pow(cand, 2, n) == 1:
+                # We have found a number such that (cand-1)(cand+1)=0 (mod n).
+                # Either of the terms divides n.
+                p = gcd(cand + 1, n)
+                spotted = True
+                break
+            k *= 2
+        # This value was not any good... let's try another!
+        a += 2
+    if not spotted:
+        raise ValueError("Unable to compute factors p and q from exponent d.")
+    # Found !
+    q, r = divmod(n, p)
+    assert r == 0
+    p, q = sorted((p, q), reverse=True)
+    return (p, q)
+
+
+class RSAPrivateNumbers:
+    def __init__(
+        self,
+        p: int,
+        q: int,
+        d: int,
+        dmp1: int,
+        dmq1: int,
+        iqmp: int,
+        public_numbers: RSAPublicNumbers,
+    ):
+        if (
+            not isinstance(p, int)
+            or not isinstance(q, int)
+            or not isinstance(d, int)
+            or not isinstance(dmp1, int)
+            or not isinstance(dmq1, int)
+            or not isinstance(iqmp, int)
+        ):
+            raise TypeError(
+                "RSAPrivateNumbers p, q, d, dmp1, dmq1, iqmp arguments must"
+                " all be an integers."
+            )
+
+        if not isinstance(public_numbers, RSAPublicNumbers):
+            raise TypeError(
+                "RSAPrivateNumbers public_numbers must be an RSAPublicNumbers"
+                " instance."
+            )
+
+        self._p = p
+        self._q = q
+        self._d = d
+        self._dmp1 = dmp1
+        self._dmq1 = dmq1
+        self._iqmp = iqmp
+        self._public_numbers = public_numbers
+
+    @property
+    def p(self) -> int:
+        return self._p
+
+    @property
+    def q(self) -> int:
+        return self._q
+
+    @property
+    def d(self) -> int:
+        return self._d
+
+    @property
+    def dmp1(self) -> int:
+        return self._dmp1
+
+    @property
+    def dmq1(self) -> int:
+        return self._dmq1
+
+    @property
+    def iqmp(self) -> int:
+        return self._iqmp
+
+    @property
+    def public_numbers(self) -> RSAPublicNumbers:
+        return self._public_numbers
+
+    def private_key(
+        self,
+        backend: typing.Any = None,
+        *,
+        unsafe_skip_rsa_key_validation: bool = False,
+    ) -> RSAPrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_rsa_private_numbers(
+            self, unsafe_skip_rsa_key_validation
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, RSAPrivateNumbers):
+            return NotImplemented
+
+        return (
+            self.p == other.p
+            and self.q == other.q
+            and self.d == other.d
+            and self.dmp1 == other.dmp1
+            and self.dmq1 == other.dmq1
+            and self.iqmp == other.iqmp
+            and self.public_numbers == other.public_numbers
+        )
+
+    def __hash__(self) -> int:
+        return hash(
+            (
+                self.p,
+                self.q,
+                self.d,
+                self.dmp1,
+                self.dmq1,
+                self.iqmp,
+                self.public_numbers,
+            )
+        )
+
+
+class RSAPublicNumbers:
+    def __init__(self, e: int, n: int):
+        if not isinstance(e, int) or not isinstance(n, int):
+            raise TypeError("RSAPublicNumbers arguments must be integers.")
+
+        self._e = e
+        self._n = n
+
+    @property
+    def e(self) -> int:
+        return self._e
+
+    @property
+    def n(self) -> int:
+        return self._n
+
+    def public_key(self, backend: typing.Any = None) -> RSAPublicKey:
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        return ossl.load_rsa_public_numbers(self)
+
+    def __repr__(self) -> str:
+        return "<RSAPublicNumbers(e={0.e}, n={0.n})>".format(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, RSAPublicNumbers):
+            return NotImplemented
+
+        return self.e == other.e and self.n == other.n
+
+    def __hash__(self) -> int:
+        return hash((self.e, self.n))
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/types.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/types.py
new file mode 100644
index 0000000000000000000000000000000000000000..1fe4eaf51d850c30ef7764d1c0bbf17533b8ad38
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/types.py
@@ -0,0 +1,111 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.hazmat.primitives.asymmetric import (
+    dh,
+    dsa,
+    ec,
+    ed448,
+    ed25519,
+    rsa,
+    x448,
+    x25519,
+)
+
+# Every asymmetric key type
+PublicKeyTypes = typing.Union[
+    dh.DHPublicKey,
+    dsa.DSAPublicKey,
+    rsa.RSAPublicKey,
+    ec.EllipticCurvePublicKey,
+    ed25519.Ed25519PublicKey,
+    ed448.Ed448PublicKey,
+    x25519.X25519PublicKey,
+    x448.X448PublicKey,
+]
+PUBLIC_KEY_TYPES = PublicKeyTypes
+utils.deprecated(
+    PUBLIC_KEY_TYPES,
+    __name__,
+    "Use PublicKeyTypes instead",
+    utils.DeprecatedIn40,
+    name="PUBLIC_KEY_TYPES",
+)
+# Every asymmetric key type
+PrivateKeyTypes = typing.Union[
+    dh.DHPrivateKey,
+    ed25519.Ed25519PrivateKey,
+    ed448.Ed448PrivateKey,
+    rsa.RSAPrivateKey,
+    dsa.DSAPrivateKey,
+    ec.EllipticCurvePrivateKey,
+    x25519.X25519PrivateKey,
+    x448.X448PrivateKey,
+]
+PRIVATE_KEY_TYPES = PrivateKeyTypes
+utils.deprecated(
+    PRIVATE_KEY_TYPES,
+    __name__,
+    "Use PrivateKeyTypes instead",
+    utils.DeprecatedIn40,
+    name="PRIVATE_KEY_TYPES",
+)
+# Just the key types we allow to be used for x509 signing. This mirrors
+# the certificate public key types
+CertificateIssuerPrivateKeyTypes = typing.Union[
+    ed25519.Ed25519PrivateKey,
+    ed448.Ed448PrivateKey,
+    rsa.RSAPrivateKey,
+    dsa.DSAPrivateKey,
+    ec.EllipticCurvePrivateKey,
+]
+CERTIFICATE_PRIVATE_KEY_TYPES = CertificateIssuerPrivateKeyTypes
+utils.deprecated(
+    CERTIFICATE_PRIVATE_KEY_TYPES,
+    __name__,
+    "Use CertificateIssuerPrivateKeyTypes instead",
+    utils.DeprecatedIn40,
+    name="CERTIFICATE_PRIVATE_KEY_TYPES",
+)
+# Just the key types we allow to be used for x509 signing. This mirrors
+# the certificate private key types
+CertificateIssuerPublicKeyTypes = typing.Union[
+    dsa.DSAPublicKey,
+    rsa.RSAPublicKey,
+    ec.EllipticCurvePublicKey,
+    ed25519.Ed25519PublicKey,
+    ed448.Ed448PublicKey,
+]
+CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES = CertificateIssuerPublicKeyTypes
+utils.deprecated(
+    CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES,
+    __name__,
+    "Use CertificateIssuerPublicKeyTypes instead",
+    utils.DeprecatedIn40,
+    name="CERTIFICATE_ISSUER_PUBLIC_KEY_TYPES",
+)
+# This type removes DHPublicKey. x448/x25519 can be a public key
+# but cannot be used in signing so they are allowed here.
+CertificatePublicKeyTypes = typing.Union[
+    dsa.DSAPublicKey,
+    rsa.RSAPublicKey,
+    ec.EllipticCurvePublicKey,
+    ed25519.Ed25519PublicKey,
+    ed448.Ed448PublicKey,
+    x25519.X25519PublicKey,
+    x448.X448PublicKey,
+]
+CERTIFICATE_PUBLIC_KEY_TYPES = CertificatePublicKeyTypes
+utils.deprecated(
+    CERTIFICATE_PUBLIC_KEY_TYPES,
+    __name__,
+    "Use CertificatePublicKeyTypes instead",
+    utils.DeprecatedIn40,
+    name="CERTIFICATE_PUBLIC_KEY_TYPES",
+)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..826b9567b47bc704902eb959fd21376c8969f695
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/utils.py
@@ -0,0 +1,24 @@
+# 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 annotations
+
+from cryptography.hazmat.bindings._rust import asn1
+from cryptography.hazmat.primitives import hashes
+
+decode_dss_signature = asn1.decode_dss_signature
+encode_dss_signature = asn1.encode_dss_signature
+
+
+class Prehashed:
+    def __init__(self, algorithm: hashes.HashAlgorithm):
+        if not isinstance(algorithm, hashes.HashAlgorithm):
+            raise TypeError("Expected instance of HashAlgorithm.")
+
+        self._algorithm = algorithm
+        self._digest_size = algorithm.digest_size
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py
new file mode 100644
index 0000000000000000000000000000000000000000..699054c9689ba0da21cd4397602d7139acceb238
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x25519.py
@@ -0,0 +1,113 @@
+# 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 annotations
+
+import abc
+
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization
+
+
+class X25519PublicKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def from_public_bytes(cls, data: bytes) -> X25519PublicKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x25519_supported():
+            raise UnsupportedAlgorithm(
+                "X25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+
+        return backend.x25519_load_public_bytes(data)
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        The serialized bytes of the public key.
+        """
+
+    @abc.abstractmethod
+    def public_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the public key.
+        Equivalent to public_bytes(Raw, Raw).
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+# For LibreSSL
+if hasattr(rust_openssl, "x25519"):
+    X25519PublicKey.register(rust_openssl.x25519.X25519PublicKey)
+
+
+class X25519PrivateKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def generate(cls) -> X25519PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x25519_supported():
+            raise UnsupportedAlgorithm(
+                "X25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+        return backend.x25519_generate_key()
+
+    @classmethod
+    def from_private_bytes(cls, data: bytes) -> X25519PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x25519_supported():
+            raise UnsupportedAlgorithm(
+                "X25519 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+
+        return backend.x25519_load_private_bytes(data)
+
+    @abc.abstractmethod
+    def public_key(self) -> X25519PublicKey:
+        """
+        Returns the public key assosciated with this private key
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        The serialized bytes of the private key.
+        """
+
+    @abc.abstractmethod
+    def private_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the private key.
+        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
+        """
+
+    @abc.abstractmethod
+    def exchange(self, peer_public_key: X25519PublicKey) -> bytes:
+        """
+        Performs a key exchange operation using the provided peer's public key.
+        """
+
+
+# For LibreSSL
+if hasattr(rust_openssl, "x25519"):
+    X25519PrivateKey.register(rust_openssl.x25519.X25519PrivateKey)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x448.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x448.py
new file mode 100644
index 0000000000000000000000000000000000000000..abf7848550b8b42fea24155e614d4228fcf2b1e1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/asymmetric/x448.py
@@ -0,0 +1,111 @@
+# 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 annotations
+
+import abc
+
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import _serialization
+
+
+class X448PublicKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def from_public_bytes(cls, data: bytes) -> X448PublicKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x448_supported():
+            raise UnsupportedAlgorithm(
+                "X448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+
+        return backend.x448_load_public_bytes(data)
+
+    @abc.abstractmethod
+    def public_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PublicFormat,
+    ) -> bytes:
+        """
+        The serialized bytes of the public key.
+        """
+
+    @abc.abstractmethod
+    def public_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the public key.
+        Equivalent to public_bytes(Raw, Raw).
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+
+if hasattr(rust_openssl, "x448"):
+    X448PublicKey.register(rust_openssl.x448.X448PublicKey)
+
+
+class X448PrivateKey(metaclass=abc.ABCMeta):
+    @classmethod
+    def generate(cls) -> X448PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x448_supported():
+            raise UnsupportedAlgorithm(
+                "X448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+        return backend.x448_generate_key()
+
+    @classmethod
+    def from_private_bytes(cls, data: bytes) -> X448PrivateKey:
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        if not backend.x448_supported():
+            raise UnsupportedAlgorithm(
+                "X448 is not supported by this version of OpenSSL.",
+                _Reasons.UNSUPPORTED_EXCHANGE_ALGORITHM,
+            )
+
+        return backend.x448_load_private_bytes(data)
+
+    @abc.abstractmethod
+    def public_key(self) -> X448PublicKey:
+        """
+        Returns the public key associated with this private key
+        """
+
+    @abc.abstractmethod
+    def private_bytes(
+        self,
+        encoding: _serialization.Encoding,
+        format: _serialization.PrivateFormat,
+        encryption_algorithm: _serialization.KeySerializationEncryption,
+    ) -> bytes:
+        """
+        The serialized bytes of the private key.
+        """
+
+    @abc.abstractmethod
+    def private_bytes_raw(self) -> bytes:
+        """
+        The raw bytes of the private key.
+        Equivalent to private_bytes(Raw, Raw, NoEncryption()).
+        """
+
+    @abc.abstractmethod
+    def exchange(self, peer_public_key: X448PublicKey) -> bytes:
+        """
+        Performs a key exchange operation using the provided peer's public key.
+        """
+
+
+if hasattr(rust_openssl, "x448"):
+    X448PrivateKey.register(rust_openssl.x448.X448PrivateKey)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..cc88fbf2c4c30c6c11564ff7ecbfdeb0ca6d5170
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__init__.py
@@ -0,0 +1,27 @@
+# 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 annotations
+
+from cryptography.hazmat.primitives._cipheralgorithm import (
+    BlockCipherAlgorithm,
+    CipherAlgorithm,
+)
+from cryptography.hazmat.primitives.ciphers.base import (
+    AEADCipherContext,
+    AEADDecryptionContext,
+    AEADEncryptionContext,
+    Cipher,
+    CipherContext,
+)
+
+__all__ = [
+    "Cipher",
+    "CipherAlgorithm",
+    "BlockCipherAlgorithm",
+    "CipherContext",
+    "AEADCipherContext",
+    "AEADDecryptionContext",
+    "AEADEncryptionContext",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d90bd1e4197fa88dfc09fa5108fa5defebe4b62b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d64b9b3914b493b8228add070de161e056899b35
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/aead.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ca188aa177223c603d6a35b5cb5233e65d67e9e7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/algorithms.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7e3b771df173e4c65c52b335ac0ffd5951f0e7b6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..25bc9933861231df215ea7b71a53a25879ac33a8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/__pycache__/modes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/aead.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/aead.py
new file mode 100644
index 0000000000000000000000000000000000000000..957b2d221b62741490044fe114e8c0bc4c90e693
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/aead.py
@@ -0,0 +1,378 @@
+# 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 annotations
+
+import os
+import typing
+
+from cryptography import exceptions, utils
+from cryptography.hazmat.backends.openssl import aead
+from cryptography.hazmat.backends.openssl.backend import backend
+from cryptography.hazmat.bindings._rust import FixedPool
+
+
+class ChaCha20Poly1305:
+    _MAX_SIZE = 2**31 - 1
+
+    def __init__(self, key: bytes):
+        if not backend.aead_cipher_supported(self):
+            raise exceptions.UnsupportedAlgorithm(
+                "ChaCha20Poly1305 is not supported by this version of OpenSSL",
+                exceptions._Reasons.UNSUPPORTED_CIPHER,
+            )
+        utils._check_byteslike("key", key)
+
+        if len(key) != 32:
+            raise ValueError("ChaCha20Poly1305 key must be 32 bytes.")
+
+        self._key = key
+        self._pool = FixedPool(self._create_fn)
+
+    @classmethod
+    def generate_key(cls) -> bytes:
+        return os.urandom(32)
+
+    def _create_fn(self):
+        return aead._aead_create_ctx(backend, self, self._key)
+
+    def encrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE:
+            # This is OverflowError to match what cffi would raise
+            raise OverflowError(
+                "Data or associated data too long. Max 2**31 - 1 bytes"
+            )
+
+        self._check_params(nonce, data, associated_data)
+        with self._pool.acquire() as ctx:
+            return aead._encrypt(
+                backend, self, nonce, data, [associated_data], 16, ctx
+            )
+
+    def decrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        self._check_params(nonce, data, associated_data)
+        with self._pool.acquire() as ctx:
+            return aead._decrypt(
+                backend, self, nonce, data, [associated_data], 16, ctx
+            )
+
+    def _check_params(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: bytes,
+    ) -> None:
+        utils._check_byteslike("nonce", nonce)
+        utils._check_byteslike("data", data)
+        utils._check_byteslike("associated_data", associated_data)
+        if len(nonce) != 12:
+            raise ValueError("Nonce must be 12 bytes")
+
+
+class AESCCM:
+    _MAX_SIZE = 2**31 - 1
+
+    def __init__(self, key: bytes, tag_length: int = 16):
+        utils._check_byteslike("key", key)
+        if len(key) not in (16, 24, 32):
+            raise ValueError("AESCCM key must be 128, 192, or 256 bits.")
+
+        self._key = key
+        if not isinstance(tag_length, int):
+            raise TypeError("tag_length must be an integer")
+
+        if tag_length not in (4, 6, 8, 10, 12, 14, 16):
+            raise ValueError("Invalid tag_length")
+
+        self._tag_length = tag_length
+
+        if not backend.aead_cipher_supported(self):
+            raise exceptions.UnsupportedAlgorithm(
+                "AESCCM is not supported by this version of OpenSSL",
+                exceptions._Reasons.UNSUPPORTED_CIPHER,
+            )
+
+    @classmethod
+    def generate_key(cls, bit_length: int) -> bytes:
+        if not isinstance(bit_length, int):
+            raise TypeError("bit_length must be an integer")
+
+        if bit_length not in (128, 192, 256):
+            raise ValueError("bit_length must be 128, 192, or 256")
+
+        return os.urandom(bit_length // 8)
+
+    def encrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE:
+            # This is OverflowError to match what cffi would raise
+            raise OverflowError(
+                "Data or associated data too long. Max 2**31 - 1 bytes"
+            )
+
+        self._check_params(nonce, data, associated_data)
+        self._validate_lengths(nonce, len(data))
+        return aead._encrypt(
+            backend, self, nonce, data, [associated_data], self._tag_length
+        )
+
+    def decrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        self._check_params(nonce, data, associated_data)
+        return aead._decrypt(
+            backend, self, nonce, data, [associated_data], self._tag_length
+        )
+
+    def _validate_lengths(self, nonce: bytes, data_len: int) -> None:
+        # For information about computing this, see
+        # https://tools.ietf.org/html/rfc3610#section-2.1
+        l_val = 15 - len(nonce)
+        if 2 ** (8 * l_val) < data_len:
+            raise ValueError("Data too long for nonce")
+
+    def _check_params(
+        self, nonce: bytes, data: bytes, associated_data: bytes
+    ) -> None:
+        utils._check_byteslike("nonce", nonce)
+        utils._check_byteslike("data", data)
+        utils._check_byteslike("associated_data", associated_data)
+        if not 7 <= len(nonce) <= 13:
+            raise ValueError("Nonce must be between 7 and 13 bytes")
+
+
+class AESGCM:
+    _MAX_SIZE = 2**31 - 1
+
+    def __init__(self, key: bytes):
+        utils._check_byteslike("key", key)
+        if len(key) not in (16, 24, 32):
+            raise ValueError("AESGCM key must be 128, 192, or 256 bits.")
+
+        self._key = key
+
+    @classmethod
+    def generate_key(cls, bit_length: int) -> bytes:
+        if not isinstance(bit_length, int):
+            raise TypeError("bit_length must be an integer")
+
+        if bit_length not in (128, 192, 256):
+            raise ValueError("bit_length must be 128, 192, or 256")
+
+        return os.urandom(bit_length // 8)
+
+    def encrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE:
+            # This is OverflowError to match what cffi would raise
+            raise OverflowError(
+                "Data or associated data too long. Max 2**31 - 1 bytes"
+            )
+
+        self._check_params(nonce, data, associated_data)
+        return aead._encrypt(backend, self, nonce, data, [associated_data], 16)
+
+    def decrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        self._check_params(nonce, data, associated_data)
+        return aead._decrypt(backend, self, nonce, data, [associated_data], 16)
+
+    def _check_params(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: bytes,
+    ) -> None:
+        utils._check_byteslike("nonce", nonce)
+        utils._check_byteslike("data", data)
+        utils._check_byteslike("associated_data", associated_data)
+        if len(nonce) < 8 or len(nonce) > 128:
+            raise ValueError("Nonce must be between 8 and 128 bytes")
+
+
+class AESOCB3:
+    _MAX_SIZE = 2**31 - 1
+
+    def __init__(self, key: bytes):
+        utils._check_byteslike("key", key)
+        if len(key) not in (16, 24, 32):
+            raise ValueError("AESOCB3 key must be 128, 192, or 256 bits.")
+
+        self._key = key
+
+        if not backend.aead_cipher_supported(self):
+            raise exceptions.UnsupportedAlgorithm(
+                "OCB3 is not supported by this version of OpenSSL",
+                exceptions._Reasons.UNSUPPORTED_CIPHER,
+            )
+
+    @classmethod
+    def generate_key(cls, bit_length: int) -> bytes:
+        if not isinstance(bit_length, int):
+            raise TypeError("bit_length must be an integer")
+
+        if bit_length not in (128, 192, 256):
+            raise ValueError("bit_length must be 128, 192, or 256")
+
+        return os.urandom(bit_length // 8)
+
+    def encrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        if len(data) > self._MAX_SIZE or len(associated_data) > self._MAX_SIZE:
+            # This is OverflowError to match what cffi would raise
+            raise OverflowError(
+                "Data or associated data too long. Max 2**31 - 1 bytes"
+            )
+
+        self._check_params(nonce, data, associated_data)
+        return aead._encrypt(backend, self, nonce, data, [associated_data], 16)
+
+    def decrypt(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: typing.Optional[bytes],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = b""
+
+        self._check_params(nonce, data, associated_data)
+        return aead._decrypt(backend, self, nonce, data, [associated_data], 16)
+
+    def _check_params(
+        self,
+        nonce: bytes,
+        data: bytes,
+        associated_data: bytes,
+    ) -> None:
+        utils._check_byteslike("nonce", nonce)
+        utils._check_byteslike("data", data)
+        utils._check_byteslike("associated_data", associated_data)
+        if len(nonce) < 12 or len(nonce) > 15:
+            raise ValueError("Nonce must be between 12 and 15 bytes")
+
+
+class AESSIV:
+    _MAX_SIZE = 2**31 - 1
+
+    def __init__(self, key: bytes):
+        utils._check_byteslike("key", key)
+        if len(key) not in (32, 48, 64):
+            raise ValueError("AESSIV key must be 256, 384, or 512 bits.")
+
+        self._key = key
+
+        if not backend.aead_cipher_supported(self):
+            raise exceptions.UnsupportedAlgorithm(
+                "AES-SIV is not supported by this version of OpenSSL",
+                exceptions._Reasons.UNSUPPORTED_CIPHER,
+            )
+
+    @classmethod
+    def generate_key(cls, bit_length: int) -> bytes:
+        if not isinstance(bit_length, int):
+            raise TypeError("bit_length must be an integer")
+
+        if bit_length not in (256, 384, 512):
+            raise ValueError("bit_length must be 256, 384, or 512")
+
+        return os.urandom(bit_length // 8)
+
+    def encrypt(
+        self,
+        data: bytes,
+        associated_data: typing.Optional[typing.List[bytes]],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = []
+
+        self._check_params(data, associated_data)
+
+        if len(data) > self._MAX_SIZE or any(
+            len(ad) > self._MAX_SIZE for ad in associated_data
+        ):
+            # This is OverflowError to match what cffi would raise
+            raise OverflowError(
+                "Data or associated data too long. Max 2**31 - 1 bytes"
+            )
+
+        return aead._encrypt(backend, self, b"", data, associated_data, 16)
+
+    def decrypt(
+        self,
+        data: bytes,
+        associated_data: typing.Optional[typing.List[bytes]],
+    ) -> bytes:
+        if associated_data is None:
+            associated_data = []
+
+        self._check_params(data, associated_data)
+
+        return aead._decrypt(backend, self, b"", data, associated_data, 16)
+
+    def _check_params(
+        self,
+        data: bytes,
+        associated_data: typing.List[bytes],
+    ) -> None:
+        utils._check_byteslike("data", data)
+        if len(data) == 0:
+            raise ValueError("data must not be zero length")
+
+        if not isinstance(associated_data, list):
+            raise TypeError(
+                "associated_data must be a list of bytes-like objects or None"
+            )
+        for x in associated_data:
+            utils._check_byteslike("associated_data elements", x)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py
new file mode 100644
index 0000000000000000000000000000000000000000..4bfc5d840d67411183d3f56854dc42cde8c066ff
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/algorithms.py
@@ -0,0 +1,228 @@
+# 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 annotations
+
+from cryptography import utils
+from cryptography.hazmat.primitives.ciphers import (
+    BlockCipherAlgorithm,
+    CipherAlgorithm,
+)
+
+
+def _verify_key_size(algorithm: CipherAlgorithm, key: bytes) -> bytes:
+    # Verify that the key is instance of bytes
+    utils._check_byteslike("key", key)
+
+    # Verify that the key size matches the expected key size
+    if len(key) * 8 not in algorithm.key_sizes:
+        raise ValueError(
+            "Invalid key size ({}) for {}.".format(
+                len(key) * 8, algorithm.name
+            )
+        )
+    return key
+
+
+class AES(BlockCipherAlgorithm):
+    name = "AES"
+    block_size = 128
+    # 512 added to support AES-256-XTS, which uses 512-bit keys
+    key_sizes = frozenset([128, 192, 256, 512])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+class AES128(BlockCipherAlgorithm):
+    name = "AES"
+    block_size = 128
+    key_sizes = frozenset([128])
+    key_size = 128
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+
+class AES256(BlockCipherAlgorithm):
+    name = "AES"
+    block_size = 128
+    key_sizes = frozenset([256])
+    key_size = 256
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+
+class Camellia(BlockCipherAlgorithm):
+    name = "camellia"
+    block_size = 128
+    key_sizes = frozenset([128, 192, 256])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+class TripleDES(BlockCipherAlgorithm):
+    name = "3DES"
+    block_size = 64
+    key_sizes = frozenset([64, 128, 192])
+
+    def __init__(self, key: bytes):
+        if len(key) == 8:
+            key += key + key
+        elif len(key) == 16:
+            key += key[:8]
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+class Blowfish(BlockCipherAlgorithm):
+    name = "Blowfish"
+    block_size = 64
+    key_sizes = frozenset(range(32, 449, 8))
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+_BlowfishInternal = Blowfish
+utils.deprecated(
+    Blowfish,
+    __name__,
+    "Blowfish has been deprecated",
+    utils.DeprecatedIn37,
+    name="Blowfish",
+)
+
+
+class CAST5(BlockCipherAlgorithm):
+    name = "CAST5"
+    block_size = 64
+    key_sizes = frozenset(range(40, 129, 8))
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+_CAST5Internal = CAST5
+utils.deprecated(
+    CAST5,
+    __name__,
+    "CAST5 has been deprecated",
+    utils.DeprecatedIn37,
+    name="CAST5",
+)
+
+
+class ARC4(CipherAlgorithm):
+    name = "RC4"
+    key_sizes = frozenset([40, 56, 64, 80, 128, 160, 192, 256])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+class IDEA(BlockCipherAlgorithm):
+    name = "IDEA"
+    block_size = 64
+    key_sizes = frozenset([128])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+_IDEAInternal = IDEA
+utils.deprecated(
+    IDEA,
+    __name__,
+    "IDEA has been deprecated",
+    utils.DeprecatedIn37,
+    name="IDEA",
+)
+
+
+class SEED(BlockCipherAlgorithm):
+    name = "SEED"
+    block_size = 128
+    key_sizes = frozenset([128])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+_SEEDInternal = SEED
+utils.deprecated(
+    SEED,
+    __name__,
+    "SEED has been deprecated",
+    utils.DeprecatedIn37,
+    name="SEED",
+)
+
+
+class ChaCha20(CipherAlgorithm):
+    name = "ChaCha20"
+    key_sizes = frozenset([256])
+
+    def __init__(self, key: bytes, nonce: bytes):
+        self.key = _verify_key_size(self, key)
+        utils._check_byteslike("nonce", nonce)
+
+        if len(nonce) != 16:
+            raise ValueError("nonce must be 128-bits (16 bytes)")
+
+        self._nonce = nonce
+
+    @property
+    def nonce(self) -> bytes:
+        return self._nonce
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
+
+
+class SM4(BlockCipherAlgorithm):
+    name = "SM4"
+    block_size = 128
+    key_sizes = frozenset([128])
+
+    def __init__(self, key: bytes):
+        self.key = _verify_key_size(self, key)
+
+    @property
+    def key_size(self) -> int:
+        return len(self.key) * 8
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/base.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..38a2ebbe081e72ee8ed70f9fb01423b220c93c1e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/base.py
@@ -0,0 +1,269 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography.exceptions import (
+    AlreadyFinalized,
+    AlreadyUpdated,
+    NotYetFinalized,
+)
+from cryptography.hazmat.primitives._cipheralgorithm import CipherAlgorithm
+from cryptography.hazmat.primitives.ciphers import modes
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.ciphers import (
+        _CipherContext as _BackendCipherContext,
+    )
+
+
+class CipherContext(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def update(self, data: bytes) -> bytes:
+        """
+        Processes the provided bytes through the cipher and returns the results
+        as bytes.
+        """
+
+    @abc.abstractmethod
+    def update_into(self, data: bytes, buf: bytes) -> int:
+        """
+        Processes the provided bytes and writes the resulting data into the
+        provided buffer. Returns the number of bytes written.
+        """
+
+    @abc.abstractmethod
+    def finalize(self) -> bytes:
+        """
+        Returns the results of processing the final block as bytes.
+        """
+
+
+class AEADCipherContext(CipherContext, metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def authenticate_additional_data(self, data: bytes) -> None:
+        """
+        Authenticates the provided bytes.
+        """
+
+
+class AEADDecryptionContext(AEADCipherContext, metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def finalize_with_tag(self, tag: bytes) -> bytes:
+        """
+        Returns the results of processing the final block as bytes and allows
+        delayed passing of the authentication tag.
+        """
+
+
+class AEADEncryptionContext(AEADCipherContext, metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def tag(self) -> bytes:
+        """
+        Returns tag bytes. This is only available after encryption is
+        finalized.
+        """
+
+
+Mode = typing.TypeVar(
+    "Mode", bound=typing.Optional[modes.Mode], covariant=True
+)
+
+
+class Cipher(typing.Generic[Mode]):
+    def __init__(
+        self,
+        algorithm: CipherAlgorithm,
+        mode: Mode,
+        backend: typing.Any = None,
+    ) -> None:
+        if not isinstance(algorithm, CipherAlgorithm):
+            raise TypeError("Expected interface of CipherAlgorithm.")
+
+        if mode is not None:
+            # mypy needs this assert to narrow the type from our generic
+            # type. Maybe it won't some time in the future.
+            assert isinstance(mode, modes.Mode)
+            mode.validate_for_algorithm(algorithm)
+
+        self.algorithm = algorithm
+        self.mode = mode
+
+    @typing.overload
+    def encryptor(
+        self: Cipher[modes.ModeWithAuthenticationTag],
+    ) -> AEADEncryptionContext:
+        ...
+
+    @typing.overload
+    def encryptor(
+        self: _CIPHER_TYPE,
+    ) -> CipherContext:
+        ...
+
+    def encryptor(self):
+        if isinstance(self.mode, modes.ModeWithAuthenticationTag):
+            if self.mode.tag is not None:
+                raise ValueError(
+                    "Authentication tag must be None when encrypting."
+                )
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        ctx = backend.create_symmetric_encryption_ctx(
+            self.algorithm, self.mode
+        )
+        return self._wrap_ctx(ctx, encrypt=True)
+
+    @typing.overload
+    def decryptor(
+        self: Cipher[modes.ModeWithAuthenticationTag],
+    ) -> AEADDecryptionContext:
+        ...
+
+    @typing.overload
+    def decryptor(
+        self: _CIPHER_TYPE,
+    ) -> CipherContext:
+        ...
+
+    def decryptor(self):
+        from cryptography.hazmat.backends.openssl.backend import backend
+
+        ctx = backend.create_symmetric_decryption_ctx(
+            self.algorithm, self.mode
+        )
+        return self._wrap_ctx(ctx, encrypt=False)
+
+    def _wrap_ctx(
+        self, ctx: _BackendCipherContext, encrypt: bool
+    ) -> typing.Union[
+        AEADEncryptionContext, AEADDecryptionContext, CipherContext
+    ]:
+        if isinstance(self.mode, modes.ModeWithAuthenticationTag):
+            if encrypt:
+                return _AEADEncryptionContext(ctx)
+            else:
+                return _AEADDecryptionContext(ctx)
+        else:
+            return _CipherContext(ctx)
+
+
+_CIPHER_TYPE = Cipher[
+    typing.Union[
+        modes.ModeWithNonce,
+        modes.ModeWithTweak,
+        None,
+        modes.ECB,
+        modes.ModeWithInitializationVector,
+    ]
+]
+
+
+class _CipherContext(CipherContext):
+    _ctx: typing.Optional[_BackendCipherContext]
+
+    def __init__(self, ctx: _BackendCipherContext) -> None:
+        self._ctx = ctx
+
+    def update(self, data: bytes) -> bytes:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        return self._ctx.update(data)
+
+    def update_into(self, data: bytes, buf: bytes) -> int:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        return self._ctx.update_into(data, buf)
+
+    def finalize(self) -> bytes:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        data = self._ctx.finalize()
+        self._ctx = None
+        return data
+
+
+class _AEADCipherContext(AEADCipherContext):
+    _ctx: typing.Optional[_BackendCipherContext]
+    _tag: typing.Optional[bytes]
+
+    def __init__(self, ctx: _BackendCipherContext) -> None:
+        self._ctx = ctx
+        self._bytes_processed = 0
+        self._aad_bytes_processed = 0
+        self._tag = None
+        self._updated = False
+
+    def _check_limit(self, data_size: int) -> None:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        self._updated = True
+        self._bytes_processed += data_size
+        if self._bytes_processed > self._ctx._mode._MAX_ENCRYPTED_BYTES:
+            raise ValueError(
+                "{} has a maximum encrypted byte limit of {}".format(
+                    self._ctx._mode.name, self._ctx._mode._MAX_ENCRYPTED_BYTES
+                )
+            )
+
+    def update(self, data: bytes) -> bytes:
+        self._check_limit(len(data))
+        # mypy needs this assert even though _check_limit already checked
+        assert self._ctx is not None
+        return self._ctx.update(data)
+
+    def update_into(self, data: bytes, buf: bytes) -> int:
+        self._check_limit(len(data))
+        # mypy needs this assert even though _check_limit already checked
+        assert self._ctx is not None
+        return self._ctx.update_into(data, buf)
+
+    def finalize(self) -> bytes:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        data = self._ctx.finalize()
+        self._tag = self._ctx.tag
+        self._ctx = None
+        return data
+
+    def authenticate_additional_data(self, data: bytes) -> None:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        if self._updated:
+            raise AlreadyUpdated("Update has been called on this context.")
+
+        self._aad_bytes_processed += len(data)
+        if self._aad_bytes_processed > self._ctx._mode._MAX_AAD_BYTES:
+            raise ValueError(
+                "{} has a maximum AAD byte limit of {}".format(
+                    self._ctx._mode.name, self._ctx._mode._MAX_AAD_BYTES
+                )
+            )
+
+        self._ctx.authenticate_additional_data(data)
+
+
+class _AEADDecryptionContext(_AEADCipherContext, AEADDecryptionContext):
+    def finalize_with_tag(self, tag: bytes) -> bytes:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        data = self._ctx.finalize_with_tag(tag)
+        self._tag = self._ctx.tag
+        self._ctx = None
+        return data
+
+
+class _AEADEncryptionContext(_AEADCipherContext, AEADEncryptionContext):
+    @property
+    def tag(self) -> bytes:
+        if self._ctx is not None:
+            raise NotYetFinalized(
+                "You must finalize encryption before " "getting the tag."
+            )
+        assert self._tag is not None
+        return self._tag
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/modes.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/modes.py
new file mode 100644
index 0000000000000000000000000000000000000000..d8ea1888d67b00603cc1ba5c7ad50f7d2ed0847e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/ciphers/modes.py
@@ -0,0 +1,274 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import UnsupportedAlgorithm, _Reasons
+from cryptography.hazmat.primitives._cipheralgorithm import (
+    BlockCipherAlgorithm,
+    CipherAlgorithm,
+)
+from cryptography.hazmat.primitives.ciphers import algorithms
+
+
+class Mode(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def name(self) -> str:
+        """
+        A string naming this mode (e.g. "ECB", "CBC").
+        """
+
+    @abc.abstractmethod
+    def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None:
+        """
+        Checks that all the necessary invariants of this (mode, algorithm)
+        combination are met.
+        """
+
+
+class ModeWithInitializationVector(Mode, metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def initialization_vector(self) -> bytes:
+        """
+        The value of the initialization vector for this mode as bytes.
+        """
+
+
+class ModeWithTweak(Mode, metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def tweak(self) -> bytes:
+        """
+        The value of the tweak for this mode as bytes.
+        """
+
+
+class ModeWithNonce(Mode, metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def nonce(self) -> bytes:
+        """
+        The value of the nonce for this mode as bytes.
+        """
+
+
+class ModeWithAuthenticationTag(Mode, metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def tag(self) -> typing.Optional[bytes]:
+        """
+        The value of the tag supplied to the constructor of this mode.
+        """
+
+
+def _check_aes_key_length(self: Mode, algorithm: CipherAlgorithm) -> None:
+    if algorithm.key_size > 256 and algorithm.name == "AES":
+        raise ValueError(
+            "Only 128, 192, and 256 bit keys are allowed for this AES mode"
+        )
+
+
+def _check_iv_length(
+    self: ModeWithInitializationVector, algorithm: BlockCipherAlgorithm
+) -> None:
+    if len(self.initialization_vector) * 8 != algorithm.block_size:
+        raise ValueError(
+            "Invalid IV size ({}) for {}.".format(
+                len(self.initialization_vector), self.name
+            )
+        )
+
+
+def _check_nonce_length(
+    nonce: bytes, name: str, algorithm: CipherAlgorithm
+) -> None:
+    if not isinstance(algorithm, BlockCipherAlgorithm):
+        raise UnsupportedAlgorithm(
+            f"{name} requires a block cipher algorithm",
+            _Reasons.UNSUPPORTED_CIPHER,
+        )
+    if len(nonce) * 8 != algorithm.block_size:
+        raise ValueError(f"Invalid nonce size ({len(nonce)}) for {name}.")
+
+
+def _check_iv_and_key_length(
+    self: ModeWithInitializationVector, algorithm: CipherAlgorithm
+) -> None:
+    if not isinstance(algorithm, BlockCipherAlgorithm):
+        raise UnsupportedAlgorithm(
+            f"{self} requires a block cipher algorithm",
+            _Reasons.UNSUPPORTED_CIPHER,
+        )
+    _check_aes_key_length(self, algorithm)
+    _check_iv_length(self, algorithm)
+
+
+class CBC(ModeWithInitializationVector):
+    name = "CBC"
+
+    def __init__(self, initialization_vector: bytes):
+        utils._check_byteslike("initialization_vector", initialization_vector)
+        self._initialization_vector = initialization_vector
+
+    @property
+    def initialization_vector(self) -> bytes:
+        return self._initialization_vector
+
+    validate_for_algorithm = _check_iv_and_key_length
+
+
+class XTS(ModeWithTweak):
+    name = "XTS"
+
+    def __init__(self, tweak: bytes):
+        utils._check_byteslike("tweak", tweak)
+
+        if len(tweak) != 16:
+            raise ValueError("tweak must be 128-bits (16 bytes)")
+
+        self._tweak = tweak
+
+    @property
+    def tweak(self) -> bytes:
+        return self._tweak
+
+    def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None:
+        if isinstance(algorithm, (algorithms.AES128, algorithms.AES256)):
+            raise TypeError(
+                "The AES128 and AES256 classes do not support XTS, please use "
+                "the standard AES class instead."
+            )
+
+        if algorithm.key_size not in (256, 512):
+            raise ValueError(
+                "The XTS specification requires a 256-bit key for AES-128-XTS"
+                " and 512-bit key for AES-256-XTS"
+            )
+
+
+class ECB(Mode):
+    name = "ECB"
+
+    validate_for_algorithm = _check_aes_key_length
+
+
+class OFB(ModeWithInitializationVector):
+    name = "OFB"
+
+    def __init__(self, initialization_vector: bytes):
+        utils._check_byteslike("initialization_vector", initialization_vector)
+        self._initialization_vector = initialization_vector
+
+    @property
+    def initialization_vector(self) -> bytes:
+        return self._initialization_vector
+
+    validate_for_algorithm = _check_iv_and_key_length
+
+
+class CFB(ModeWithInitializationVector):
+    name = "CFB"
+
+    def __init__(self, initialization_vector: bytes):
+        utils._check_byteslike("initialization_vector", initialization_vector)
+        self._initialization_vector = initialization_vector
+
+    @property
+    def initialization_vector(self) -> bytes:
+        return self._initialization_vector
+
+    validate_for_algorithm = _check_iv_and_key_length
+
+
+class CFB8(ModeWithInitializationVector):
+    name = "CFB8"
+
+    def __init__(self, initialization_vector: bytes):
+        utils._check_byteslike("initialization_vector", initialization_vector)
+        self._initialization_vector = initialization_vector
+
+    @property
+    def initialization_vector(self) -> bytes:
+        return self._initialization_vector
+
+    validate_for_algorithm = _check_iv_and_key_length
+
+
+class CTR(ModeWithNonce):
+    name = "CTR"
+
+    def __init__(self, nonce: bytes):
+        utils._check_byteslike("nonce", nonce)
+        self._nonce = nonce
+
+    @property
+    def nonce(self) -> bytes:
+        return self._nonce
+
+    def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None:
+        _check_aes_key_length(self, algorithm)
+        _check_nonce_length(self.nonce, self.name, algorithm)
+
+
+class GCM(ModeWithInitializationVector, ModeWithAuthenticationTag):
+    name = "GCM"
+    _MAX_ENCRYPTED_BYTES = (2**39 - 256) // 8
+    _MAX_AAD_BYTES = (2**64) // 8
+
+    def __init__(
+        self,
+        initialization_vector: bytes,
+        tag: typing.Optional[bytes] = None,
+        min_tag_length: int = 16,
+    ):
+        # OpenSSL 3.0.0 constrains GCM IVs to [64, 1024] bits inclusive
+        # This is a sane limit anyway so we'll enforce it here.
+        utils._check_byteslike("initialization_vector", initialization_vector)
+        if len(initialization_vector) < 8 or len(initialization_vector) > 128:
+            raise ValueError(
+                "initialization_vector must be between 8 and 128 bytes (64 "
+                "and 1024 bits)."
+            )
+        self._initialization_vector = initialization_vector
+        if tag is not None:
+            utils._check_bytes("tag", tag)
+            if min_tag_length < 4:
+                raise ValueError("min_tag_length must be >= 4")
+            if len(tag) < min_tag_length:
+                raise ValueError(
+                    "Authentication tag must be {} bytes or longer.".format(
+                        min_tag_length
+                    )
+                )
+        self._tag = tag
+        self._min_tag_length = min_tag_length
+
+    @property
+    def tag(self) -> typing.Optional[bytes]:
+        return self._tag
+
+    @property
+    def initialization_vector(self) -> bytes:
+        return self._initialization_vector
+
+    def validate_for_algorithm(self, algorithm: CipherAlgorithm) -> None:
+        _check_aes_key_length(self, algorithm)
+        if not isinstance(algorithm, BlockCipherAlgorithm):
+            raise UnsupportedAlgorithm(
+                "GCM requires a block cipher algorithm",
+                _Reasons.UNSUPPORTED_CIPHER,
+            )
+        block_size_bytes = algorithm.block_size // 8
+        if self._tag is not None and len(self._tag) > block_size_bytes:
+            raise ValueError(
+                "Authentication tag cannot be more than {} bytes.".format(
+                    block_size_bytes
+                )
+            )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/cmac.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/cmac.py
new file mode 100644
index 0000000000000000000000000000000000000000..8aa1d791acdd09aefe1391a73dec960428b6892d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/cmac.py
@@ -0,0 +1,65 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import AlreadyFinalized
+from cryptography.hazmat.primitives import ciphers
+
+if typing.TYPE_CHECKING:
+    from cryptography.hazmat.backends.openssl.cmac import _CMACContext
+
+
+class CMAC:
+    _ctx: typing.Optional[_CMACContext]
+    _algorithm: ciphers.BlockCipherAlgorithm
+
+    def __init__(
+        self,
+        algorithm: ciphers.BlockCipherAlgorithm,
+        backend: typing.Any = None,
+        ctx: typing.Optional[_CMACContext] = None,
+    ) -> None:
+        if not isinstance(algorithm, ciphers.BlockCipherAlgorithm):
+            raise TypeError("Expected instance of BlockCipherAlgorithm.")
+        self._algorithm = algorithm
+
+        if ctx is None:
+            from cryptography.hazmat.backends.openssl.backend import (
+                backend as ossl,
+            )
+
+            self._ctx = ossl.create_cmac_ctx(self._algorithm)
+        else:
+            self._ctx = ctx
+
+    def update(self, data: bytes) -> None:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+
+        utils._check_bytes("data", data)
+        self._ctx.update(data)
+
+    def finalize(self) -> bytes:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        digest = self._ctx.finalize()
+        self._ctx = None
+        return digest
+
+    def verify(self, signature: bytes) -> None:
+        utils._check_bytes("signature", signature)
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+
+        ctx, self._ctx = self._ctx, None
+        ctx.verify(signature)
+
+    def copy(self) -> CMAC:
+        if self._ctx is None:
+            raise AlreadyFinalized("Context was already finalized.")
+        return CMAC(self._algorithm, ctx=self._ctx.copy())
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/constant_time.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/constant_time.py
new file mode 100644
index 0000000000000000000000000000000000000000..3975c7147eb92b56685423aa1c5810adcf253a23
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/constant_time.py
@@ -0,0 +1,14 @@
+# 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 annotations
+
+import hmac
+
+
+def bytes_eq(a: bytes, b: bytes) -> bool:
+    if not isinstance(a, bytes) or not isinstance(b, bytes):
+        raise TypeError("a and b must be bytes.")
+
+    return hmac.compare_digest(a, b)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hashes.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hashes.py
new file mode 100644
index 0000000000000000000000000000000000000000..b6a7ff140e682d187161985cb74b3bdbab6a28ab
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hashes.py
@@ -0,0 +1,243 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+
+__all__ = [
+    "HashAlgorithm",
+    "HashContext",
+    "Hash",
+    "ExtendableOutputFunction",
+    "SHA1",
+    "SHA512_224",
+    "SHA512_256",
+    "SHA224",
+    "SHA256",
+    "SHA384",
+    "SHA512",
+    "SHA3_224",
+    "SHA3_256",
+    "SHA3_384",
+    "SHA3_512",
+    "SHAKE128",
+    "SHAKE256",
+    "MD5",
+    "BLAKE2b",
+    "BLAKE2s",
+    "SM3",
+]
+
+
+class HashAlgorithm(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def name(self) -> str:
+        """
+        A string naming this algorithm (e.g. "sha256", "md5").
+        """
+
+    @property
+    @abc.abstractmethod
+    def digest_size(self) -> int:
+        """
+        The size of the resulting digest in bytes.
+        """
+
+    @property
+    @abc.abstractmethod
+    def block_size(self) -> typing.Optional[int]:
+        """
+        The internal block size of the hash function, or None if the hash
+        function does not use blocks internally (e.g. SHA3).
+        """
+
+
+class HashContext(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def algorithm(self) -> HashAlgorithm:
+        """
+        A HashAlgorithm that will be used by this context.
+        """
+
+    @abc.abstractmethod
+    def update(self, data: bytes) -> None:
+        """
+        Processes the provided bytes through the hash.
+        """
+
+    @abc.abstractmethod
+    def finalize(self) -> bytes:
+        """
+        Finalizes the hash context and returns the hash digest as bytes.
+        """
+
+    @abc.abstractmethod
+    def copy(self) -> HashContext:
+        """
+        Return a HashContext that is a copy of the current context.
+        """
+
+
+Hash = rust_openssl.hashes.Hash
+HashContext.register(Hash)
+
+
+class ExtendableOutputFunction(metaclass=abc.ABCMeta):
+    """
+    An interface for extendable output functions.
+    """
+
+
+class SHA1(HashAlgorithm):
+    name = "sha1"
+    digest_size = 20
+    block_size = 64
+
+
+class SHA512_224(HashAlgorithm):  # noqa: N801
+    name = "sha512-224"
+    digest_size = 28
+    block_size = 128
+
+
+class SHA512_256(HashAlgorithm):  # noqa: N801
+    name = "sha512-256"
+    digest_size = 32
+    block_size = 128
+
+
+class SHA224(HashAlgorithm):
+    name = "sha224"
+    digest_size = 28
+    block_size = 64
+
+
+class SHA256(HashAlgorithm):
+    name = "sha256"
+    digest_size = 32
+    block_size = 64
+
+
+class SHA384(HashAlgorithm):
+    name = "sha384"
+    digest_size = 48
+    block_size = 128
+
+
+class SHA512(HashAlgorithm):
+    name = "sha512"
+    digest_size = 64
+    block_size = 128
+
+
+class SHA3_224(HashAlgorithm):  # noqa: N801
+    name = "sha3-224"
+    digest_size = 28
+    block_size = None
+
+
+class SHA3_256(HashAlgorithm):  # noqa: N801
+    name = "sha3-256"
+    digest_size = 32
+    block_size = None
+
+
+class SHA3_384(HashAlgorithm):  # noqa: N801
+    name = "sha3-384"
+    digest_size = 48
+    block_size = None
+
+
+class SHA3_512(HashAlgorithm):  # noqa: N801
+    name = "sha3-512"
+    digest_size = 64
+    block_size = None
+
+
+class SHAKE128(HashAlgorithm, ExtendableOutputFunction):
+    name = "shake128"
+    block_size = None
+
+    def __init__(self, digest_size: int):
+        if not isinstance(digest_size, int):
+            raise TypeError("digest_size must be an integer")
+
+        if digest_size < 1:
+            raise ValueError("digest_size must be a positive integer")
+
+        self._digest_size = digest_size
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
+
+
+class SHAKE256(HashAlgorithm, ExtendableOutputFunction):
+    name = "shake256"
+    block_size = None
+
+    def __init__(self, digest_size: int):
+        if not isinstance(digest_size, int):
+            raise TypeError("digest_size must be an integer")
+
+        if digest_size < 1:
+            raise ValueError("digest_size must be a positive integer")
+
+        self._digest_size = digest_size
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
+
+
+class MD5(HashAlgorithm):
+    name = "md5"
+    digest_size = 16
+    block_size = 64
+
+
+class BLAKE2b(HashAlgorithm):
+    name = "blake2b"
+    _max_digest_size = 64
+    _min_digest_size = 1
+    block_size = 128
+
+    def __init__(self, digest_size: int):
+        if digest_size != 64:
+            raise ValueError("Digest size must be 64")
+
+        self._digest_size = digest_size
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
+
+
+class BLAKE2s(HashAlgorithm):
+    name = "blake2s"
+    block_size = 64
+    _max_digest_size = 32
+    _min_digest_size = 1
+
+    def __init__(self, digest_size: int):
+        if digest_size != 32:
+            raise ValueError("Digest size must be 32")
+
+        self._digest_size = digest_size
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
+
+
+class SM3(HashAlgorithm):
+    name = "sm3"
+    digest_size = 32
+    block_size = 64
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hmac.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hmac.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9442d59ab474ac680ff7253f2ca0e67d0e93c1a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/hmac.py
@@ -0,0 +1,13 @@
+# 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 annotations
+
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import hashes
+
+__all__ = ["HMAC"]
+
+HMAC = rust_openssl.hmac.HMAC
+hashes.HashContext.register(HMAC)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..79bb459f01ec288d67b4f7c20fd5af436fcab4a5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__init__.py
@@ -0,0 +1,23 @@
+# 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 annotations
+
+import abc
+
+
+class KeyDerivationFunction(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def derive(self, key_material: bytes) -> bytes:
+        """
+        Deterministically generates and returns a new key based on the existing
+        key material.
+        """
+
+    @abc.abstractmethod
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        """
+        Checks whether the key generated by the key material matches the
+        expected derived key. Raises an exception if they do not match.
+        """
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c508da7248492080270f4ce4ba862b2d3637fe5c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c7f2c7560cfb086a074af8fe260110e4772d2fb7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/concatkdf.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..322d569401a10133ad4ce10711d8ae59c7c75139
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/hkdf.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..eb2ddfc662dba1266cfeb67347c733031cce4e2b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/kbkdf.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..79e10a2124f151be9dc7537971c38bbcadbb9df4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/pbkdf2.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fdd09135831c29d9c1518de8279a8ed52df27987
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/scrypt.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..19bf88080a1677f49766081d2912ceda674a9605
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/__pycache__/x963kdf.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py
new file mode 100644
index 0000000000000000000000000000000000000000..d5ea58a94522b2222c6a555b696b74c8e50e4cf1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py
@@ -0,0 +1,124 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import AlreadyFinalized, InvalidKey
+from cryptography.hazmat.primitives import constant_time, hashes, hmac
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+
+def _int_to_u32be(n: int) -> bytes:
+    return n.to_bytes(length=4, byteorder="big")
+
+
+def _common_args_checks(
+    algorithm: hashes.HashAlgorithm,
+    length: int,
+    otherinfo: typing.Optional[bytes],
+) -> None:
+    max_length = algorithm.digest_size * (2**32 - 1)
+    if length > max_length:
+        raise ValueError(f"Cannot derive keys larger than {max_length} bits.")
+    if otherinfo is not None:
+        utils._check_bytes("otherinfo", otherinfo)
+
+
+def _concatkdf_derive(
+    key_material: bytes,
+    length: int,
+    auxfn: typing.Callable[[], hashes.HashContext],
+    otherinfo: bytes,
+) -> bytes:
+    utils._check_byteslike("key_material", key_material)
+    output = [b""]
+    outlen = 0
+    counter = 1
+
+    while length > outlen:
+        h = auxfn()
+        h.update(_int_to_u32be(counter))
+        h.update(key_material)
+        h.update(otherinfo)
+        output.append(h.finalize())
+        outlen += len(output[-1])
+        counter += 1
+
+    return b"".join(output)[:length]
+
+
+class ConcatKDFHash(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        otherinfo: typing.Optional[bytes],
+        backend: typing.Any = None,
+    ):
+        _common_args_checks(algorithm, length, otherinfo)
+        self._algorithm = algorithm
+        self._length = length
+        self._otherinfo: bytes = otherinfo if otherinfo is not None else b""
+
+        self._used = False
+
+    def _hash(self) -> hashes.Hash:
+        return hashes.Hash(self._algorithm)
+
+    def derive(self, key_material: bytes) -> bytes:
+        if self._used:
+            raise AlreadyFinalized
+        self._used = True
+        return _concatkdf_derive(
+            key_material, self._length, self._hash, self._otherinfo
+        )
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
+
+
+class ConcatKDFHMAC(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        salt: typing.Optional[bytes],
+        otherinfo: typing.Optional[bytes],
+        backend: typing.Any = None,
+    ):
+        _common_args_checks(algorithm, length, otherinfo)
+        self._algorithm = algorithm
+        self._length = length
+        self._otherinfo: bytes = otherinfo if otherinfo is not None else b""
+
+        if algorithm.block_size is None:
+            raise TypeError(f"{algorithm.name} is unsupported for ConcatKDF")
+
+        if salt is None:
+            salt = b"\x00" * algorithm.block_size
+        else:
+            utils._check_bytes("salt", salt)
+
+        self._salt = salt
+
+        self._used = False
+
+    def _hmac(self) -> hmac.HMAC:
+        return hmac.HMAC(self._salt, self._algorithm)
+
+    def derive(self, key_material: bytes) -> bytes:
+        if self._used:
+            raise AlreadyFinalized
+        self._used = True
+        return _concatkdf_derive(
+            key_material, self._length, self._hmac, self._otherinfo
+        )
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4768944363174e6aa0949b3fbb64eede3313a6f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/hkdf.py
@@ -0,0 +1,101 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import AlreadyFinalized, InvalidKey
+from cryptography.hazmat.primitives import constant_time, hashes, hmac
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+
+class HKDF(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        salt: typing.Optional[bytes],
+        info: typing.Optional[bytes],
+        backend: typing.Any = None,
+    ):
+        self._algorithm = algorithm
+
+        if salt is None:
+            salt = b"\x00" * self._algorithm.digest_size
+        else:
+            utils._check_bytes("salt", salt)
+
+        self._salt = salt
+
+        self._hkdf_expand = HKDFExpand(self._algorithm, length, info)
+
+    def _extract(self, key_material: bytes) -> bytes:
+        h = hmac.HMAC(self._salt, self._algorithm)
+        h.update(key_material)
+        return h.finalize()
+
+    def derive(self, key_material: bytes) -> bytes:
+        utils._check_byteslike("key_material", key_material)
+        return self._hkdf_expand.derive(self._extract(key_material))
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
+
+
+class HKDFExpand(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        info: typing.Optional[bytes],
+        backend: typing.Any = None,
+    ):
+        self._algorithm = algorithm
+
+        max_length = 255 * algorithm.digest_size
+
+        if length > max_length:
+            raise ValueError(
+                f"Cannot derive keys larger than {max_length} octets."
+            )
+
+        self._length = length
+
+        if info is None:
+            info = b""
+        else:
+            utils._check_bytes("info", info)
+
+        self._info = info
+
+        self._used = False
+
+    def _expand(self, key_material: bytes) -> bytes:
+        output = [b""]
+        counter = 1
+
+        while self._algorithm.digest_size * (len(output) - 1) < self._length:
+            h = hmac.HMAC(key_material, self._algorithm)
+            h.update(output[-1])
+            h.update(self._info)
+            h.update(bytes([counter]))
+            output.append(h.finalize())
+            counter += 1
+
+        return b"".join(output)[: self._length]
+
+    def derive(self, key_material: bytes) -> bytes:
+        utils._check_byteslike("key_material", key_material)
+        if self._used:
+            raise AlreadyFinalized
+
+        self._used = True
+        return self._expand(key_material)
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py
new file mode 100644
index 0000000000000000000000000000000000000000..967763828f3f35ff9a39629f94e89dafdfc734f9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/kbkdf.py
@@ -0,0 +1,299 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import (
+    AlreadyFinalized,
+    InvalidKey,
+    UnsupportedAlgorithm,
+    _Reasons,
+)
+from cryptography.hazmat.primitives import (
+    ciphers,
+    cmac,
+    constant_time,
+    hashes,
+    hmac,
+)
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+
+class Mode(utils.Enum):
+    CounterMode = "ctr"
+
+
+class CounterLocation(utils.Enum):
+    BeforeFixed = "before_fixed"
+    AfterFixed = "after_fixed"
+    MiddleFixed = "middle_fixed"
+
+
+class _KBKDFDeriver:
+    def __init__(
+        self,
+        prf: typing.Callable,
+        mode: Mode,
+        length: int,
+        rlen: int,
+        llen: typing.Optional[int],
+        location: CounterLocation,
+        break_location: typing.Optional[int],
+        label: typing.Optional[bytes],
+        context: typing.Optional[bytes],
+        fixed: typing.Optional[bytes],
+    ):
+        assert callable(prf)
+
+        if not isinstance(mode, Mode):
+            raise TypeError("mode must be of type Mode")
+
+        if not isinstance(location, CounterLocation):
+            raise TypeError("location must be of type CounterLocation")
+
+        if break_location is None and location is CounterLocation.MiddleFixed:
+            raise ValueError("Please specify a break_location")
+
+        if (
+            break_location is not None
+            and location != CounterLocation.MiddleFixed
+        ):
+            raise ValueError(
+                "break_location is ignored when location is not"
+                " CounterLocation.MiddleFixed"
+            )
+
+        if break_location is not None and not isinstance(break_location, int):
+            raise TypeError("break_location must be an integer")
+
+        if break_location is not None and break_location < 0:
+            raise ValueError("break_location must be a positive integer")
+
+        if (label or context) and fixed:
+            raise ValueError(
+                "When supplying fixed data, " "label and context are ignored."
+            )
+
+        if rlen is None or not self._valid_byte_length(rlen):
+            raise ValueError("rlen must be between 1 and 4")
+
+        if llen is None and fixed is None:
+            raise ValueError("Please specify an llen")
+
+        if llen is not None and not isinstance(llen, int):
+            raise TypeError("llen must be an integer")
+
+        if label is None:
+            label = b""
+
+        if context is None:
+            context = b""
+
+        utils._check_bytes("label", label)
+        utils._check_bytes("context", context)
+        self._prf = prf
+        self._mode = mode
+        self._length = length
+        self._rlen = rlen
+        self._llen = llen
+        self._location = location
+        self._break_location = break_location
+        self._label = label
+        self._context = context
+        self._used = False
+        self._fixed_data = fixed
+
+    @staticmethod
+    def _valid_byte_length(value: int) -> bool:
+        if not isinstance(value, int):
+            raise TypeError("value must be of type int")
+
+        value_bin = utils.int_to_bytes(1, value)
+        if not 1 <= len(value_bin) <= 4:
+            return False
+        return True
+
+    def derive(self, key_material: bytes, prf_output_size: int) -> bytes:
+        if self._used:
+            raise AlreadyFinalized
+
+        utils._check_byteslike("key_material", key_material)
+        self._used = True
+
+        # inverse floor division (equivalent to ceiling)
+        rounds = -(-self._length // prf_output_size)
+
+        output = [b""]
+
+        # For counter mode, the number of iterations shall not be
+        # larger than 2^r-1, where r <= 32 is the binary length of the counter
+        # This ensures that the counter values used as an input to the
+        # PRF will not repeat during a particular call to the KDF function.
+        r_bin = utils.int_to_bytes(1, self._rlen)
+        if rounds > pow(2, len(r_bin) * 8) - 1:
+            raise ValueError("There are too many iterations.")
+
+        fixed = self._generate_fixed_input()
+
+        if self._location == CounterLocation.BeforeFixed:
+            data_before_ctr = b""
+            data_after_ctr = fixed
+        elif self._location == CounterLocation.AfterFixed:
+            data_before_ctr = fixed
+            data_after_ctr = b""
+        else:
+            if isinstance(
+                self._break_location, int
+            ) and self._break_location > len(fixed):
+                raise ValueError("break_location offset > len(fixed)")
+            data_before_ctr = fixed[: self._break_location]
+            data_after_ctr = fixed[self._break_location :]
+
+        for i in range(1, rounds + 1):
+            h = self._prf(key_material)
+
+            counter = utils.int_to_bytes(i, self._rlen)
+            input_data = data_before_ctr + counter + data_after_ctr
+
+            h.update(input_data)
+
+            output.append(h.finalize())
+
+        return b"".join(output)[: self._length]
+
+    def _generate_fixed_input(self) -> bytes:
+        if self._fixed_data and isinstance(self._fixed_data, bytes):
+            return self._fixed_data
+
+        l_val = utils.int_to_bytes(self._length * 8, self._llen)
+
+        return b"".join([self._label, b"\x00", self._context, l_val])
+
+
+class KBKDFHMAC(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        mode: Mode,
+        length: int,
+        rlen: int,
+        llen: typing.Optional[int],
+        location: CounterLocation,
+        label: typing.Optional[bytes],
+        context: typing.Optional[bytes],
+        fixed: typing.Optional[bytes],
+        backend: typing.Any = None,
+        *,
+        break_location: typing.Optional[int] = None,
+    ):
+        if not isinstance(algorithm, hashes.HashAlgorithm):
+            raise UnsupportedAlgorithm(
+                "Algorithm supplied is not a supported hash algorithm.",
+                _Reasons.UNSUPPORTED_HASH,
+            )
+
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        if not ossl.hmac_supported(algorithm):
+            raise UnsupportedAlgorithm(
+                "Algorithm supplied is not a supported hmac algorithm.",
+                _Reasons.UNSUPPORTED_HASH,
+            )
+
+        self._algorithm = algorithm
+
+        self._deriver = _KBKDFDeriver(
+            self._prf,
+            mode,
+            length,
+            rlen,
+            llen,
+            location,
+            break_location,
+            label,
+            context,
+            fixed,
+        )
+
+    def _prf(self, key_material: bytes) -> hmac.HMAC:
+        return hmac.HMAC(key_material, self._algorithm)
+
+    def derive(self, key_material: bytes) -> bytes:
+        return self._deriver.derive(key_material, self._algorithm.digest_size)
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
+
+
+class KBKDFCMAC(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm,
+        mode: Mode,
+        length: int,
+        rlen: int,
+        llen: typing.Optional[int],
+        location: CounterLocation,
+        label: typing.Optional[bytes],
+        context: typing.Optional[bytes],
+        fixed: typing.Optional[bytes],
+        backend: typing.Any = None,
+        *,
+        break_location: typing.Optional[int] = None,
+    ):
+        if not issubclass(
+            algorithm, ciphers.BlockCipherAlgorithm
+        ) or not issubclass(algorithm, ciphers.CipherAlgorithm):
+            raise UnsupportedAlgorithm(
+                "Algorithm supplied is not a supported cipher algorithm.",
+                _Reasons.UNSUPPORTED_CIPHER,
+            )
+
+        self._algorithm = algorithm
+        self._cipher: typing.Optional[ciphers.BlockCipherAlgorithm] = None
+
+        self._deriver = _KBKDFDeriver(
+            self._prf,
+            mode,
+            length,
+            rlen,
+            llen,
+            location,
+            break_location,
+            label,
+            context,
+            fixed,
+        )
+
+    def _prf(self, _: bytes) -> cmac.CMAC:
+        assert self._cipher is not None
+
+        return cmac.CMAC(self._cipher)
+
+    def derive(self, key_material: bytes) -> bytes:
+        self._cipher = self._algorithm(key_material)
+
+        assert self._cipher is not None
+
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        if not ossl.cmac_algorithm_supported(self._cipher):
+            raise UnsupportedAlgorithm(
+                "Algorithm supplied is not a supported cipher algorithm.",
+                _Reasons.UNSUPPORTED_CIPHER,
+            )
+
+        return self._deriver.derive(key_material, self._cipher.block_size // 8)
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py
new file mode 100644
index 0000000000000000000000000000000000000000..623e1ca7f9eb6a2dfd6c397e9f051314669b997b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/pbkdf2.py
@@ -0,0 +1,64 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import (
+    AlreadyFinalized,
+    InvalidKey,
+    UnsupportedAlgorithm,
+    _Reasons,
+)
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import constant_time, hashes
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+
+class PBKDF2HMAC(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        salt: bytes,
+        iterations: int,
+        backend: typing.Any = None,
+    ):
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        if not ossl.pbkdf2_hmac_supported(algorithm):
+            raise UnsupportedAlgorithm(
+                "{} is not supported for PBKDF2 by this backend.".format(
+                    algorithm.name
+                ),
+                _Reasons.UNSUPPORTED_HASH,
+            )
+        self._used = False
+        self._algorithm = algorithm
+        self._length = length
+        utils._check_bytes("salt", salt)
+        self._salt = salt
+        self._iterations = iterations
+
+    def derive(self, key_material: bytes) -> bytes:
+        if self._used:
+            raise AlreadyFinalized("PBKDF2 instances can only be used once.")
+        self._used = True
+
+        return rust_openssl.kdf.derive_pbkdf2_hmac(
+            key_material,
+            self._algorithm,
+            self._salt,
+            self._iterations,
+            self._length,
+        )
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        derived_key = self.derive(key_material)
+        if not constant_time.bytes_eq(derived_key, expected_key):
+            raise InvalidKey("Keys do not match.")
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py
new file mode 100644
index 0000000000000000000000000000000000000000..05a4f675b6ababd6701cd96850fdf89a28f9d2fd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/scrypt.py
@@ -0,0 +1,80 @@
+# 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 annotations
+
+import sys
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import (
+    AlreadyFinalized,
+    InvalidKey,
+    UnsupportedAlgorithm,
+)
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+from cryptography.hazmat.primitives import constant_time
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+# This is used by the scrypt tests to skip tests that require more memory
+# than the MEM_LIMIT
+_MEM_LIMIT = sys.maxsize // 2
+
+
+class Scrypt(KeyDerivationFunction):
+    def __init__(
+        self,
+        salt: bytes,
+        length: int,
+        n: int,
+        r: int,
+        p: int,
+        backend: typing.Any = None,
+    ):
+        from cryptography.hazmat.backends.openssl.backend import (
+            backend as ossl,
+        )
+
+        if not ossl.scrypt_supported():
+            raise UnsupportedAlgorithm(
+                "This version of OpenSSL does not support scrypt"
+            )
+        self._length = length
+        utils._check_bytes("salt", salt)
+        if n < 2 or (n & (n - 1)) != 0:
+            raise ValueError("n must be greater than 1 and be a power of 2.")
+
+        if r < 1:
+            raise ValueError("r must be greater than or equal to 1.")
+
+        if p < 1:
+            raise ValueError("p must be greater than or equal to 1.")
+
+        self._used = False
+        self._salt = salt
+        self._n = n
+        self._r = r
+        self._p = p
+
+    def derive(self, key_material: bytes) -> bytes:
+        if self._used:
+            raise AlreadyFinalized("Scrypt instances can only be used once.")
+        self._used = True
+
+        utils._check_byteslike("key_material", key_material)
+
+        return rust_openssl.kdf.derive_scrypt(
+            key_material,
+            self._salt,
+            self._n,
+            self._r,
+            self._p,
+            _MEM_LIMIT,
+            self._length,
+        )
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        derived_key = self.derive(key_material)
+        if not constant_time.bytes_eq(derived_key, expected_key):
+            raise InvalidKey("Keys do not match.")
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/x963kdf.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/x963kdf.py
new file mode 100644
index 0000000000000000000000000000000000000000..17acc5174bb09c6056569f9198e253275dfc40bf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/kdf/x963kdf.py
@@ -0,0 +1,61 @@
+# 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 annotations
+
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import AlreadyFinalized, InvalidKey
+from cryptography.hazmat.primitives import constant_time, hashes
+from cryptography.hazmat.primitives.kdf import KeyDerivationFunction
+
+
+def _int_to_u32be(n: int) -> bytes:
+    return n.to_bytes(length=4, byteorder="big")
+
+
+class X963KDF(KeyDerivationFunction):
+    def __init__(
+        self,
+        algorithm: hashes.HashAlgorithm,
+        length: int,
+        sharedinfo: typing.Optional[bytes],
+        backend: typing.Any = None,
+    ):
+        max_len = algorithm.digest_size * (2**32 - 1)
+        if length > max_len:
+            raise ValueError(f"Cannot derive keys larger than {max_len} bits.")
+        if sharedinfo is not None:
+            utils._check_bytes("sharedinfo", sharedinfo)
+
+        self._algorithm = algorithm
+        self._length = length
+        self._sharedinfo = sharedinfo
+        self._used = False
+
+    def derive(self, key_material: bytes) -> bytes:
+        if self._used:
+            raise AlreadyFinalized
+        self._used = True
+        utils._check_byteslike("key_material", key_material)
+        output = [b""]
+        outlen = 0
+        counter = 1
+
+        while self._length > outlen:
+            h = hashes.Hash(self._algorithm)
+            h.update(key_material)
+            h.update(_int_to_u32be(counter))
+            if self._sharedinfo is not None:
+                h.update(self._sharedinfo)
+            output.append(h.finalize())
+            outlen += len(output[-1])
+            counter += 1
+
+        return b"".join(output)[: self._length]
+
+    def verify(self, key_material: bytes, expected_key: bytes) -> None:
+        if not constant_time.bytes_eq(self.derive(key_material), expected_key):
+            raise InvalidKey
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/keywrap.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/keywrap.py
new file mode 100644
index 0000000000000000000000000000000000000000..59b0326c2a86fafad73fa34b893aa2c76c194617
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/keywrap.py
@@ -0,0 +1,177 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.primitives.ciphers import Cipher
+from cryptography.hazmat.primitives.ciphers.algorithms import AES
+from cryptography.hazmat.primitives.ciphers.modes import ECB
+from cryptography.hazmat.primitives.constant_time import bytes_eq
+
+
+def _wrap_core(
+    wrapping_key: bytes,
+    a: bytes,
+    r: typing.List[bytes],
+) -> bytes:
+    # RFC 3394 Key Wrap - 2.2.1 (index method)
+    encryptor = Cipher(AES(wrapping_key), ECB()).encryptor()
+    n = len(r)
+    for j in range(6):
+        for i in range(n):
+            # every encryption operation is a discrete 16 byte chunk (because
+            # AES has a 128-bit block size) and since we're using ECB it is
+            # safe to reuse the encryptor for the entire operation
+            b = encryptor.update(a + r[i])
+            a = (
+                int.from_bytes(b[:8], byteorder="big") ^ ((n * j) + i + 1)
+            ).to_bytes(length=8, byteorder="big")
+            r[i] = b[-8:]
+
+    assert encryptor.finalize() == b""
+
+    return a + b"".join(r)
+
+
+def aes_key_wrap(
+    wrapping_key: bytes,
+    key_to_wrap: bytes,
+    backend: typing.Any = None,
+) -> bytes:
+    if len(wrapping_key) not in [16, 24, 32]:
+        raise ValueError("The wrapping key must be a valid AES key length")
+
+    if len(key_to_wrap) < 16:
+        raise ValueError("The key to wrap must be at least 16 bytes")
+
+    if len(key_to_wrap) % 8 != 0:
+        raise ValueError("The key to wrap must be a multiple of 8 bytes")
+
+    a = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6"
+    r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)]
+    return _wrap_core(wrapping_key, a, r)
+
+
+def _unwrap_core(
+    wrapping_key: bytes,
+    a: bytes,
+    r: typing.List[bytes],
+) -> typing.Tuple[bytes, typing.List[bytes]]:
+    # Implement RFC 3394 Key Unwrap - 2.2.2 (index method)
+    decryptor = Cipher(AES(wrapping_key), ECB()).decryptor()
+    n = len(r)
+    for j in reversed(range(6)):
+        for i in reversed(range(n)):
+            atr = (
+                int.from_bytes(a, byteorder="big") ^ ((n * j) + i + 1)
+            ).to_bytes(length=8, byteorder="big") + r[i]
+            # every decryption operation is a discrete 16 byte chunk so
+            # it is safe to reuse the decryptor for the entire operation
+            b = decryptor.update(atr)
+            a = b[:8]
+            r[i] = b[-8:]
+
+    assert decryptor.finalize() == b""
+    return a, r
+
+
+def aes_key_wrap_with_padding(
+    wrapping_key: bytes,
+    key_to_wrap: bytes,
+    backend: typing.Any = None,
+) -> bytes:
+    if len(wrapping_key) not in [16, 24, 32]:
+        raise ValueError("The wrapping key must be a valid AES key length")
+
+    aiv = b"\xA6\x59\x59\xA6" + len(key_to_wrap).to_bytes(
+        length=4, byteorder="big"
+    )
+    # pad the key to wrap if necessary
+    pad = (8 - (len(key_to_wrap) % 8)) % 8
+    key_to_wrap = key_to_wrap + b"\x00" * pad
+    if len(key_to_wrap) == 8:
+        # RFC 5649 - 4.1 - exactly 8 octets after padding
+        encryptor = Cipher(AES(wrapping_key), ECB()).encryptor()
+        b = encryptor.update(aiv + key_to_wrap)
+        assert encryptor.finalize() == b""
+        return b
+    else:
+        r = [key_to_wrap[i : i + 8] for i in range(0, len(key_to_wrap), 8)]
+        return _wrap_core(wrapping_key, aiv, r)
+
+
+def aes_key_unwrap_with_padding(
+    wrapping_key: bytes,
+    wrapped_key: bytes,
+    backend: typing.Any = None,
+) -> bytes:
+    if len(wrapped_key) < 16:
+        raise InvalidUnwrap("Must be at least 16 bytes")
+
+    if len(wrapping_key) not in [16, 24, 32]:
+        raise ValueError("The wrapping key must be a valid AES key length")
+
+    if len(wrapped_key) == 16:
+        # RFC 5649 - 4.2 - exactly two 64-bit blocks
+        decryptor = Cipher(AES(wrapping_key), ECB()).decryptor()
+        out = decryptor.update(wrapped_key)
+        assert decryptor.finalize() == b""
+        a = out[:8]
+        data = out[8:]
+        n = 1
+    else:
+        r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)]
+        encrypted_aiv = r.pop(0)
+        n = len(r)
+        a, r = _unwrap_core(wrapping_key, encrypted_aiv, r)
+        data = b"".join(r)
+
+    # 1) Check that MSB(32,A) = A65959A6.
+    # 2) Check that 8*(n-1) < LSB(32,A) <= 8*n.  If so, let
+    #    MLI = LSB(32,A).
+    # 3) Let b = (8*n)-MLI, and then check that the rightmost b octets of
+    #    the output data are zero.
+    mli = int.from_bytes(a[4:], byteorder="big")
+    b = (8 * n) - mli
+    if (
+        not bytes_eq(a[:4], b"\xa6\x59\x59\xa6")
+        or not 8 * (n - 1) < mli <= 8 * n
+        or (b != 0 and not bytes_eq(data[-b:], b"\x00" * b))
+    ):
+        raise InvalidUnwrap()
+
+    if b == 0:
+        return data
+    else:
+        return data[:-b]
+
+
+def aes_key_unwrap(
+    wrapping_key: bytes,
+    wrapped_key: bytes,
+    backend: typing.Any = None,
+) -> bytes:
+    if len(wrapped_key) < 24:
+        raise InvalidUnwrap("Must be at least 24 bytes")
+
+    if len(wrapped_key) % 8 != 0:
+        raise InvalidUnwrap("The wrapped key must be a multiple of 8 bytes")
+
+    if len(wrapping_key) not in [16, 24, 32]:
+        raise ValueError("The wrapping key must be a valid AES key length")
+
+    aiv = b"\xa6\xa6\xa6\xa6\xa6\xa6\xa6\xa6"
+    r = [wrapped_key[i : i + 8] for i in range(0, len(wrapped_key), 8)]
+    a = r.pop(0)
+    a, r = _unwrap_core(wrapping_key, a, r)
+    if not bytes_eq(a, aiv):
+        raise InvalidUnwrap()
+
+    return b"".join(r)
+
+
+class InvalidUnwrap(Exception):
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/padding.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/padding.py
new file mode 100644
index 0000000000000000000000000000000000000000..fde3094b00ae4f118d81a2b15c18acb80702cdba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/padding.py
@@ -0,0 +1,225 @@
+# 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 annotations
+
+import abc
+import typing
+
+from cryptography import utils
+from cryptography.exceptions import AlreadyFinalized
+from cryptography.hazmat.bindings._rust import (
+    check_ansix923_padding,
+    check_pkcs7_padding,
+)
+
+
+class PaddingContext(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def update(self, data: bytes) -> bytes:
+        """
+        Pads the provided bytes and returns any available data as bytes.
+        """
+
+    @abc.abstractmethod
+    def finalize(self) -> bytes:
+        """
+        Finalize the padding, returns bytes.
+        """
+
+
+def _byte_padding_check(block_size: int) -> None:
+    if not (0 <= block_size <= 2040):
+        raise ValueError("block_size must be in range(0, 2041).")
+
+    if block_size % 8 != 0:
+        raise ValueError("block_size must be a multiple of 8.")
+
+
+def _byte_padding_update(
+    buffer_: typing.Optional[bytes], data: bytes, block_size: int
+) -> typing.Tuple[bytes, bytes]:
+    if buffer_ is None:
+        raise AlreadyFinalized("Context was already finalized.")
+
+    utils._check_byteslike("data", data)
+
+    buffer_ += bytes(data)
+
+    finished_blocks = len(buffer_) // (block_size // 8)
+
+    result = buffer_[: finished_blocks * (block_size // 8)]
+    buffer_ = buffer_[finished_blocks * (block_size // 8) :]
+
+    return buffer_, result
+
+
+def _byte_padding_pad(
+    buffer_: typing.Optional[bytes],
+    block_size: int,
+    paddingfn: typing.Callable[[int], bytes],
+) -> bytes:
+    if buffer_ is None:
+        raise AlreadyFinalized("Context was already finalized.")
+
+    pad_size = block_size // 8 - len(buffer_)
+    return buffer_ + paddingfn(pad_size)
+
+
+def _byte_unpadding_update(
+    buffer_: typing.Optional[bytes], data: bytes, block_size: int
+) -> typing.Tuple[bytes, bytes]:
+    if buffer_ is None:
+        raise AlreadyFinalized("Context was already finalized.")
+
+    utils._check_byteslike("data", data)
+
+    buffer_ += bytes(data)
+
+    finished_blocks = max(len(buffer_) // (block_size // 8) - 1, 0)
+
+    result = buffer_[: finished_blocks * (block_size // 8)]
+    buffer_ = buffer_[finished_blocks * (block_size // 8) :]
+
+    return buffer_, result
+
+
+def _byte_unpadding_check(
+    buffer_: typing.Optional[bytes],
+    block_size: int,
+    checkfn: typing.Callable[[bytes], int],
+) -> bytes:
+    if buffer_ is None:
+        raise AlreadyFinalized("Context was already finalized.")
+
+    if len(buffer_) != block_size // 8:
+        raise ValueError("Invalid padding bytes.")
+
+    valid = checkfn(buffer_)
+
+    if not valid:
+        raise ValueError("Invalid padding bytes.")
+
+    pad_size = buffer_[-1]
+    return buffer_[:-pad_size]
+
+
+class PKCS7:
+    def __init__(self, block_size: int):
+        _byte_padding_check(block_size)
+        self.block_size = block_size
+
+    def padder(self) -> PaddingContext:
+        return _PKCS7PaddingContext(self.block_size)
+
+    def unpadder(self) -> PaddingContext:
+        return _PKCS7UnpaddingContext(self.block_size)
+
+
+class _PKCS7PaddingContext(PaddingContext):
+    _buffer: typing.Optional[bytes]
+
+    def __init__(self, block_size: int):
+        self.block_size = block_size
+        # TODO: more copies than necessary, we should use zero-buffer (#193)
+        self._buffer = b""
+
+    def update(self, data: bytes) -> bytes:
+        self._buffer, result = _byte_padding_update(
+            self._buffer, data, self.block_size
+        )
+        return result
+
+    def _padding(self, size: int) -> bytes:
+        return bytes([size]) * size
+
+    def finalize(self) -> bytes:
+        result = _byte_padding_pad(
+            self._buffer, self.block_size, self._padding
+        )
+        self._buffer = None
+        return result
+
+
+class _PKCS7UnpaddingContext(PaddingContext):
+    _buffer: typing.Optional[bytes]
+
+    def __init__(self, block_size: int):
+        self.block_size = block_size
+        # TODO: more copies than necessary, we should use zero-buffer (#193)
+        self._buffer = b""
+
+    def update(self, data: bytes) -> bytes:
+        self._buffer, result = _byte_unpadding_update(
+            self._buffer, data, self.block_size
+        )
+        return result
+
+    def finalize(self) -> bytes:
+        result = _byte_unpadding_check(
+            self._buffer, self.block_size, check_pkcs7_padding
+        )
+        self._buffer = None
+        return result
+
+
+class ANSIX923:
+    def __init__(self, block_size: int):
+        _byte_padding_check(block_size)
+        self.block_size = block_size
+
+    def padder(self) -> PaddingContext:
+        return _ANSIX923PaddingContext(self.block_size)
+
+    def unpadder(self) -> PaddingContext:
+        return _ANSIX923UnpaddingContext(self.block_size)
+
+
+class _ANSIX923PaddingContext(PaddingContext):
+    _buffer: typing.Optional[bytes]
+
+    def __init__(self, block_size: int):
+        self.block_size = block_size
+        # TODO: more copies than necessary, we should use zero-buffer (#193)
+        self._buffer = b""
+
+    def update(self, data: bytes) -> bytes:
+        self._buffer, result = _byte_padding_update(
+            self._buffer, data, self.block_size
+        )
+        return result
+
+    def _padding(self, size: int) -> bytes:
+        return bytes([0]) * (size - 1) + bytes([size])
+
+    def finalize(self) -> bytes:
+        result = _byte_padding_pad(
+            self._buffer, self.block_size, self._padding
+        )
+        self._buffer = None
+        return result
+
+
+class _ANSIX923UnpaddingContext(PaddingContext):
+    _buffer: typing.Optional[bytes]
+
+    def __init__(self, block_size: int):
+        self.block_size = block_size
+        # TODO: more copies than necessary, we should use zero-buffer (#193)
+        self._buffer = b""
+
+    def update(self, data: bytes) -> bytes:
+        self._buffer, result = _byte_unpadding_update(
+            self._buffer, data, self.block_size
+        )
+        return result
+
+    def finalize(self) -> bytes:
+        result = _byte_unpadding_check(
+            self._buffer,
+            self.block_size,
+            check_ansix923_padding,
+        )
+        self._buffer = None
+        return result
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/poly1305.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/poly1305.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f5a77a576fd258a9a634ae3c3365fc3f7d4702a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/poly1305.py
@@ -0,0 +1,11 @@
+# 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 annotations
+
+from cryptography.hazmat.bindings._rust import openssl as rust_openssl
+
+__all__ = ["Poly1305"]
+
+Poly1305 = rust_openssl.poly1305.Poly1305
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b6c9a5cdc5206997f12d2818e6c751a423e187ea
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__init__.py
@@ -0,0 +1,63 @@
+# 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 annotations
+
+from cryptography.hazmat.primitives._serialization import (
+    BestAvailableEncryption,
+    Encoding,
+    KeySerializationEncryption,
+    NoEncryption,
+    ParameterFormat,
+    PrivateFormat,
+    PublicFormat,
+    _KeySerializationEncryption,
+)
+from cryptography.hazmat.primitives.serialization.base import (
+    load_der_parameters,
+    load_der_private_key,
+    load_der_public_key,
+    load_pem_parameters,
+    load_pem_private_key,
+    load_pem_public_key,
+)
+from cryptography.hazmat.primitives.serialization.ssh import (
+    SSHCertificate,
+    SSHCertificateBuilder,
+    SSHCertificateType,
+    SSHCertPrivateKeyTypes,
+    SSHCertPublicKeyTypes,
+    SSHPrivateKeyTypes,
+    SSHPublicKeyTypes,
+    load_ssh_private_key,
+    load_ssh_public_identity,
+    load_ssh_public_key,
+)
+
+__all__ = [
+    "load_der_parameters",
+    "load_der_private_key",
+    "load_der_public_key",
+    "load_pem_parameters",
+    "load_pem_private_key",
+    "load_pem_public_key",
+    "load_ssh_private_key",
+    "load_ssh_public_identity",
+    "load_ssh_public_key",
+    "Encoding",
+    "PrivateFormat",
+    "PublicFormat",
+    "ParameterFormat",
+    "KeySerializationEncryption",
+    "BestAvailableEncryption",
+    "NoEncryption",
+    "_KeySerializationEncryption",
+    "SSHCertificateBuilder",
+    "SSHCertificate",
+    "SSHCertificateType",
+    "SSHCertPublicKeyTypes",
+    "SSHCertPrivateKeyTypes",
+    "SSHPrivateKeyTypes",
+    "SSHPublicKeyTypes",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e38065ce596423520bee1a710471aea9ecb52a9f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6f84c15fb62f49b95b4927049dffb106f13ae3bf
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..56a98c3e87e06d040ca183d8c8f7cd1fa73bc9d1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs12.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b90a3a34b79f83ab26459179056c55df03ad71cc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/pkcs7.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..64742b15e53f7e84e4cb9e0b954036e061971612
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/__pycache__/ssh.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/base.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..18a96ccfd5cd8a2fe04c6778bc9ed82f8b0e6e7e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/base.py
@@ -0,0 +1,73 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.primitives.asymmetric import dh
+from cryptography.hazmat.primitives.asymmetric.types import (
+    PrivateKeyTypes,
+    PublicKeyTypes,
+)
+
+
+def load_pem_private_key(
+    data: bytes,
+    password: typing.Optional[bytes],
+    backend: typing.Any = None,
+    *,
+    unsafe_skip_rsa_key_validation: bool = False,
+) -> PrivateKeyTypes:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_pem_private_key(
+        data, password, unsafe_skip_rsa_key_validation
+    )
+
+
+def load_pem_public_key(
+    data: bytes, backend: typing.Any = None
+) -> PublicKeyTypes:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_pem_public_key(data)
+
+
+def load_pem_parameters(
+    data: bytes, backend: typing.Any = None
+) -> dh.DHParameters:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_pem_parameters(data)
+
+
+def load_der_private_key(
+    data: bytes,
+    password: typing.Optional[bytes],
+    backend: typing.Any = None,
+    *,
+    unsafe_skip_rsa_key_validation: bool = False,
+) -> PrivateKeyTypes:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_der_private_key(
+        data, password, unsafe_skip_rsa_key_validation
+    )
+
+
+def load_der_public_key(
+    data: bytes, backend: typing.Any = None
+) -> PublicKeyTypes:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_der_public_key(data)
+
+
+def load_der_parameters(
+    data: bytes, backend: typing.Any = None
+) -> dh.DHParameters:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_der_parameters(data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py
new file mode 100644
index 0000000000000000000000000000000000000000..27133a3fa851901070783134f475b5060a5c2eab
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs12.py
@@ -0,0 +1,229 @@
+# 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 annotations
+
+import typing
+
+from cryptography import x509
+from cryptography.hazmat.primitives import serialization
+from cryptography.hazmat.primitives._serialization import PBES as PBES
+from cryptography.hazmat.primitives.asymmetric import (
+    dsa,
+    ec,
+    ed448,
+    ed25519,
+    rsa,
+)
+from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
+
+__all__ = [
+    "PBES",
+    "PKCS12PrivateKeyTypes",
+    "PKCS12Certificate",
+    "PKCS12KeyAndCertificates",
+    "load_key_and_certificates",
+    "load_pkcs12",
+    "serialize_key_and_certificates",
+]
+
+PKCS12PrivateKeyTypes = typing.Union[
+    rsa.RSAPrivateKey,
+    dsa.DSAPrivateKey,
+    ec.EllipticCurvePrivateKey,
+    ed25519.Ed25519PrivateKey,
+    ed448.Ed448PrivateKey,
+]
+
+
+class PKCS12Certificate:
+    def __init__(
+        self,
+        cert: x509.Certificate,
+        friendly_name: typing.Optional[bytes],
+    ):
+        if not isinstance(cert, x509.Certificate):
+            raise TypeError("Expecting x509.Certificate object")
+        if friendly_name is not None and not isinstance(friendly_name, bytes):
+            raise TypeError("friendly_name must be bytes or None")
+        self._cert = cert
+        self._friendly_name = friendly_name
+
+    @property
+    def friendly_name(self) -> typing.Optional[bytes]:
+        return self._friendly_name
+
+    @property
+    def certificate(self) -> x509.Certificate:
+        return self._cert
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PKCS12Certificate):
+            return NotImplemented
+
+        return (
+            self.certificate == other.certificate
+            and self.friendly_name == other.friendly_name
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.certificate, self.friendly_name))
+
+    def __repr__(self) -> str:
+        return "<PKCS12Certificate({}, friendly_name={!r})>".format(
+            self.certificate, self.friendly_name
+        )
+
+
+class PKCS12KeyAndCertificates:
+    def __init__(
+        self,
+        key: typing.Optional[PrivateKeyTypes],
+        cert: typing.Optional[PKCS12Certificate],
+        additional_certs: typing.List[PKCS12Certificate],
+    ):
+        if key is not None and not isinstance(
+            key,
+            (
+                rsa.RSAPrivateKey,
+                dsa.DSAPrivateKey,
+                ec.EllipticCurvePrivateKey,
+                ed25519.Ed25519PrivateKey,
+                ed448.Ed448PrivateKey,
+            ),
+        ):
+            raise TypeError(
+                "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448"
+                " private key, or None."
+            )
+        if cert is not None and not isinstance(cert, PKCS12Certificate):
+            raise TypeError("cert must be a PKCS12Certificate object or None")
+        if not all(
+            isinstance(add_cert, PKCS12Certificate)
+            for add_cert in additional_certs
+        ):
+            raise TypeError(
+                "all values in additional_certs must be PKCS12Certificate"
+                " objects"
+            )
+        self._key = key
+        self._cert = cert
+        self._additional_certs = additional_certs
+
+    @property
+    def key(self) -> typing.Optional[PrivateKeyTypes]:
+        return self._key
+
+    @property
+    def cert(self) -> typing.Optional[PKCS12Certificate]:
+        return self._cert
+
+    @property
+    def additional_certs(self) -> typing.List[PKCS12Certificate]:
+        return self._additional_certs
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PKCS12KeyAndCertificates):
+            return NotImplemented
+
+        return (
+            self.key == other.key
+            and self.cert == other.cert
+            and self.additional_certs == other.additional_certs
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.key, self.cert, tuple(self.additional_certs)))
+
+    def __repr__(self) -> str:
+        fmt = (
+            "<PKCS12KeyAndCertificates(key={}, cert={}, additional_certs={})>"
+        )
+        return fmt.format(self.key, self.cert, self.additional_certs)
+
+
+def load_key_and_certificates(
+    data: bytes,
+    password: typing.Optional[bytes],
+    backend: typing.Any = None,
+) -> typing.Tuple[
+    typing.Optional[PrivateKeyTypes],
+    typing.Optional[x509.Certificate],
+    typing.List[x509.Certificate],
+]:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_key_and_certificates_from_pkcs12(data, password)
+
+
+def load_pkcs12(
+    data: bytes,
+    password: typing.Optional[bytes],
+    backend: typing.Any = None,
+) -> PKCS12KeyAndCertificates:
+    from cryptography.hazmat.backends.openssl.backend import backend as ossl
+
+    return ossl.load_pkcs12(data, password)
+
+
+_PKCS12CATypes = typing.Union[
+    x509.Certificate,
+    PKCS12Certificate,
+]
+
+
+def serialize_key_and_certificates(
+    name: typing.Optional[bytes],
+    key: typing.Optional[PKCS12PrivateKeyTypes],
+    cert: typing.Optional[x509.Certificate],
+    cas: typing.Optional[typing.Iterable[_PKCS12CATypes]],
+    encryption_algorithm: serialization.KeySerializationEncryption,
+) -> bytes:
+    if key is not None and not isinstance(
+        key,
+        (
+            rsa.RSAPrivateKey,
+            dsa.DSAPrivateKey,
+            ec.EllipticCurvePrivateKey,
+            ed25519.Ed25519PrivateKey,
+            ed448.Ed448PrivateKey,
+        ),
+    ):
+        raise TypeError(
+            "Key must be RSA, DSA, EllipticCurve, ED25519, or ED448"
+            " private key, or None."
+        )
+    if cert is not None and not isinstance(cert, x509.Certificate):
+        raise TypeError("cert must be a certificate or None")
+
+    if cas is not None:
+        cas = list(cas)
+        if not all(
+            isinstance(
+                val,
+                (
+                    x509.Certificate,
+                    PKCS12Certificate,
+                ),
+            )
+            for val in cas
+        ):
+            raise TypeError("all values in cas must be certificates")
+
+    if not isinstance(
+        encryption_algorithm, serialization.KeySerializationEncryption
+    ):
+        raise TypeError(
+            "Key encryption algorithm must be a "
+            "KeySerializationEncryption instance"
+        )
+
+    if key is None and cert is None and not cas:
+        raise ValueError("You must supply at least one of key, cert, or cas")
+
+    from cryptography.hazmat.backends.openssl.backend import backend
+
+    return backend.serialize_key_and_certificates_to_pkcs12(
+        name, key, cert, cas, encryption_algorithm
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py
new file mode 100644
index 0000000000000000000000000000000000000000..9998bcaa1131db00cf432f24fb1731b65ae697cd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/pkcs7.py
@@ -0,0 +1,235 @@
+# 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 annotations
+
+import email.base64mime
+import email.generator
+import email.message
+import email.policy
+import io
+import typing
+
+from cryptography import utils, x509
+from cryptography.hazmat.bindings._rust import pkcs7 as rust_pkcs7
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import ec, rsa
+from cryptography.utils import _check_byteslike
+
+
+def load_pem_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]:
+    from cryptography.hazmat.backends.openssl.backend import backend
+
+    return backend.load_pem_pkcs7_certificates(data)
+
+
+def load_der_pkcs7_certificates(data: bytes) -> typing.List[x509.Certificate]:
+    from cryptography.hazmat.backends.openssl.backend import backend
+
+    return backend.load_der_pkcs7_certificates(data)
+
+
+def serialize_certificates(
+    certs: typing.List[x509.Certificate],
+    encoding: serialization.Encoding,
+) -> bytes:
+    return rust_pkcs7.serialize_certificates(certs, encoding)
+
+
+PKCS7HashTypes = typing.Union[
+    hashes.SHA224,
+    hashes.SHA256,
+    hashes.SHA384,
+    hashes.SHA512,
+]
+
+PKCS7PrivateKeyTypes = typing.Union[
+    rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey
+]
+
+
+class PKCS7Options(utils.Enum):
+    Text = "Add text/plain MIME type"
+    Binary = "Don't translate input data into canonical MIME format"
+    DetachedSignature = "Don't embed data in the PKCS7 structure"
+    NoCapabilities = "Don't embed SMIME capabilities"
+    NoAttributes = "Don't embed authenticatedAttributes"
+    NoCerts = "Don't embed signer certificate"
+
+
+class PKCS7SignatureBuilder:
+    def __init__(
+        self,
+        data: typing.Optional[bytes] = None,
+        signers: typing.List[
+            typing.Tuple[
+                x509.Certificate,
+                PKCS7PrivateKeyTypes,
+                PKCS7HashTypes,
+            ]
+        ] = [],
+        additional_certs: typing.List[x509.Certificate] = [],
+    ):
+        self._data = data
+        self._signers = signers
+        self._additional_certs = additional_certs
+
+    def set_data(self, data: bytes) -> PKCS7SignatureBuilder:
+        _check_byteslike("data", data)
+        if self._data is not None:
+            raise ValueError("data may only be set once")
+
+        return PKCS7SignatureBuilder(data, self._signers)
+
+    def add_signer(
+        self,
+        certificate: x509.Certificate,
+        private_key: PKCS7PrivateKeyTypes,
+        hash_algorithm: PKCS7HashTypes,
+    ) -> PKCS7SignatureBuilder:
+        if not isinstance(
+            hash_algorithm,
+            (
+                hashes.SHA224,
+                hashes.SHA256,
+                hashes.SHA384,
+                hashes.SHA512,
+            ),
+        ):
+            raise TypeError(
+                "hash_algorithm must be one of hashes.SHA224, "
+                "SHA256, SHA384, or SHA512"
+            )
+        if not isinstance(certificate, x509.Certificate):
+            raise TypeError("certificate must be a x509.Certificate")
+
+        if not isinstance(
+            private_key, (rsa.RSAPrivateKey, ec.EllipticCurvePrivateKey)
+        ):
+            raise TypeError("Only RSA & EC keys are supported at this time.")
+
+        return PKCS7SignatureBuilder(
+            self._data,
+            self._signers + [(certificate, private_key, hash_algorithm)],
+        )
+
+    def add_certificate(
+        self, certificate: x509.Certificate
+    ) -> PKCS7SignatureBuilder:
+        if not isinstance(certificate, x509.Certificate):
+            raise TypeError("certificate must be a x509.Certificate")
+
+        return PKCS7SignatureBuilder(
+            self._data, self._signers, self._additional_certs + [certificate]
+        )
+
+    def sign(
+        self,
+        encoding: serialization.Encoding,
+        options: typing.Iterable[PKCS7Options],
+        backend: typing.Any = None,
+    ) -> bytes:
+        if len(self._signers) == 0:
+            raise ValueError("Must have at least one signer")
+        if self._data is None:
+            raise ValueError("You must add data to sign")
+        options = list(options)
+        if not all(isinstance(x, PKCS7Options) for x in options):
+            raise ValueError("options must be from the PKCS7Options enum")
+        if encoding not in (
+            serialization.Encoding.PEM,
+            serialization.Encoding.DER,
+            serialization.Encoding.SMIME,
+        ):
+            raise ValueError(
+                "Must be PEM, DER, or SMIME from the Encoding enum"
+            )
+
+        # Text is a meaningless option unless it is accompanied by
+        # DetachedSignature
+        if (
+            PKCS7Options.Text in options
+            and PKCS7Options.DetachedSignature not in options
+        ):
+            raise ValueError(
+                "When passing the Text option you must also pass "
+                "DetachedSignature"
+            )
+
+        if PKCS7Options.Text in options and encoding in (
+            serialization.Encoding.DER,
+            serialization.Encoding.PEM,
+        ):
+            raise ValueError(
+                "The Text option is only available for SMIME serialization"
+            )
+
+        # No attributes implies no capabilities so we'll error if you try to
+        # pass both.
+        if (
+            PKCS7Options.NoAttributes in options
+            and PKCS7Options.NoCapabilities in options
+        ):
+            raise ValueError(
+                "NoAttributes is a superset of NoCapabilities. Do not pass "
+                "both values."
+            )
+
+        return rust_pkcs7.sign_and_serialize(self, encoding, options)
+
+
+def _smime_encode(
+    data: bytes, signature: bytes, micalg: str, text_mode: bool
+) -> bytes:
+    # This function works pretty hard to replicate what OpenSSL does
+    # precisely. For good and for ill.
+
+    m = email.message.Message()
+    m.add_header("MIME-Version", "1.0")
+    m.add_header(
+        "Content-Type",
+        "multipart/signed",
+        protocol="application/x-pkcs7-signature",
+        micalg=micalg,
+    )
+
+    m.preamble = "This is an S/MIME signed message\n"
+
+    msg_part = OpenSSLMimePart()
+    msg_part.set_payload(data)
+    if text_mode:
+        msg_part.add_header("Content-Type", "text/plain")
+    m.attach(msg_part)
+
+    sig_part = email.message.MIMEPart()
+    sig_part.add_header(
+        "Content-Type", "application/x-pkcs7-signature", name="smime.p7s"
+    )
+    sig_part.add_header("Content-Transfer-Encoding", "base64")
+    sig_part.add_header(
+        "Content-Disposition", "attachment", filename="smime.p7s"
+    )
+    sig_part.set_payload(
+        email.base64mime.body_encode(signature, maxlinelen=65)
+    )
+    del sig_part["MIME-Version"]
+    m.attach(sig_part)
+
+    fp = io.BytesIO()
+    g = email.generator.BytesGenerator(
+        fp,
+        maxheaderlen=0,
+        mangle_from_=False,
+        policy=m.policy.clone(linesep="\r\n"),
+    )
+    g.flatten(m)
+    return fp.getvalue()
+
+
+class OpenSSLMimePart(email.message.MIMEPart):
+    # A MIMEPart subclass that replicates OpenSSL's behavior of not including
+    # a newline if there are no headers.
+    def _write_headers(self, generator) -> None:
+        if list(self.raw_items()):
+            generator._write_headers(self)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/ssh.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/ssh.py
new file mode 100644
index 0000000000000000000000000000000000000000..35e53c102875a6ded5298a59afcd04c8386a0794
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/serialization/ssh.py
@@ -0,0 +1,1534 @@
+# 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 annotations
+
+import binascii
+import enum
+import os
+import re
+import typing
+import warnings
+from base64 import encodebytes as _base64_encode
+from dataclasses import dataclass
+
+from cryptography import utils
+from cryptography.exceptions import UnsupportedAlgorithm
+from cryptography.hazmat.primitives import hashes
+from cryptography.hazmat.primitives.asymmetric import (
+    dsa,
+    ec,
+    ed25519,
+    padding,
+    rsa,
+)
+from cryptography.hazmat.primitives.asymmetric import utils as asym_utils
+from cryptography.hazmat.primitives.ciphers import (
+    AEADDecryptionContext,
+    Cipher,
+    algorithms,
+    modes,
+)
+from cryptography.hazmat.primitives.serialization import (
+    Encoding,
+    KeySerializationEncryption,
+    NoEncryption,
+    PrivateFormat,
+    PublicFormat,
+    _KeySerializationEncryption,
+)
+
+try:
+    from bcrypt import kdf as _bcrypt_kdf
+
+    _bcrypt_supported = True
+except ImportError:
+    _bcrypt_supported = False
+
+    def _bcrypt_kdf(
+        password: bytes,
+        salt: bytes,
+        desired_key_bytes: int,
+        rounds: int,
+        ignore_few_rounds: bool = False,
+    ) -> bytes:
+        raise UnsupportedAlgorithm("Need bcrypt module")
+
+
+_SSH_ED25519 = b"ssh-ed25519"
+_SSH_RSA = b"ssh-rsa"
+_SSH_DSA = b"ssh-dss"
+_ECDSA_NISTP256 = b"ecdsa-sha2-nistp256"
+_ECDSA_NISTP384 = b"ecdsa-sha2-nistp384"
+_ECDSA_NISTP521 = b"ecdsa-sha2-nistp521"
+_CERT_SUFFIX = b"-cert-v01@openssh.com"
+
+# These are not key types, only algorithms, so they cannot appear
+# as a public key type
+_SSH_RSA_SHA256 = b"rsa-sha2-256"
+_SSH_RSA_SHA512 = b"rsa-sha2-512"
+
+_SSH_PUBKEY_RC = re.compile(rb"\A(\S+)[ \t]+(\S+)")
+_SK_MAGIC = b"openssh-key-v1\0"
+_SK_START = b"-----BEGIN OPENSSH PRIVATE KEY-----"
+_SK_END = b"-----END OPENSSH PRIVATE KEY-----"
+_BCRYPT = b"bcrypt"
+_NONE = b"none"
+_DEFAULT_CIPHER = b"aes256-ctr"
+_DEFAULT_ROUNDS = 16
+
+# re is only way to work on bytes-like data
+_PEM_RC = re.compile(_SK_START + b"(.*?)" + _SK_END, re.DOTALL)
+
+# padding for max blocksize
+_PADDING = memoryview(bytearray(range(1, 1 + 16)))
+
+
+@dataclass
+class _SSHCipher:
+    alg: typing.Type[algorithms.AES]
+    key_len: int
+    mode: typing.Union[
+        typing.Type[modes.CTR],
+        typing.Type[modes.CBC],
+        typing.Type[modes.GCM],
+    ]
+    block_len: int
+    iv_len: int
+    tag_len: typing.Optional[int]
+    is_aead: bool
+
+
+# ciphers that are actually used in key wrapping
+_SSH_CIPHERS: typing.Dict[bytes, _SSHCipher] = {
+    b"aes256-ctr": _SSHCipher(
+        alg=algorithms.AES,
+        key_len=32,
+        mode=modes.CTR,
+        block_len=16,
+        iv_len=16,
+        tag_len=None,
+        is_aead=False,
+    ),
+    b"aes256-cbc": _SSHCipher(
+        alg=algorithms.AES,
+        key_len=32,
+        mode=modes.CBC,
+        block_len=16,
+        iv_len=16,
+        tag_len=None,
+        is_aead=False,
+    ),
+    b"aes256-gcm@openssh.com": _SSHCipher(
+        alg=algorithms.AES,
+        key_len=32,
+        mode=modes.GCM,
+        block_len=16,
+        iv_len=12,
+        tag_len=16,
+        is_aead=True,
+    ),
+}
+
+# map local curve name to key type
+_ECDSA_KEY_TYPE = {
+    "secp256r1": _ECDSA_NISTP256,
+    "secp384r1": _ECDSA_NISTP384,
+    "secp521r1": _ECDSA_NISTP521,
+}
+
+
+def _get_ssh_key_type(
+    key: typing.Union[SSHPrivateKeyTypes, SSHPublicKeyTypes]
+) -> bytes:
+    if isinstance(key, ec.EllipticCurvePrivateKey):
+        key_type = _ecdsa_key_type(key.public_key())
+    elif isinstance(key, ec.EllipticCurvePublicKey):
+        key_type = _ecdsa_key_type(key)
+    elif isinstance(key, (rsa.RSAPrivateKey, rsa.RSAPublicKey)):
+        key_type = _SSH_RSA
+    elif isinstance(key, (dsa.DSAPrivateKey, dsa.DSAPublicKey)):
+        key_type = _SSH_DSA
+    elif isinstance(
+        key, (ed25519.Ed25519PrivateKey, ed25519.Ed25519PublicKey)
+    ):
+        key_type = _SSH_ED25519
+    else:
+        raise ValueError("Unsupported key type")
+
+    return key_type
+
+
+def _ecdsa_key_type(public_key: ec.EllipticCurvePublicKey) -> bytes:
+    """Return SSH key_type and curve_name for private key."""
+    curve = public_key.curve
+    if curve.name not in _ECDSA_KEY_TYPE:
+        raise ValueError(
+            f"Unsupported curve for ssh private key: {curve.name!r}"
+        )
+    return _ECDSA_KEY_TYPE[curve.name]
+
+
+def _ssh_pem_encode(
+    data: bytes,
+    prefix: bytes = _SK_START + b"\n",
+    suffix: bytes = _SK_END + b"\n",
+) -> bytes:
+    return b"".join([prefix, _base64_encode(data), suffix])
+
+
+def _check_block_size(data: bytes, block_len: int) -> None:
+    """Require data to be full blocks"""
+    if not data or len(data) % block_len != 0:
+        raise ValueError("Corrupt data: missing padding")
+
+
+def _check_empty(data: bytes) -> None:
+    """All data should have been parsed."""
+    if data:
+        raise ValueError("Corrupt data: unparsed data")
+
+
+def _init_cipher(
+    ciphername: bytes,
+    password: typing.Optional[bytes],
+    salt: bytes,
+    rounds: int,
+) -> Cipher[typing.Union[modes.CBC, modes.CTR, modes.GCM]]:
+    """Generate key + iv and return cipher."""
+    if not password:
+        raise ValueError("Key is password-protected.")
+
+    ciph = _SSH_CIPHERS[ciphername]
+    seed = _bcrypt_kdf(
+        password, salt, ciph.key_len + ciph.iv_len, rounds, True
+    )
+    return Cipher(
+        ciph.alg(seed[: ciph.key_len]),
+        ciph.mode(seed[ciph.key_len :]),
+    )
+
+
+def _get_u32(data: memoryview) -> typing.Tuple[int, memoryview]:
+    """Uint32"""
+    if len(data) < 4:
+        raise ValueError("Invalid data")
+    return int.from_bytes(data[:4], byteorder="big"), data[4:]
+
+
+def _get_u64(data: memoryview) -> typing.Tuple[int, memoryview]:
+    """Uint64"""
+    if len(data) < 8:
+        raise ValueError("Invalid data")
+    return int.from_bytes(data[:8], byteorder="big"), data[8:]
+
+
+def _get_sshstr(data: memoryview) -> typing.Tuple[memoryview, memoryview]:
+    """Bytes with u32 length prefix"""
+    n, data = _get_u32(data)
+    if n > len(data):
+        raise ValueError("Invalid data")
+    return data[:n], data[n:]
+
+
+def _get_mpint(data: memoryview) -> typing.Tuple[int, memoryview]:
+    """Big integer."""
+    val, data = _get_sshstr(data)
+    if val and val[0] > 0x7F:
+        raise ValueError("Invalid data")
+    return int.from_bytes(val, "big"), data
+
+
+def _to_mpint(val: int) -> bytes:
+    """Storage format for signed bigint."""
+    if val < 0:
+        raise ValueError("negative mpint not allowed")
+    if not val:
+        return b""
+    nbytes = (val.bit_length() + 8) // 8
+    return utils.int_to_bytes(val, nbytes)
+
+
+class _FragList:
+    """Build recursive structure without data copy."""
+
+    flist: typing.List[bytes]
+
+    def __init__(
+        self, init: typing.Optional[typing.List[bytes]] = None
+    ) -> None:
+        self.flist = []
+        if init:
+            self.flist.extend(init)
+
+    def put_raw(self, val: bytes) -> None:
+        """Add plain bytes"""
+        self.flist.append(val)
+
+    def put_u32(self, val: int) -> None:
+        """Big-endian uint32"""
+        self.flist.append(val.to_bytes(length=4, byteorder="big"))
+
+    def put_u64(self, val: int) -> None:
+        """Big-endian uint64"""
+        self.flist.append(val.to_bytes(length=8, byteorder="big"))
+
+    def put_sshstr(self, val: typing.Union[bytes, _FragList]) -> None:
+        """Bytes prefixed with u32 length"""
+        if isinstance(val, (bytes, memoryview, bytearray)):
+            self.put_u32(len(val))
+            self.flist.append(val)
+        else:
+            self.put_u32(val.size())
+            self.flist.extend(val.flist)
+
+    def put_mpint(self, val: int) -> None:
+        """Big-endian bigint prefixed with u32 length"""
+        self.put_sshstr(_to_mpint(val))
+
+    def size(self) -> int:
+        """Current number of bytes"""
+        return sum(map(len, self.flist))
+
+    def render(self, dstbuf: memoryview, pos: int = 0) -> int:
+        """Write into bytearray"""
+        for frag in self.flist:
+            flen = len(frag)
+            start, pos = pos, pos + flen
+            dstbuf[start:pos] = frag
+        return pos
+
+    def tobytes(self) -> bytes:
+        """Return as bytes"""
+        buf = memoryview(bytearray(self.size()))
+        self.render(buf)
+        return buf.tobytes()
+
+
+class _SSHFormatRSA:
+    """Format for RSA keys.
+
+    Public:
+        mpint e, n
+    Private:
+        mpint n, e, d, iqmp, p, q
+    """
+
+    def get_public(self, data: memoryview):
+        """RSA public fields"""
+        e, data = _get_mpint(data)
+        n, data = _get_mpint(data)
+        return (e, n), data
+
+    def load_public(
+        self, data: memoryview
+    ) -> typing.Tuple[rsa.RSAPublicKey, memoryview]:
+        """Make RSA public key from data."""
+        (e, n), data = self.get_public(data)
+        public_numbers = rsa.RSAPublicNumbers(e, n)
+        public_key = public_numbers.public_key()
+        return public_key, data
+
+    def load_private(
+        self, data: memoryview, pubfields
+    ) -> typing.Tuple[rsa.RSAPrivateKey, memoryview]:
+        """Make RSA private key from data."""
+        n, data = _get_mpint(data)
+        e, data = _get_mpint(data)
+        d, data = _get_mpint(data)
+        iqmp, data = _get_mpint(data)
+        p, data = _get_mpint(data)
+        q, data = _get_mpint(data)
+
+        if (e, n) != pubfields:
+            raise ValueError("Corrupt data: rsa field mismatch")
+        dmp1 = rsa.rsa_crt_dmp1(d, p)
+        dmq1 = rsa.rsa_crt_dmq1(d, q)
+        public_numbers = rsa.RSAPublicNumbers(e, n)
+        private_numbers = rsa.RSAPrivateNumbers(
+            p, q, d, dmp1, dmq1, iqmp, public_numbers
+        )
+        private_key = private_numbers.private_key()
+        return private_key, data
+
+    def encode_public(
+        self, public_key: rsa.RSAPublicKey, f_pub: _FragList
+    ) -> None:
+        """Write RSA public key"""
+        pubn = public_key.public_numbers()
+        f_pub.put_mpint(pubn.e)
+        f_pub.put_mpint(pubn.n)
+
+    def encode_private(
+        self, private_key: rsa.RSAPrivateKey, f_priv: _FragList
+    ) -> None:
+        """Write RSA private key"""
+        private_numbers = private_key.private_numbers()
+        public_numbers = private_numbers.public_numbers
+
+        f_priv.put_mpint(public_numbers.n)
+        f_priv.put_mpint(public_numbers.e)
+
+        f_priv.put_mpint(private_numbers.d)
+        f_priv.put_mpint(private_numbers.iqmp)
+        f_priv.put_mpint(private_numbers.p)
+        f_priv.put_mpint(private_numbers.q)
+
+
+class _SSHFormatDSA:
+    """Format for DSA keys.
+
+    Public:
+        mpint p, q, g, y
+    Private:
+        mpint p, q, g, y, x
+    """
+
+    def get_public(
+        self, data: memoryview
+    ) -> typing.Tuple[typing.Tuple, memoryview]:
+        """DSA public fields"""
+        p, data = _get_mpint(data)
+        q, data = _get_mpint(data)
+        g, data = _get_mpint(data)
+        y, data = _get_mpint(data)
+        return (p, q, g, y), data
+
+    def load_public(
+        self, data: memoryview
+    ) -> typing.Tuple[dsa.DSAPublicKey, memoryview]:
+        """Make DSA public key from data."""
+        (p, q, g, y), data = self.get_public(data)
+        parameter_numbers = dsa.DSAParameterNumbers(p, q, g)
+        public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers)
+        self._validate(public_numbers)
+        public_key = public_numbers.public_key()
+        return public_key, data
+
+    def load_private(
+        self, data: memoryview, pubfields
+    ) -> typing.Tuple[dsa.DSAPrivateKey, memoryview]:
+        """Make DSA private key from data."""
+        (p, q, g, y), data = self.get_public(data)
+        x, data = _get_mpint(data)
+
+        if (p, q, g, y) != pubfields:
+            raise ValueError("Corrupt data: dsa field mismatch")
+        parameter_numbers = dsa.DSAParameterNumbers(p, q, g)
+        public_numbers = dsa.DSAPublicNumbers(y, parameter_numbers)
+        self._validate(public_numbers)
+        private_numbers = dsa.DSAPrivateNumbers(x, public_numbers)
+        private_key = private_numbers.private_key()
+        return private_key, data
+
+    def encode_public(
+        self, public_key: dsa.DSAPublicKey, f_pub: _FragList
+    ) -> None:
+        """Write DSA public key"""
+        public_numbers = public_key.public_numbers()
+        parameter_numbers = public_numbers.parameter_numbers
+        self._validate(public_numbers)
+
+        f_pub.put_mpint(parameter_numbers.p)
+        f_pub.put_mpint(parameter_numbers.q)
+        f_pub.put_mpint(parameter_numbers.g)
+        f_pub.put_mpint(public_numbers.y)
+
+    def encode_private(
+        self, private_key: dsa.DSAPrivateKey, f_priv: _FragList
+    ) -> None:
+        """Write DSA private key"""
+        self.encode_public(private_key.public_key(), f_priv)
+        f_priv.put_mpint(private_key.private_numbers().x)
+
+    def _validate(self, public_numbers: dsa.DSAPublicNumbers) -> None:
+        parameter_numbers = public_numbers.parameter_numbers
+        if parameter_numbers.p.bit_length() != 1024:
+            raise ValueError("SSH supports only 1024 bit DSA keys")
+
+
+class _SSHFormatECDSA:
+    """Format for ECDSA keys.
+
+    Public:
+        str curve
+        bytes point
+    Private:
+        str curve
+        bytes point
+        mpint secret
+    """
+
+    def __init__(self, ssh_curve_name: bytes, curve: ec.EllipticCurve):
+        self.ssh_curve_name = ssh_curve_name
+        self.curve = curve
+
+    def get_public(
+        self, data: memoryview
+    ) -> typing.Tuple[typing.Tuple, memoryview]:
+        """ECDSA public fields"""
+        curve, data = _get_sshstr(data)
+        point, data = _get_sshstr(data)
+        if curve != self.ssh_curve_name:
+            raise ValueError("Curve name mismatch")
+        if point[0] != 4:
+            raise NotImplementedError("Need uncompressed point")
+        return (curve, point), data
+
+    def load_public(
+        self, data: memoryview
+    ) -> typing.Tuple[ec.EllipticCurvePublicKey, memoryview]:
+        """Make ECDSA public key from data."""
+        (curve_name, point), data = self.get_public(data)
+        public_key = ec.EllipticCurvePublicKey.from_encoded_point(
+            self.curve, point.tobytes()
+        )
+        return public_key, data
+
+    def load_private(
+        self, data: memoryview, pubfields
+    ) -> typing.Tuple[ec.EllipticCurvePrivateKey, memoryview]:
+        """Make ECDSA private key from data."""
+        (curve_name, point), data = self.get_public(data)
+        secret, data = _get_mpint(data)
+
+        if (curve_name, point) != pubfields:
+            raise ValueError("Corrupt data: ecdsa field mismatch")
+        private_key = ec.derive_private_key(secret, self.curve)
+        return private_key, data
+
+    def encode_public(
+        self, public_key: ec.EllipticCurvePublicKey, f_pub: _FragList
+    ) -> None:
+        """Write ECDSA public key"""
+        point = public_key.public_bytes(
+            Encoding.X962, PublicFormat.UncompressedPoint
+        )
+        f_pub.put_sshstr(self.ssh_curve_name)
+        f_pub.put_sshstr(point)
+
+    def encode_private(
+        self, private_key: ec.EllipticCurvePrivateKey, f_priv: _FragList
+    ) -> None:
+        """Write ECDSA private key"""
+        public_key = private_key.public_key()
+        private_numbers = private_key.private_numbers()
+
+        self.encode_public(public_key, f_priv)
+        f_priv.put_mpint(private_numbers.private_value)
+
+
+class _SSHFormatEd25519:
+    """Format for Ed25519 keys.
+
+    Public:
+        bytes point
+    Private:
+        bytes point
+        bytes secret_and_point
+    """
+
+    def get_public(
+        self, data: memoryview
+    ) -> typing.Tuple[typing.Tuple, memoryview]:
+        """Ed25519 public fields"""
+        point, data = _get_sshstr(data)
+        return (point,), data
+
+    def load_public(
+        self, data: memoryview
+    ) -> typing.Tuple[ed25519.Ed25519PublicKey, memoryview]:
+        """Make Ed25519 public key from data."""
+        (point,), data = self.get_public(data)
+        public_key = ed25519.Ed25519PublicKey.from_public_bytes(
+            point.tobytes()
+        )
+        return public_key, data
+
+    def load_private(
+        self, data: memoryview, pubfields
+    ) -> typing.Tuple[ed25519.Ed25519PrivateKey, memoryview]:
+        """Make Ed25519 private key from data."""
+        (point,), data = self.get_public(data)
+        keypair, data = _get_sshstr(data)
+
+        secret = keypair[:32]
+        point2 = keypair[32:]
+        if point != point2 or (point,) != pubfields:
+            raise ValueError("Corrupt data: ed25519 field mismatch")
+        private_key = ed25519.Ed25519PrivateKey.from_private_bytes(secret)
+        return private_key, data
+
+    def encode_public(
+        self, public_key: ed25519.Ed25519PublicKey, f_pub: _FragList
+    ) -> None:
+        """Write Ed25519 public key"""
+        raw_public_key = public_key.public_bytes(
+            Encoding.Raw, PublicFormat.Raw
+        )
+        f_pub.put_sshstr(raw_public_key)
+
+    def encode_private(
+        self, private_key: ed25519.Ed25519PrivateKey, f_priv: _FragList
+    ) -> None:
+        """Write Ed25519 private key"""
+        public_key = private_key.public_key()
+        raw_private_key = private_key.private_bytes(
+            Encoding.Raw, PrivateFormat.Raw, NoEncryption()
+        )
+        raw_public_key = public_key.public_bytes(
+            Encoding.Raw, PublicFormat.Raw
+        )
+        f_keypair = _FragList([raw_private_key, raw_public_key])
+
+        self.encode_public(public_key, f_priv)
+        f_priv.put_sshstr(f_keypair)
+
+
+_KEY_FORMATS = {
+    _SSH_RSA: _SSHFormatRSA(),
+    _SSH_DSA: _SSHFormatDSA(),
+    _SSH_ED25519: _SSHFormatEd25519(),
+    _ECDSA_NISTP256: _SSHFormatECDSA(b"nistp256", ec.SECP256R1()),
+    _ECDSA_NISTP384: _SSHFormatECDSA(b"nistp384", ec.SECP384R1()),
+    _ECDSA_NISTP521: _SSHFormatECDSA(b"nistp521", ec.SECP521R1()),
+}
+
+
+def _lookup_kformat(key_type: bytes):
+    """Return valid format or throw error"""
+    if not isinstance(key_type, bytes):
+        key_type = memoryview(key_type).tobytes()
+    if key_type in _KEY_FORMATS:
+        return _KEY_FORMATS[key_type]
+    raise UnsupportedAlgorithm(f"Unsupported key type: {key_type!r}")
+
+
+SSHPrivateKeyTypes = typing.Union[
+    ec.EllipticCurvePrivateKey,
+    rsa.RSAPrivateKey,
+    dsa.DSAPrivateKey,
+    ed25519.Ed25519PrivateKey,
+]
+
+
+def load_ssh_private_key(
+    data: bytes,
+    password: typing.Optional[bytes],
+    backend: typing.Any = None,
+) -> SSHPrivateKeyTypes:
+    """Load private key from OpenSSH custom encoding."""
+    utils._check_byteslike("data", data)
+    if password is not None:
+        utils._check_bytes("password", password)
+
+    m = _PEM_RC.search(data)
+    if not m:
+        raise ValueError("Not OpenSSH private key format")
+    p1 = m.start(1)
+    p2 = m.end(1)
+    data = binascii.a2b_base64(memoryview(data)[p1:p2])
+    if not data.startswith(_SK_MAGIC):
+        raise ValueError("Not OpenSSH private key format")
+    data = memoryview(data)[len(_SK_MAGIC) :]
+
+    # parse header
+    ciphername, data = _get_sshstr(data)
+    kdfname, data = _get_sshstr(data)
+    kdfoptions, data = _get_sshstr(data)
+    nkeys, data = _get_u32(data)
+    if nkeys != 1:
+        raise ValueError("Only one key supported")
+
+    # load public key data
+    pubdata, data = _get_sshstr(data)
+    pub_key_type, pubdata = _get_sshstr(pubdata)
+    kformat = _lookup_kformat(pub_key_type)
+    pubfields, pubdata = kformat.get_public(pubdata)
+    _check_empty(pubdata)
+
+    if (ciphername, kdfname) != (_NONE, _NONE):
+        ciphername_bytes = ciphername.tobytes()
+        if ciphername_bytes not in _SSH_CIPHERS:
+            raise UnsupportedAlgorithm(
+                f"Unsupported cipher: {ciphername_bytes!r}"
+            )
+        if kdfname != _BCRYPT:
+            raise UnsupportedAlgorithm(f"Unsupported KDF: {kdfname!r}")
+        blklen = _SSH_CIPHERS[ciphername_bytes].block_len
+        tag_len = _SSH_CIPHERS[ciphername_bytes].tag_len
+        # load secret data
+        edata, data = _get_sshstr(data)
+        # see https://bugzilla.mindrot.org/show_bug.cgi?id=3553 for
+        # information about how OpenSSH handles AEAD tags
+        if _SSH_CIPHERS[ciphername_bytes].is_aead:
+            tag = bytes(data)
+            if len(tag) != tag_len:
+                raise ValueError("Corrupt data: invalid tag length for cipher")
+        else:
+            _check_empty(data)
+        _check_block_size(edata, blklen)
+        salt, kbuf = _get_sshstr(kdfoptions)
+        rounds, kbuf = _get_u32(kbuf)
+        _check_empty(kbuf)
+        ciph = _init_cipher(ciphername_bytes, password, salt.tobytes(), rounds)
+        dec = ciph.decryptor()
+        edata = memoryview(dec.update(edata))
+        if _SSH_CIPHERS[ciphername_bytes].is_aead:
+            assert isinstance(dec, AEADDecryptionContext)
+            _check_empty(dec.finalize_with_tag(tag))
+        else:
+            # _check_block_size requires data to be a full block so there
+            # should be no output from finalize
+            _check_empty(dec.finalize())
+    else:
+        # load secret data
+        edata, data = _get_sshstr(data)
+        _check_empty(data)
+        blklen = 8
+        _check_block_size(edata, blklen)
+    ck1, edata = _get_u32(edata)
+    ck2, edata = _get_u32(edata)
+    if ck1 != ck2:
+        raise ValueError("Corrupt data: broken checksum")
+
+    # load per-key struct
+    key_type, edata = _get_sshstr(edata)
+    if key_type != pub_key_type:
+        raise ValueError("Corrupt data: key type mismatch")
+    private_key, edata = kformat.load_private(edata, pubfields)
+    comment, edata = _get_sshstr(edata)
+
+    # yes, SSH does padding check *after* all other parsing is done.
+    # need to follow as it writes zero-byte padding too.
+    if edata != _PADDING[: len(edata)]:
+        raise ValueError("Corrupt data: invalid padding")
+
+    if isinstance(private_key, dsa.DSAPrivateKey):
+        warnings.warn(
+            "SSH DSA keys are deprecated and will be removed in a future "
+            "release.",
+            utils.DeprecatedIn40,
+            stacklevel=2,
+        )
+
+    return private_key
+
+
+def _serialize_ssh_private_key(
+    private_key: SSHPrivateKeyTypes,
+    password: bytes,
+    encryption_algorithm: KeySerializationEncryption,
+) -> bytes:
+    """Serialize private key with OpenSSH custom encoding."""
+    utils._check_bytes("password", password)
+    if isinstance(private_key, dsa.DSAPrivateKey):
+        warnings.warn(
+            "SSH DSA key support is deprecated and will be "
+            "removed in a future release",
+            utils.DeprecatedIn40,
+            stacklevel=4,
+        )
+
+    key_type = _get_ssh_key_type(private_key)
+    kformat = _lookup_kformat(key_type)
+
+    # setup parameters
+    f_kdfoptions = _FragList()
+    if password:
+        ciphername = _DEFAULT_CIPHER
+        blklen = _SSH_CIPHERS[ciphername].block_len
+        kdfname = _BCRYPT
+        rounds = _DEFAULT_ROUNDS
+        if (
+            isinstance(encryption_algorithm, _KeySerializationEncryption)
+            and encryption_algorithm._kdf_rounds is not None
+        ):
+            rounds = encryption_algorithm._kdf_rounds
+        salt = os.urandom(16)
+        f_kdfoptions.put_sshstr(salt)
+        f_kdfoptions.put_u32(rounds)
+        ciph = _init_cipher(ciphername, password, salt, rounds)
+    else:
+        ciphername = kdfname = _NONE
+        blklen = 8
+        ciph = None
+    nkeys = 1
+    checkval = os.urandom(4)
+    comment = b""
+
+    # encode public and private parts together
+    f_public_key = _FragList()
+    f_public_key.put_sshstr(key_type)
+    kformat.encode_public(private_key.public_key(), f_public_key)
+
+    f_secrets = _FragList([checkval, checkval])
+    f_secrets.put_sshstr(key_type)
+    kformat.encode_private(private_key, f_secrets)
+    f_secrets.put_sshstr(comment)
+    f_secrets.put_raw(_PADDING[: blklen - (f_secrets.size() % blklen)])
+
+    # top-level structure
+    f_main = _FragList()
+    f_main.put_raw(_SK_MAGIC)
+    f_main.put_sshstr(ciphername)
+    f_main.put_sshstr(kdfname)
+    f_main.put_sshstr(f_kdfoptions)
+    f_main.put_u32(nkeys)
+    f_main.put_sshstr(f_public_key)
+    f_main.put_sshstr(f_secrets)
+
+    # copy result info bytearray
+    slen = f_secrets.size()
+    mlen = f_main.size()
+    buf = memoryview(bytearray(mlen + blklen))
+    f_main.render(buf)
+    ofs = mlen - slen
+
+    # encrypt in-place
+    if ciph is not None:
+        ciph.encryptor().update_into(buf[ofs:mlen], buf[ofs:])
+
+    return _ssh_pem_encode(buf[:mlen])
+
+
+SSHPublicKeyTypes = typing.Union[
+    ec.EllipticCurvePublicKey,
+    rsa.RSAPublicKey,
+    dsa.DSAPublicKey,
+    ed25519.Ed25519PublicKey,
+]
+
+SSHCertPublicKeyTypes = typing.Union[
+    ec.EllipticCurvePublicKey,
+    rsa.RSAPublicKey,
+    ed25519.Ed25519PublicKey,
+]
+
+
+class SSHCertificateType(enum.Enum):
+    USER = 1
+    HOST = 2
+
+
+class SSHCertificate:
+    def __init__(
+        self,
+        _nonce: memoryview,
+        _public_key: SSHPublicKeyTypes,
+        _serial: int,
+        _cctype: int,
+        _key_id: memoryview,
+        _valid_principals: typing.List[bytes],
+        _valid_after: int,
+        _valid_before: int,
+        _critical_options: typing.Dict[bytes, bytes],
+        _extensions: typing.Dict[bytes, bytes],
+        _sig_type: memoryview,
+        _sig_key: memoryview,
+        _inner_sig_type: memoryview,
+        _signature: memoryview,
+        _tbs_cert_body: memoryview,
+        _cert_key_type: bytes,
+        _cert_body: memoryview,
+    ):
+        self._nonce = _nonce
+        self._public_key = _public_key
+        self._serial = _serial
+        try:
+            self._type = SSHCertificateType(_cctype)
+        except ValueError:
+            raise ValueError("Invalid certificate type")
+        self._key_id = _key_id
+        self._valid_principals = _valid_principals
+        self._valid_after = _valid_after
+        self._valid_before = _valid_before
+        self._critical_options = _critical_options
+        self._extensions = _extensions
+        self._sig_type = _sig_type
+        self._sig_key = _sig_key
+        self._inner_sig_type = _inner_sig_type
+        self._signature = _signature
+        self._cert_key_type = _cert_key_type
+        self._cert_body = _cert_body
+        self._tbs_cert_body = _tbs_cert_body
+
+    @property
+    def nonce(self) -> bytes:
+        return bytes(self._nonce)
+
+    def public_key(self) -> SSHCertPublicKeyTypes:
+        # make mypy happy until we remove DSA support entirely and
+        # the underlying union won't have a disallowed type
+        return typing.cast(SSHCertPublicKeyTypes, self._public_key)
+
+    @property
+    def serial(self) -> int:
+        return self._serial
+
+    @property
+    def type(self) -> SSHCertificateType:
+        return self._type
+
+    @property
+    def key_id(self) -> bytes:
+        return bytes(self._key_id)
+
+    @property
+    def valid_principals(self) -> typing.List[bytes]:
+        return self._valid_principals
+
+    @property
+    def valid_before(self) -> int:
+        return self._valid_before
+
+    @property
+    def valid_after(self) -> int:
+        return self._valid_after
+
+    @property
+    def critical_options(self) -> typing.Dict[bytes, bytes]:
+        return self._critical_options
+
+    @property
+    def extensions(self) -> typing.Dict[bytes, bytes]:
+        return self._extensions
+
+    def signature_key(self) -> SSHCertPublicKeyTypes:
+        sigformat = _lookup_kformat(self._sig_type)
+        signature_key, sigkey_rest = sigformat.load_public(self._sig_key)
+        _check_empty(sigkey_rest)
+        return signature_key
+
+    def public_bytes(self) -> bytes:
+        return (
+            bytes(self._cert_key_type)
+            + b" "
+            + binascii.b2a_base64(bytes(self._cert_body), newline=False)
+        )
+
+    def verify_cert_signature(self) -> None:
+        signature_key = self.signature_key()
+        if isinstance(signature_key, ed25519.Ed25519PublicKey):
+            signature_key.verify(
+                bytes(self._signature), bytes(self._tbs_cert_body)
+            )
+        elif isinstance(signature_key, ec.EllipticCurvePublicKey):
+            # The signature is encoded as a pair of big-endian integers
+            r, data = _get_mpint(self._signature)
+            s, data = _get_mpint(data)
+            _check_empty(data)
+            computed_sig = asym_utils.encode_dss_signature(r, s)
+            hash_alg = _get_ec_hash_alg(signature_key.curve)
+            signature_key.verify(
+                computed_sig, bytes(self._tbs_cert_body), ec.ECDSA(hash_alg)
+            )
+        else:
+            assert isinstance(signature_key, rsa.RSAPublicKey)
+            if self._inner_sig_type == _SSH_RSA:
+                hash_alg = hashes.SHA1()
+            elif self._inner_sig_type == _SSH_RSA_SHA256:
+                hash_alg = hashes.SHA256()
+            else:
+                assert self._inner_sig_type == _SSH_RSA_SHA512
+                hash_alg = hashes.SHA512()
+            signature_key.verify(
+                bytes(self._signature),
+                bytes(self._tbs_cert_body),
+                padding.PKCS1v15(),
+                hash_alg,
+            )
+
+
+def _get_ec_hash_alg(curve: ec.EllipticCurve) -> hashes.HashAlgorithm:
+    if isinstance(curve, ec.SECP256R1):
+        return hashes.SHA256()
+    elif isinstance(curve, ec.SECP384R1):
+        return hashes.SHA384()
+    else:
+        assert isinstance(curve, ec.SECP521R1)
+        return hashes.SHA512()
+
+
+def _load_ssh_public_identity(
+    data: bytes,
+    _legacy_dsa_allowed=False,
+) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]:
+    utils._check_byteslike("data", data)
+
+    m = _SSH_PUBKEY_RC.match(data)
+    if not m:
+        raise ValueError("Invalid line format")
+    key_type = orig_key_type = m.group(1)
+    key_body = m.group(2)
+    with_cert = False
+    if key_type.endswith(_CERT_SUFFIX):
+        with_cert = True
+        key_type = key_type[: -len(_CERT_SUFFIX)]
+    if key_type == _SSH_DSA and not _legacy_dsa_allowed:
+        raise UnsupportedAlgorithm(
+            "DSA keys aren't supported in SSH certificates"
+        )
+    kformat = _lookup_kformat(key_type)
+
+    try:
+        rest = memoryview(binascii.a2b_base64(key_body))
+    except (TypeError, binascii.Error):
+        raise ValueError("Invalid format")
+
+    if with_cert:
+        cert_body = rest
+    inner_key_type, rest = _get_sshstr(rest)
+    if inner_key_type != orig_key_type:
+        raise ValueError("Invalid key format")
+    if with_cert:
+        nonce, rest = _get_sshstr(rest)
+    public_key, rest = kformat.load_public(rest)
+    if with_cert:
+        serial, rest = _get_u64(rest)
+        cctype, rest = _get_u32(rest)
+        key_id, rest = _get_sshstr(rest)
+        principals, rest = _get_sshstr(rest)
+        valid_principals = []
+        while principals:
+            principal, principals = _get_sshstr(principals)
+            valid_principals.append(bytes(principal))
+        valid_after, rest = _get_u64(rest)
+        valid_before, rest = _get_u64(rest)
+        crit_options, rest = _get_sshstr(rest)
+        critical_options = _parse_exts_opts(crit_options)
+        exts, rest = _get_sshstr(rest)
+        extensions = _parse_exts_opts(exts)
+        # Get the reserved field, which is unused.
+        _, rest = _get_sshstr(rest)
+        sig_key_raw, rest = _get_sshstr(rest)
+        sig_type, sig_key = _get_sshstr(sig_key_raw)
+        if sig_type == _SSH_DSA and not _legacy_dsa_allowed:
+            raise UnsupportedAlgorithm(
+                "DSA signatures aren't supported in SSH certificates"
+            )
+        # Get the entire cert body and subtract the signature
+        tbs_cert_body = cert_body[: -len(rest)]
+        signature_raw, rest = _get_sshstr(rest)
+        _check_empty(rest)
+        inner_sig_type, sig_rest = _get_sshstr(signature_raw)
+        # RSA certs can have multiple algorithm types
+        if (
+            sig_type == _SSH_RSA
+            and inner_sig_type
+            not in [_SSH_RSA_SHA256, _SSH_RSA_SHA512, _SSH_RSA]
+        ) or (sig_type != _SSH_RSA and inner_sig_type != sig_type):
+            raise ValueError("Signature key type does not match")
+        signature, sig_rest = _get_sshstr(sig_rest)
+        _check_empty(sig_rest)
+        return SSHCertificate(
+            nonce,
+            public_key,
+            serial,
+            cctype,
+            key_id,
+            valid_principals,
+            valid_after,
+            valid_before,
+            critical_options,
+            extensions,
+            sig_type,
+            sig_key,
+            inner_sig_type,
+            signature,
+            tbs_cert_body,
+            orig_key_type,
+            cert_body,
+        )
+    else:
+        _check_empty(rest)
+        return public_key
+
+
+def load_ssh_public_identity(
+    data: bytes,
+) -> typing.Union[SSHCertificate, SSHPublicKeyTypes]:
+    return _load_ssh_public_identity(data)
+
+
+def _parse_exts_opts(exts_opts: memoryview) -> typing.Dict[bytes, bytes]:
+    result: typing.Dict[bytes, bytes] = {}
+    last_name = None
+    while exts_opts:
+        name, exts_opts = _get_sshstr(exts_opts)
+        bname: bytes = bytes(name)
+        if bname in result:
+            raise ValueError("Duplicate name")
+        if last_name is not None and bname < last_name:
+            raise ValueError("Fields not lexically sorted")
+        value, exts_opts = _get_sshstr(exts_opts)
+        if len(value) > 0:
+            try:
+                value, extra = _get_sshstr(value)
+            except ValueError:
+                warnings.warn(
+                    "This certificate has an incorrect encoding for critical "
+                    "options or extensions. This will be an exception in "
+                    "cryptography 42",
+                    utils.DeprecatedIn41,
+                    stacklevel=4,
+                )
+            else:
+                if len(extra) > 0:
+                    raise ValueError("Unexpected extra data after value")
+        result[bname] = bytes(value)
+        last_name = bname
+    return result
+
+
+def load_ssh_public_key(
+    data: bytes, backend: typing.Any = None
+) -> SSHPublicKeyTypes:
+    cert_or_key = _load_ssh_public_identity(data, _legacy_dsa_allowed=True)
+    public_key: SSHPublicKeyTypes
+    if isinstance(cert_or_key, SSHCertificate):
+        public_key = cert_or_key.public_key()
+    else:
+        public_key = cert_or_key
+
+    if isinstance(public_key, dsa.DSAPublicKey):
+        warnings.warn(
+            "SSH DSA keys are deprecated and will be removed in a future "
+            "release.",
+            utils.DeprecatedIn40,
+            stacklevel=2,
+        )
+    return public_key
+
+
+def serialize_ssh_public_key(public_key: SSHPublicKeyTypes) -> bytes:
+    """One-line public key format for OpenSSH"""
+    if isinstance(public_key, dsa.DSAPublicKey):
+        warnings.warn(
+            "SSH DSA key support is deprecated and will be "
+            "removed in a future release",
+            utils.DeprecatedIn40,
+            stacklevel=4,
+        )
+    key_type = _get_ssh_key_type(public_key)
+    kformat = _lookup_kformat(key_type)
+
+    f_pub = _FragList()
+    f_pub.put_sshstr(key_type)
+    kformat.encode_public(public_key, f_pub)
+
+    pub = binascii.b2a_base64(f_pub.tobytes()).strip()
+    return b"".join([key_type, b" ", pub])
+
+
+SSHCertPrivateKeyTypes = typing.Union[
+    ec.EllipticCurvePrivateKey,
+    rsa.RSAPrivateKey,
+    ed25519.Ed25519PrivateKey,
+]
+
+
+# This is an undocumented limit enforced in the openssh codebase for sshd and
+# ssh-keygen, but it is undefined in the ssh certificates spec.
+_SSHKEY_CERT_MAX_PRINCIPALS = 256
+
+
+class SSHCertificateBuilder:
+    def __init__(
+        self,
+        _public_key: typing.Optional[SSHCertPublicKeyTypes] = None,
+        _serial: typing.Optional[int] = None,
+        _type: typing.Optional[SSHCertificateType] = None,
+        _key_id: typing.Optional[bytes] = None,
+        _valid_principals: typing.List[bytes] = [],
+        _valid_for_all_principals: bool = False,
+        _valid_before: typing.Optional[int] = None,
+        _valid_after: typing.Optional[int] = None,
+        _critical_options: typing.List[typing.Tuple[bytes, bytes]] = [],
+        _extensions: typing.List[typing.Tuple[bytes, bytes]] = [],
+    ):
+        self._public_key = _public_key
+        self._serial = _serial
+        self._type = _type
+        self._key_id = _key_id
+        self._valid_principals = _valid_principals
+        self._valid_for_all_principals = _valid_for_all_principals
+        self._valid_before = _valid_before
+        self._valid_after = _valid_after
+        self._critical_options = _critical_options
+        self._extensions = _extensions
+
+    def public_key(
+        self, public_key: SSHCertPublicKeyTypes
+    ) -> SSHCertificateBuilder:
+        if not isinstance(
+            public_key,
+            (
+                ec.EllipticCurvePublicKey,
+                rsa.RSAPublicKey,
+                ed25519.Ed25519PublicKey,
+            ),
+        ):
+            raise TypeError("Unsupported key type")
+        if self._public_key is not None:
+            raise ValueError("public_key already set")
+
+        return SSHCertificateBuilder(
+            _public_key=public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def serial(self, serial: int) -> SSHCertificateBuilder:
+        if not isinstance(serial, int):
+            raise TypeError("serial must be an integer")
+        if not 0 <= serial < 2**64:
+            raise ValueError("serial must be between 0 and 2**64")
+        if self._serial is not None:
+            raise ValueError("serial already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def type(self, type: SSHCertificateType) -> SSHCertificateBuilder:
+        if not isinstance(type, SSHCertificateType):
+            raise TypeError("type must be an SSHCertificateType")
+        if self._type is not None:
+            raise ValueError("type already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def key_id(self, key_id: bytes) -> SSHCertificateBuilder:
+        if not isinstance(key_id, bytes):
+            raise TypeError("key_id must be bytes")
+        if self._key_id is not None:
+            raise ValueError("key_id already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def valid_principals(
+        self, valid_principals: typing.List[bytes]
+    ) -> SSHCertificateBuilder:
+        if self._valid_for_all_principals:
+            raise ValueError(
+                "Principals can't be set because the cert is valid "
+                "for all principals"
+            )
+        if (
+            not all(isinstance(x, bytes) for x in valid_principals)
+            or not valid_principals
+        ):
+            raise TypeError(
+                "principals must be a list of bytes and can't be empty"
+            )
+        if self._valid_principals:
+            raise ValueError("valid_principals already set")
+
+        if len(valid_principals) > _SSHKEY_CERT_MAX_PRINCIPALS:
+            raise ValueError(
+                "Reached or exceeded the maximum number of valid_principals"
+            )
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def valid_for_all_principals(self):
+        if self._valid_principals:
+            raise ValueError(
+                "valid_principals already set, can't set "
+                "valid_for_all_principals"
+            )
+        if self._valid_for_all_principals:
+            raise ValueError("valid_for_all_principals already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=True,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def valid_before(
+        self, valid_before: typing.Union[int, float]
+    ) -> SSHCertificateBuilder:
+        if not isinstance(valid_before, (int, float)):
+            raise TypeError("valid_before must be an int or float")
+        valid_before = int(valid_before)
+        if valid_before < 0 or valid_before >= 2**64:
+            raise ValueError("valid_before must [0, 2**64)")
+        if self._valid_before is not None:
+            raise ValueError("valid_before already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def valid_after(
+        self, valid_after: typing.Union[int, float]
+    ) -> SSHCertificateBuilder:
+        if not isinstance(valid_after, (int, float)):
+            raise TypeError("valid_after must be an int or float")
+        valid_after = int(valid_after)
+        if valid_after < 0 or valid_after >= 2**64:
+            raise ValueError("valid_after must [0, 2**64)")
+        if self._valid_after is not None:
+            raise ValueError("valid_after already set")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions,
+        )
+
+    def add_critical_option(
+        self, name: bytes, value: bytes
+    ) -> SSHCertificateBuilder:
+        if not isinstance(name, bytes) or not isinstance(value, bytes):
+            raise TypeError("name and value must be bytes")
+        # This is O(n**2)
+        if name in [name for name, _ in self._critical_options]:
+            raise ValueError("Duplicate critical option name")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options + [(name, value)],
+            _extensions=self._extensions,
+        )
+
+    def add_extension(
+        self, name: bytes, value: bytes
+    ) -> SSHCertificateBuilder:
+        if not isinstance(name, bytes) or not isinstance(value, bytes):
+            raise TypeError("name and value must be bytes")
+        # This is O(n**2)
+        if name in [name for name, _ in self._extensions]:
+            raise ValueError("Duplicate extension name")
+
+        return SSHCertificateBuilder(
+            _public_key=self._public_key,
+            _serial=self._serial,
+            _type=self._type,
+            _key_id=self._key_id,
+            _valid_principals=self._valid_principals,
+            _valid_for_all_principals=self._valid_for_all_principals,
+            _valid_before=self._valid_before,
+            _valid_after=self._valid_after,
+            _critical_options=self._critical_options,
+            _extensions=self._extensions + [(name, value)],
+        )
+
+    def sign(self, private_key: SSHCertPrivateKeyTypes) -> SSHCertificate:
+        if not isinstance(
+            private_key,
+            (
+                ec.EllipticCurvePrivateKey,
+                rsa.RSAPrivateKey,
+                ed25519.Ed25519PrivateKey,
+            ),
+        ):
+            raise TypeError("Unsupported private key type")
+
+        if self._public_key is None:
+            raise ValueError("public_key must be set")
+
+        # Not required
+        serial = 0 if self._serial is None else self._serial
+
+        if self._type is None:
+            raise ValueError("type must be set")
+
+        # Not required
+        key_id = b"" if self._key_id is None else self._key_id
+
+        # A zero length list is valid, but means the certificate
+        # is valid for any principal of the specified type. We require
+        # the user to explicitly set valid_for_all_principals to get
+        # that behavior.
+        if not self._valid_principals and not self._valid_for_all_principals:
+            raise ValueError(
+                "valid_principals must be set if valid_for_all_principals "
+                "is False"
+            )
+
+        if self._valid_before is None:
+            raise ValueError("valid_before must be set")
+
+        if self._valid_after is None:
+            raise ValueError("valid_after must be set")
+
+        if self._valid_after > self._valid_before:
+            raise ValueError("valid_after must be earlier than valid_before")
+
+        # lexically sort our byte strings
+        self._critical_options.sort(key=lambda x: x[0])
+        self._extensions.sort(key=lambda x: x[0])
+
+        key_type = _get_ssh_key_type(self._public_key)
+        cert_prefix = key_type + _CERT_SUFFIX
+
+        # Marshal the bytes to be signed
+        nonce = os.urandom(32)
+        kformat = _lookup_kformat(key_type)
+        f = _FragList()
+        f.put_sshstr(cert_prefix)
+        f.put_sshstr(nonce)
+        kformat.encode_public(self._public_key, f)
+        f.put_u64(serial)
+        f.put_u32(self._type.value)
+        f.put_sshstr(key_id)
+        fprincipals = _FragList()
+        for p in self._valid_principals:
+            fprincipals.put_sshstr(p)
+        f.put_sshstr(fprincipals.tobytes())
+        f.put_u64(self._valid_after)
+        f.put_u64(self._valid_before)
+        fcrit = _FragList()
+        for name, value in self._critical_options:
+            fcrit.put_sshstr(name)
+            if len(value) > 0:
+                foptval = _FragList()
+                foptval.put_sshstr(value)
+                fcrit.put_sshstr(foptval.tobytes())
+            else:
+                fcrit.put_sshstr(value)
+        f.put_sshstr(fcrit.tobytes())
+        fext = _FragList()
+        for name, value in self._extensions:
+            fext.put_sshstr(name)
+            if len(value) > 0:
+                fextval = _FragList()
+                fextval.put_sshstr(value)
+                fext.put_sshstr(fextval.tobytes())
+            else:
+                fext.put_sshstr(value)
+        f.put_sshstr(fext.tobytes())
+        f.put_sshstr(b"")  # RESERVED FIELD
+        # encode CA public key
+        ca_type = _get_ssh_key_type(private_key)
+        caformat = _lookup_kformat(ca_type)
+        caf = _FragList()
+        caf.put_sshstr(ca_type)
+        caformat.encode_public(private_key.public_key(), caf)
+        f.put_sshstr(caf.tobytes())
+        # Sigs according to the rules defined for the CA's public key
+        # (RFC4253 section 6.6 for ssh-rsa, RFC5656 for ECDSA,
+        # and RFC8032 for Ed25519).
+        if isinstance(private_key, ed25519.Ed25519PrivateKey):
+            signature = private_key.sign(f.tobytes())
+            fsig = _FragList()
+            fsig.put_sshstr(ca_type)
+            fsig.put_sshstr(signature)
+            f.put_sshstr(fsig.tobytes())
+        elif isinstance(private_key, ec.EllipticCurvePrivateKey):
+            hash_alg = _get_ec_hash_alg(private_key.curve)
+            signature = private_key.sign(f.tobytes(), ec.ECDSA(hash_alg))
+            r, s = asym_utils.decode_dss_signature(signature)
+            fsig = _FragList()
+            fsig.put_sshstr(ca_type)
+            fsigblob = _FragList()
+            fsigblob.put_mpint(r)
+            fsigblob.put_mpint(s)
+            fsig.put_sshstr(fsigblob.tobytes())
+            f.put_sshstr(fsig.tobytes())
+
+        else:
+            assert isinstance(private_key, rsa.RSAPrivateKey)
+            # Just like Golang, we're going to use SHA512 for RSA
+            # https://cs.opensource.google/go/x/crypto/+/refs/tags/
+            # v0.4.0:ssh/certs.go;l=445
+            # RFC 8332 defines SHA256 and 512 as options
+            fsig = _FragList()
+            fsig.put_sshstr(_SSH_RSA_SHA512)
+            signature = private_key.sign(
+                f.tobytes(), padding.PKCS1v15(), hashes.SHA512()
+            )
+            fsig.put_sshstr(signature)
+            f.put_sshstr(fsig.tobytes())
+
+        cert_data = binascii.b2a_base64(f.tobytes()).strip()
+        # load_ssh_public_identity returns a union, but this is
+        # guaranteed to be an SSHCertificate, so we cast to make
+        # mypy happy.
+        return typing.cast(
+            SSHCertificate,
+            load_ssh_public_identity(b"".join([cert_prefix, b" ", cert_data])),
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1af423004863e7db3e163f61a6baa4ddc157351
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__init__.py
@@ -0,0 +1,9 @@
+# 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 annotations
+
+
+class InvalidToken(Exception):
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..84952bc198ee58d60856b233a0aab102af41c984
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bedfbacb4820d194d96ed90aa3fe026a69299550
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/hotp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f986f59dc7dc604e6d40528e37ae8741ebb8f898
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/__pycache__/totp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/hotp.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/hotp.py
new file mode 100644
index 0000000000000000000000000000000000000000..2067108a63d6ff2dd56687e1f477cbe28a2eee4e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/hotp.py
@@ -0,0 +1,92 @@
+# 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 annotations
+
+import base64
+import typing
+from urllib.parse import quote, urlencode
+
+from cryptography.hazmat.primitives import constant_time, hmac
+from cryptography.hazmat.primitives.hashes import SHA1, SHA256, SHA512
+from cryptography.hazmat.primitives.twofactor import InvalidToken
+
+HOTPHashTypes = typing.Union[SHA1, SHA256, SHA512]
+
+
+def _generate_uri(
+    hotp: HOTP,
+    type_name: str,
+    account_name: str,
+    issuer: typing.Optional[str],
+    extra_parameters: typing.List[typing.Tuple[str, int]],
+) -> str:
+    parameters = [
+        ("digits", hotp._length),
+        ("secret", base64.b32encode(hotp._key)),
+        ("algorithm", hotp._algorithm.name.upper()),
+    ]
+
+    if issuer is not None:
+        parameters.append(("issuer", issuer))
+
+    parameters.extend(extra_parameters)
+
+    label = (
+        f"{quote(issuer)}:{quote(account_name)}"
+        if issuer
+        else quote(account_name)
+    )
+    return f"otpauth://{type_name}/{label}?{urlencode(parameters)}"
+
+
+class HOTP:
+    def __init__(
+        self,
+        key: bytes,
+        length: int,
+        algorithm: HOTPHashTypes,
+        backend: typing.Any = None,
+        enforce_key_length: bool = True,
+    ) -> None:
+        if len(key) < 16 and enforce_key_length is True:
+            raise ValueError("Key length has to be at least 128 bits.")
+
+        if not isinstance(length, int):
+            raise TypeError("Length parameter must be an integer type.")
+
+        if length < 6 or length > 8:
+            raise ValueError("Length of HOTP has to be between 6 and 8.")
+
+        if not isinstance(algorithm, (SHA1, SHA256, SHA512)):
+            raise TypeError("Algorithm must be SHA1, SHA256 or SHA512.")
+
+        self._key = key
+        self._length = length
+        self._algorithm = algorithm
+
+    def generate(self, counter: int) -> bytes:
+        truncated_value = self._dynamic_truncate(counter)
+        hotp = truncated_value % (10**self._length)
+        return "{0:0{1}}".format(hotp, self._length).encode()
+
+    def verify(self, hotp: bytes, counter: int) -> None:
+        if not constant_time.bytes_eq(self.generate(counter), hotp):
+            raise InvalidToken("Supplied HOTP value does not match.")
+
+    def _dynamic_truncate(self, counter: int) -> int:
+        ctx = hmac.HMAC(self._key, self._algorithm)
+        ctx.update(counter.to_bytes(length=8, byteorder="big"))
+        hmac_value = ctx.finalize()
+
+        offset = hmac_value[len(hmac_value) - 1] & 0b1111
+        p = hmac_value[offset : offset + 4]
+        return int.from_bytes(p, byteorder="big") & 0x7FFFFFFF
+
+    def get_provisioning_uri(
+        self, account_name: str, counter: int, issuer: typing.Optional[str]
+    ) -> str:
+        return _generate_uri(
+            self, "hotp", account_name, issuer, [("counter", int(counter))]
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/totp.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/totp.py
new file mode 100644
index 0000000000000000000000000000000000000000..daddcea2f77e4b753f5618625336de31c2035980
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/hazmat/primitives/twofactor/totp.py
@@ -0,0 +1,50 @@
+# 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 annotations
+
+import typing
+
+from cryptography.hazmat.primitives import constant_time
+from cryptography.hazmat.primitives.twofactor import InvalidToken
+from cryptography.hazmat.primitives.twofactor.hotp import (
+    HOTP,
+    HOTPHashTypes,
+    _generate_uri,
+)
+
+
+class TOTP:
+    def __init__(
+        self,
+        key: bytes,
+        length: int,
+        algorithm: HOTPHashTypes,
+        time_step: int,
+        backend: typing.Any = None,
+        enforce_key_length: bool = True,
+    ):
+        self._time_step = time_step
+        self._hotp = HOTP(
+            key, length, algorithm, enforce_key_length=enforce_key_length
+        )
+
+    def generate(self, time: typing.Union[int, float]) -> bytes:
+        counter = int(time / self._time_step)
+        return self._hotp.generate(counter)
+
+    def verify(self, totp: bytes, time: int) -> None:
+        if not constant_time.bytes_eq(self.generate(time), totp):
+            raise InvalidToken("Supplied TOTP value does not match.")
+
+    def get_provisioning_uri(
+        self, account_name: str, issuer: typing.Optional[str]
+    ) -> str:
+        return _generate_uri(
+            self._hotp,
+            "totp",
+            account_name,
+            issuer,
+            [("period", int(self._time_step))],
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/py.typed b/TP03/TP03/lib/python3.9/site-packages/cryptography/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/utils.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..71916816844020a3fe6f0d8d395031946098cabd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/utils.py
@@ -0,0 +1,130 @@
+# 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 annotations
+
+import enum
+import sys
+import types
+import typing
+import warnings
+
+
+# We use a UserWarning subclass, instead of DeprecationWarning, because CPython
+# decided deprecation warnings should be invisble by default.
+class CryptographyDeprecationWarning(UserWarning):
+    pass
+
+
+# Several APIs were deprecated with no specific end-of-life date because of the
+# ubiquity of their use. They should not be removed until we agree on when that
+# cycle ends.
+DeprecatedIn36 = CryptographyDeprecationWarning
+DeprecatedIn37 = CryptographyDeprecationWarning
+DeprecatedIn40 = CryptographyDeprecationWarning
+DeprecatedIn41 = CryptographyDeprecationWarning
+
+
+def _check_bytes(name: str, value: bytes) -> None:
+    if not isinstance(value, bytes):
+        raise TypeError(f"{name} must be bytes")
+
+
+def _check_byteslike(name: str, value: bytes) -> None:
+    try:
+        memoryview(value)
+    except TypeError:
+        raise TypeError(f"{name} must be bytes-like")
+
+
+def int_to_bytes(integer: int, length: typing.Optional[int] = None) -> bytes:
+    return integer.to_bytes(
+        length or (integer.bit_length() + 7) // 8 or 1, "big"
+    )
+
+
+def _extract_buffer_length(obj: typing.Any) -> typing.Tuple[typing.Any, int]:
+    from cryptography.hazmat.bindings._rust import _openssl
+
+    buf = _openssl.ffi.from_buffer(obj)
+    return buf, int(_openssl.ffi.cast("uintptr_t", buf))
+
+
+class InterfaceNotImplemented(Exception):
+    pass
+
+
+class _DeprecatedValue:
+    def __init__(self, value: object, message: str, warning_class):
+        self.value = value
+        self.message = message
+        self.warning_class = warning_class
+
+
+class _ModuleWithDeprecations(types.ModuleType):
+    def __init__(self, module: types.ModuleType):
+        super().__init__(module.__name__)
+        self.__dict__["_module"] = module
+
+    def __getattr__(self, attr: str) -> object:
+        obj = getattr(self._module, attr)
+        if isinstance(obj, _DeprecatedValue):
+            warnings.warn(obj.message, obj.warning_class, stacklevel=2)
+            obj = obj.value
+        return obj
+
+    def __setattr__(self, attr: str, value: object) -> None:
+        setattr(self._module, attr, value)
+
+    def __delattr__(self, attr: str) -> None:
+        obj = getattr(self._module, attr)
+        if isinstance(obj, _DeprecatedValue):
+            warnings.warn(obj.message, obj.warning_class, stacklevel=2)
+
+        delattr(self._module, attr)
+
+    def __dir__(self) -> typing.Sequence[str]:
+        return ["_module"] + dir(self._module)
+
+
+def deprecated(
+    value: object,
+    module_name: str,
+    message: str,
+    warning_class: typing.Type[Warning],
+    name: typing.Optional[str] = None,
+) -> _DeprecatedValue:
+    module = sys.modules[module_name]
+    if not isinstance(module, _ModuleWithDeprecations):
+        sys.modules[module_name] = module = _ModuleWithDeprecations(module)
+    dv = _DeprecatedValue(value, message, warning_class)
+    # Maintain backwards compatibility with `name is None` for pyOpenSSL.
+    if name is not None:
+        setattr(module, name, dv)
+    return dv
+
+
+def cached_property(func: typing.Callable) -> property:
+    cached_name = f"_cached_{func}"
+    sentinel = object()
+
+    def inner(instance: object):
+        cache = getattr(instance, cached_name, sentinel)
+        if cache is not sentinel:
+            return cache
+        result = func(instance)
+        setattr(instance, cached_name, result)
+        return result
+
+    return property(inner)
+
+
+# Python 3.10 changed representation of enums. We use well-defined object
+# representation and string representation from Python 3.9.
+class Enum(enum.Enum):
+    def __repr__(self) -> str:
+        return f"<{self.__class__.__name__}.{self._name_}: {self._value_!r}>"
+
+    def __str__(self) -> str:
+        return f"{self.__class__.__name__}.{self._name_}"
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__init__.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d77694a29906412c9fc5628a3ff1980db66578ba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__init__.py
@@ -0,0 +1,255 @@
+# 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 annotations
+
+from cryptography.x509 import certificate_transparency
+from cryptography.x509.base import (
+    Attribute,
+    AttributeNotFound,
+    Attributes,
+    Certificate,
+    CertificateBuilder,
+    CertificateRevocationList,
+    CertificateRevocationListBuilder,
+    CertificateSigningRequest,
+    CertificateSigningRequestBuilder,
+    InvalidVersion,
+    RevokedCertificate,
+    RevokedCertificateBuilder,
+    Version,
+    load_der_x509_certificate,
+    load_der_x509_crl,
+    load_der_x509_csr,
+    load_pem_x509_certificate,
+    load_pem_x509_certificates,
+    load_pem_x509_crl,
+    load_pem_x509_csr,
+    random_serial_number,
+)
+from cryptography.x509.extensions import (
+    AccessDescription,
+    AuthorityInformationAccess,
+    AuthorityKeyIdentifier,
+    BasicConstraints,
+    CertificateIssuer,
+    CertificatePolicies,
+    CRLDistributionPoints,
+    CRLNumber,
+    CRLReason,
+    DeltaCRLIndicator,
+    DistributionPoint,
+    DuplicateExtension,
+    ExtendedKeyUsage,
+    Extension,
+    ExtensionNotFound,
+    Extensions,
+    ExtensionType,
+    FreshestCRL,
+    GeneralNames,
+    InhibitAnyPolicy,
+    InvalidityDate,
+    IssuerAlternativeName,
+    IssuingDistributionPoint,
+    KeyUsage,
+    MSCertificateTemplate,
+    NameConstraints,
+    NoticeReference,
+    OCSPAcceptableResponses,
+    OCSPNoCheck,
+    OCSPNonce,
+    PolicyConstraints,
+    PolicyInformation,
+    PrecertificateSignedCertificateTimestamps,
+    PrecertPoison,
+    ReasonFlags,
+    SignedCertificateTimestamps,
+    SubjectAlternativeName,
+    SubjectInformationAccess,
+    SubjectKeyIdentifier,
+    TLSFeature,
+    TLSFeatureType,
+    UnrecognizedExtension,
+    UserNotice,
+)
+from cryptography.x509.general_name import (
+    DirectoryName,
+    DNSName,
+    GeneralName,
+    IPAddress,
+    OtherName,
+    RegisteredID,
+    RFC822Name,
+    UniformResourceIdentifier,
+    UnsupportedGeneralNameType,
+)
+from cryptography.x509.name import (
+    Name,
+    NameAttribute,
+    RelativeDistinguishedName,
+)
+from cryptography.x509.oid import (
+    AuthorityInformationAccessOID,
+    CertificatePoliciesOID,
+    CRLEntryExtensionOID,
+    ExtendedKeyUsageOID,
+    ExtensionOID,
+    NameOID,
+    ObjectIdentifier,
+    SignatureAlgorithmOID,
+)
+
+OID_AUTHORITY_INFORMATION_ACCESS = ExtensionOID.AUTHORITY_INFORMATION_ACCESS
+OID_AUTHORITY_KEY_IDENTIFIER = ExtensionOID.AUTHORITY_KEY_IDENTIFIER
+OID_BASIC_CONSTRAINTS = ExtensionOID.BASIC_CONSTRAINTS
+OID_CERTIFICATE_POLICIES = ExtensionOID.CERTIFICATE_POLICIES
+OID_CRL_DISTRIBUTION_POINTS = ExtensionOID.CRL_DISTRIBUTION_POINTS
+OID_EXTENDED_KEY_USAGE = ExtensionOID.EXTENDED_KEY_USAGE
+OID_FRESHEST_CRL = ExtensionOID.FRESHEST_CRL
+OID_INHIBIT_ANY_POLICY = ExtensionOID.INHIBIT_ANY_POLICY
+OID_ISSUER_ALTERNATIVE_NAME = ExtensionOID.ISSUER_ALTERNATIVE_NAME
+OID_KEY_USAGE = ExtensionOID.KEY_USAGE
+OID_NAME_CONSTRAINTS = ExtensionOID.NAME_CONSTRAINTS
+OID_OCSP_NO_CHECK = ExtensionOID.OCSP_NO_CHECK
+OID_POLICY_CONSTRAINTS = ExtensionOID.POLICY_CONSTRAINTS
+OID_POLICY_MAPPINGS = ExtensionOID.POLICY_MAPPINGS
+OID_SUBJECT_ALTERNATIVE_NAME = ExtensionOID.SUBJECT_ALTERNATIVE_NAME
+OID_SUBJECT_DIRECTORY_ATTRIBUTES = ExtensionOID.SUBJECT_DIRECTORY_ATTRIBUTES
+OID_SUBJECT_INFORMATION_ACCESS = ExtensionOID.SUBJECT_INFORMATION_ACCESS
+OID_SUBJECT_KEY_IDENTIFIER = ExtensionOID.SUBJECT_KEY_IDENTIFIER
+
+OID_DSA_WITH_SHA1 = SignatureAlgorithmOID.DSA_WITH_SHA1
+OID_DSA_WITH_SHA224 = SignatureAlgorithmOID.DSA_WITH_SHA224
+OID_DSA_WITH_SHA256 = SignatureAlgorithmOID.DSA_WITH_SHA256
+OID_ECDSA_WITH_SHA1 = SignatureAlgorithmOID.ECDSA_WITH_SHA1
+OID_ECDSA_WITH_SHA224 = SignatureAlgorithmOID.ECDSA_WITH_SHA224
+OID_ECDSA_WITH_SHA256 = SignatureAlgorithmOID.ECDSA_WITH_SHA256
+OID_ECDSA_WITH_SHA384 = SignatureAlgorithmOID.ECDSA_WITH_SHA384
+OID_ECDSA_WITH_SHA512 = SignatureAlgorithmOID.ECDSA_WITH_SHA512
+OID_RSA_WITH_MD5 = SignatureAlgorithmOID.RSA_WITH_MD5
+OID_RSA_WITH_SHA1 = SignatureAlgorithmOID.RSA_WITH_SHA1
+OID_RSA_WITH_SHA224 = SignatureAlgorithmOID.RSA_WITH_SHA224
+OID_RSA_WITH_SHA256 = SignatureAlgorithmOID.RSA_WITH_SHA256
+OID_RSA_WITH_SHA384 = SignatureAlgorithmOID.RSA_WITH_SHA384
+OID_RSA_WITH_SHA512 = SignatureAlgorithmOID.RSA_WITH_SHA512
+OID_RSASSA_PSS = SignatureAlgorithmOID.RSASSA_PSS
+
+OID_COMMON_NAME = NameOID.COMMON_NAME
+OID_COUNTRY_NAME = NameOID.COUNTRY_NAME
+OID_DOMAIN_COMPONENT = NameOID.DOMAIN_COMPONENT
+OID_DN_QUALIFIER = NameOID.DN_QUALIFIER
+OID_EMAIL_ADDRESS = NameOID.EMAIL_ADDRESS
+OID_GENERATION_QUALIFIER = NameOID.GENERATION_QUALIFIER
+OID_GIVEN_NAME = NameOID.GIVEN_NAME
+OID_LOCALITY_NAME = NameOID.LOCALITY_NAME
+OID_ORGANIZATIONAL_UNIT_NAME = NameOID.ORGANIZATIONAL_UNIT_NAME
+OID_ORGANIZATION_NAME = NameOID.ORGANIZATION_NAME
+OID_PSEUDONYM = NameOID.PSEUDONYM
+OID_SERIAL_NUMBER = NameOID.SERIAL_NUMBER
+OID_STATE_OR_PROVINCE_NAME = NameOID.STATE_OR_PROVINCE_NAME
+OID_SURNAME = NameOID.SURNAME
+OID_TITLE = NameOID.TITLE
+
+OID_CLIENT_AUTH = ExtendedKeyUsageOID.CLIENT_AUTH
+OID_CODE_SIGNING = ExtendedKeyUsageOID.CODE_SIGNING
+OID_EMAIL_PROTECTION = ExtendedKeyUsageOID.EMAIL_PROTECTION
+OID_OCSP_SIGNING = ExtendedKeyUsageOID.OCSP_SIGNING
+OID_SERVER_AUTH = ExtendedKeyUsageOID.SERVER_AUTH
+OID_TIME_STAMPING = ExtendedKeyUsageOID.TIME_STAMPING
+
+OID_ANY_POLICY = CertificatePoliciesOID.ANY_POLICY
+OID_CPS_QUALIFIER = CertificatePoliciesOID.CPS_QUALIFIER
+OID_CPS_USER_NOTICE = CertificatePoliciesOID.CPS_USER_NOTICE
+
+OID_CERTIFICATE_ISSUER = CRLEntryExtensionOID.CERTIFICATE_ISSUER
+OID_CRL_REASON = CRLEntryExtensionOID.CRL_REASON
+OID_INVALIDITY_DATE = CRLEntryExtensionOID.INVALIDITY_DATE
+
+OID_CA_ISSUERS = AuthorityInformationAccessOID.CA_ISSUERS
+OID_OCSP = AuthorityInformationAccessOID.OCSP
+
+__all__ = [
+    "certificate_transparency",
+    "load_pem_x509_certificate",
+    "load_pem_x509_certificates",
+    "load_der_x509_certificate",
+    "load_pem_x509_csr",
+    "load_der_x509_csr",
+    "load_pem_x509_crl",
+    "load_der_x509_crl",
+    "random_serial_number",
+    "Attribute",
+    "AttributeNotFound",
+    "Attributes",
+    "InvalidVersion",
+    "DeltaCRLIndicator",
+    "DuplicateExtension",
+    "ExtensionNotFound",
+    "UnsupportedGeneralNameType",
+    "NameAttribute",
+    "Name",
+    "RelativeDistinguishedName",
+    "ObjectIdentifier",
+    "ExtensionType",
+    "Extensions",
+    "Extension",
+    "ExtendedKeyUsage",
+    "FreshestCRL",
+    "IssuingDistributionPoint",
+    "TLSFeature",
+    "TLSFeatureType",
+    "OCSPAcceptableResponses",
+    "OCSPNoCheck",
+    "BasicConstraints",
+    "CRLNumber",
+    "KeyUsage",
+    "AuthorityInformationAccess",
+    "SubjectInformationAccess",
+    "AccessDescription",
+    "CertificatePolicies",
+    "PolicyInformation",
+    "UserNotice",
+    "NoticeReference",
+    "SubjectKeyIdentifier",
+    "NameConstraints",
+    "CRLDistributionPoints",
+    "DistributionPoint",
+    "ReasonFlags",
+    "InhibitAnyPolicy",
+    "SubjectAlternativeName",
+    "IssuerAlternativeName",
+    "AuthorityKeyIdentifier",
+    "GeneralNames",
+    "GeneralName",
+    "RFC822Name",
+    "DNSName",
+    "UniformResourceIdentifier",
+    "RegisteredID",
+    "DirectoryName",
+    "IPAddress",
+    "OtherName",
+    "Certificate",
+    "CertificateRevocationList",
+    "CertificateRevocationListBuilder",
+    "CertificateSigningRequest",
+    "RevokedCertificate",
+    "RevokedCertificateBuilder",
+    "CertificateSigningRequestBuilder",
+    "CertificateBuilder",
+    "Version",
+    "OID_CA_ISSUERS",
+    "OID_OCSP",
+    "CertificateIssuer",
+    "CRLReason",
+    "InvalidityDate",
+    "UnrecognizedExtension",
+    "PolicyConstraints",
+    "PrecertificateSignedCertificateTimestamps",
+    "PrecertPoison",
+    "OCSPNonce",
+    "SignedCertificateTimestamps",
+    "SignatureAlgorithmOID",
+    "NameOID",
+    "MSCertificateTemplate",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b3e7b4a86f3fdb409cb2a1c77b986a9c1d9a9cfe
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fb639e2a2b912ff725bac1be6b5c56bb7450f4e2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/certificate_transparency.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/certificate_transparency.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d2eccdb246978cc930fc10f6cd4a9e5815c29523
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/certificate_transparency.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/extensions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/extensions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9bcf44a1723346ee241712086cc48667e2126010
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/extensions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/general_name.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/general_name.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1cd9322edc23e8424f86dbd6e460a717025a219f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/general_name.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/name.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/name.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b0c2b2f28af9cb2b4c6064b4b274de7ca4741563
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/name.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/ocsp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/ocsp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7f6004a7000b361c51536781dc5884198cf64201
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/ocsp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/oid.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/oid.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d2e6497cf11c32cc53054bcf4c2d567f3322492a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/__pycache__/oid.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/base.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..576385e088d83a7016b4bc1f11170f66d58a6e1e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/base.py
@@ -0,0 +1,1173 @@
+# 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 annotations
+
+import abc
+import datetime
+import os
+import typing
+
+from cryptography import utils
+from cryptography.hazmat.bindings._rust import x509 as rust_x509
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import (
+    dsa,
+    ec,
+    ed448,
+    ed25519,
+    padding,
+    rsa,
+    x448,
+    x25519,
+)
+from cryptography.hazmat.primitives.asymmetric.types import (
+    CertificateIssuerPrivateKeyTypes,
+    CertificateIssuerPublicKeyTypes,
+    CertificatePublicKeyTypes,
+)
+from cryptography.x509.extensions import (
+    Extension,
+    Extensions,
+    ExtensionType,
+    _make_sequence_methods,
+)
+from cryptography.x509.name import Name, _ASN1Type
+from cryptography.x509.oid import ObjectIdentifier
+
+_EARLIEST_UTC_TIME = datetime.datetime(1950, 1, 1)
+
+# This must be kept in sync with sign.rs's list of allowable types in
+# identify_hash_type
+_AllowedHashTypes = typing.Union[
+    hashes.SHA224,
+    hashes.SHA256,
+    hashes.SHA384,
+    hashes.SHA512,
+    hashes.SHA3_224,
+    hashes.SHA3_256,
+    hashes.SHA3_384,
+    hashes.SHA3_512,
+]
+
+
+class AttributeNotFound(Exception):
+    def __init__(self, msg: str, oid: ObjectIdentifier) -> None:
+        super().__init__(msg)
+        self.oid = oid
+
+
+def _reject_duplicate_extension(
+    extension: Extension[ExtensionType],
+    extensions: typing.List[Extension[ExtensionType]],
+) -> None:
+    # This is quadratic in the number of extensions
+    for e in extensions:
+        if e.oid == extension.oid:
+            raise ValueError("This extension has already been set.")
+
+
+def _reject_duplicate_attribute(
+    oid: ObjectIdentifier,
+    attributes: typing.List[
+        typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]]
+    ],
+) -> None:
+    # This is quadratic in the number of attributes
+    for attr_oid, _, _ in attributes:
+        if attr_oid == oid:
+            raise ValueError("This attribute has already been set.")
+
+
+def _convert_to_naive_utc_time(time: datetime.datetime) -> datetime.datetime:
+    """Normalizes a datetime to a naive datetime in UTC.
+
+    time -- datetime to normalize. Assumed to be in UTC if not timezone
+            aware.
+    """
+    if time.tzinfo is not None:
+        offset = time.utcoffset()
+        offset = offset if offset else datetime.timedelta()
+        return time.replace(tzinfo=None) - offset
+    else:
+        return time
+
+
+class Attribute:
+    def __init__(
+        self,
+        oid: ObjectIdentifier,
+        value: bytes,
+        _type: int = _ASN1Type.UTF8String.value,
+    ) -> None:
+        self._oid = oid
+        self._value = value
+        self._type = _type
+
+    @property
+    def oid(self) -> ObjectIdentifier:
+        return self._oid
+
+    @property
+    def value(self) -> bytes:
+        return self._value
+
+    def __repr__(self) -> str:
+        return f"<Attribute(oid={self.oid}, value={self.value!r})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, Attribute):
+            return NotImplemented
+
+        return (
+            self.oid == other.oid
+            and self.value == other.value
+            and self._type == other._type
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.oid, self.value, self._type))
+
+
+class Attributes:
+    def __init__(
+        self,
+        attributes: typing.Iterable[Attribute],
+    ) -> None:
+        self._attributes = list(attributes)
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_attributes")
+
+    def __repr__(self) -> str:
+        return f"<Attributes({self._attributes})>"
+
+    def get_attribute_for_oid(self, oid: ObjectIdentifier) -> Attribute:
+        for attr in self:
+            if attr.oid == oid:
+                return attr
+
+        raise AttributeNotFound(f"No {oid} attribute was found", oid)
+
+
+class Version(utils.Enum):
+    v1 = 0
+    v3 = 2
+
+
+class InvalidVersion(Exception):
+    def __init__(self, msg: str, parsed_version: int) -> None:
+        super().__init__(msg)
+        self.parsed_version = parsed_version
+
+
+class Certificate(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes:
+        """
+        Returns bytes using digest passed.
+        """
+
+    @property
+    @abc.abstractmethod
+    def serial_number(self) -> int:
+        """
+        Returns certificate serial number
+        """
+
+    @property
+    @abc.abstractmethod
+    def version(self) -> Version:
+        """
+        Returns the certificate version
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> CertificatePublicKeyTypes:
+        """
+        Returns the public key
+        """
+
+    @property
+    @abc.abstractmethod
+    def not_valid_before(self) -> datetime.datetime:
+        """
+        Not before time (represented as UTC datetime)
+        """
+
+    @property
+    @abc.abstractmethod
+    def not_valid_after(self) -> datetime.datetime:
+        """
+        Not after time (represented as UTC datetime)
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer(self) -> Name:
+        """
+        Returns the issuer name object.
+        """
+
+    @property
+    @abc.abstractmethod
+    def subject(self) -> Name:
+        """
+        Returns the subject name object.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_hash_algorithm(
+        self,
+    ) -> typing.Optional[hashes.HashAlgorithm]:
+        """
+        Returns a HashAlgorithm corresponding to the type of the digest signed
+        in the certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm_oid(self) -> ObjectIdentifier:
+        """
+        Returns the ObjectIdentifier of the signature algorithm.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm_parameters(
+        self,
+    ) -> typing.Union[None, padding.PSS, padding.PKCS1v15, ec.ECDSA]:
+        """
+        Returns the signature algorithm parameters.
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> Extensions:
+        """
+        Returns an Extensions object.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature(self) -> bytes:
+        """
+        Returns the signature bytes.
+        """
+
+    @property
+    @abc.abstractmethod
+    def tbs_certificate_bytes(self) -> bytes:
+        """
+        Returns the tbsCertificate payload bytes as defined in RFC 5280.
+        """
+
+    @property
+    @abc.abstractmethod
+    def tbs_precertificate_bytes(self) -> bytes:
+        """
+        Returns the tbsCertificate payload bytes with the SCT list extension
+        stripped.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+    @abc.abstractmethod
+    def __hash__(self) -> int:
+        """
+        Computes a hash.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(self, encoding: serialization.Encoding) -> bytes:
+        """
+        Serializes the certificate to PEM or DER format.
+        """
+
+    @abc.abstractmethod
+    def verify_directly_issued_by(self, issuer: Certificate) -> None:
+        """
+        This method verifies that certificate issuer name matches the
+        issuer subject name and that the certificate is signed by the
+        issuer's private key. No other validation is performed.
+        """
+
+
+# Runtime isinstance checks need this since the rust class is not a subclass.
+Certificate.register(rust_x509.Certificate)
+
+
+class RevokedCertificate(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def serial_number(self) -> int:
+        """
+        Returns the serial number of the revoked certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def revocation_date(self) -> datetime.datetime:
+        """
+        Returns the date of when this certificate was revoked.
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> Extensions:
+        """
+        Returns an Extensions object containing a list of Revoked extensions.
+        """
+
+
+# Runtime isinstance checks need this since the rust class is not a subclass.
+RevokedCertificate.register(rust_x509.RevokedCertificate)
+
+
+class _RawRevokedCertificate(RevokedCertificate):
+    def __init__(
+        self,
+        serial_number: int,
+        revocation_date: datetime.datetime,
+        extensions: Extensions,
+    ):
+        self._serial_number = serial_number
+        self._revocation_date = revocation_date
+        self._extensions = extensions
+
+    @property
+    def serial_number(self) -> int:
+        return self._serial_number
+
+    @property
+    def revocation_date(self) -> datetime.datetime:
+        return self._revocation_date
+
+    @property
+    def extensions(self) -> Extensions:
+        return self._extensions
+
+
+class CertificateRevocationList(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def public_bytes(self, encoding: serialization.Encoding) -> bytes:
+        """
+        Serializes the CRL to PEM or DER format.
+        """
+
+    @abc.abstractmethod
+    def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes:
+        """
+        Returns bytes using digest passed.
+        """
+
+    @abc.abstractmethod
+    def get_revoked_certificate_by_serial_number(
+        self, serial_number: int
+    ) -> typing.Optional[RevokedCertificate]:
+        """
+        Returns an instance of RevokedCertificate or None if the serial_number
+        is not in the CRL.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_hash_algorithm(
+        self,
+    ) -> typing.Optional[hashes.HashAlgorithm]:
+        """
+        Returns a HashAlgorithm corresponding to the type of the digest signed
+        in the certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm_oid(self) -> ObjectIdentifier:
+        """
+        Returns the ObjectIdentifier of the signature algorithm.
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer(self) -> Name:
+        """
+        Returns the X509Name with the issuer of this CRL.
+        """
+
+    @property
+    @abc.abstractmethod
+    def next_update(self) -> typing.Optional[datetime.datetime]:
+        """
+        Returns the date of next update for this CRL.
+        """
+
+    @property
+    @abc.abstractmethod
+    def last_update(self) -> datetime.datetime:
+        """
+        Returns the date of last update for this CRL.
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> Extensions:
+        """
+        Returns an Extensions object containing a list of CRL extensions.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature(self) -> bytes:
+        """
+        Returns the signature bytes.
+        """
+
+    @property
+    @abc.abstractmethod
+    def tbs_certlist_bytes(self) -> bytes:
+        """
+        Returns the tbsCertList payload bytes as defined in RFC 5280.
+        """
+
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+    @abc.abstractmethod
+    def __len__(self) -> int:
+        """
+        Number of revoked certificates in the CRL.
+        """
+
+    @typing.overload
+    def __getitem__(self, idx: int) -> RevokedCertificate:
+        ...
+
+    @typing.overload
+    def __getitem__(self, idx: slice) -> typing.List[RevokedCertificate]:
+        ...
+
+    @abc.abstractmethod
+    def __getitem__(
+        self, idx: typing.Union[int, slice]
+    ) -> typing.Union[RevokedCertificate, typing.List[RevokedCertificate]]:
+        """
+        Returns a revoked certificate (or slice of revoked certificates).
+        """
+
+    @abc.abstractmethod
+    def __iter__(self) -> typing.Iterator[RevokedCertificate]:
+        """
+        Iterator over the revoked certificates
+        """
+
+    @abc.abstractmethod
+    def is_signature_valid(
+        self, public_key: CertificateIssuerPublicKeyTypes
+    ) -> bool:
+        """
+        Verifies signature of revocation list against given public key.
+        """
+
+
+CertificateRevocationList.register(rust_x509.CertificateRevocationList)
+
+
+class CertificateSigningRequest(metaclass=abc.ABCMeta):
+    @abc.abstractmethod
+    def __eq__(self, other: object) -> bool:
+        """
+        Checks equality.
+        """
+
+    @abc.abstractmethod
+    def __hash__(self) -> int:
+        """
+        Computes a hash.
+        """
+
+    @abc.abstractmethod
+    def public_key(self) -> CertificatePublicKeyTypes:
+        """
+        Returns the public key
+        """
+
+    @property
+    @abc.abstractmethod
+    def subject(self) -> Name:
+        """
+        Returns the subject name object.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_hash_algorithm(
+        self,
+    ) -> typing.Optional[hashes.HashAlgorithm]:
+        """
+        Returns a HashAlgorithm corresponding to the type of the digest signed
+        in the certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm_oid(self) -> ObjectIdentifier:
+        """
+        Returns the ObjectIdentifier of the signature algorithm.
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> Extensions:
+        """
+        Returns the extensions in the signing request.
+        """
+
+    @property
+    @abc.abstractmethod
+    def attributes(self) -> Attributes:
+        """
+        Returns an Attributes object.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(self, encoding: serialization.Encoding) -> bytes:
+        """
+        Encodes the request to PEM or DER format.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature(self) -> bytes:
+        """
+        Returns the signature bytes.
+        """
+
+    @property
+    @abc.abstractmethod
+    def tbs_certrequest_bytes(self) -> bytes:
+        """
+        Returns the PKCS#10 CertificationRequestInfo bytes as defined in RFC
+        2986.
+        """
+
+    @property
+    @abc.abstractmethod
+    def is_signature_valid(self) -> bool:
+        """
+        Verifies signature of signing request.
+        """
+
+    @abc.abstractmethod
+    def get_attribute_for_oid(self, oid: ObjectIdentifier) -> bytes:
+        """
+        Get the attribute value for a given OID.
+        """
+
+
+# Runtime isinstance checks need this since the rust class is not a subclass.
+CertificateSigningRequest.register(rust_x509.CertificateSigningRequest)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_pem_x509_certificate(
+    data: bytes, backend: typing.Any = None
+) -> Certificate:
+    return rust_x509.load_pem_x509_certificate(data)
+
+
+def load_pem_x509_certificates(data: bytes) -> typing.List[Certificate]:
+    return rust_x509.load_pem_x509_certificates(data)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_der_x509_certificate(
+    data: bytes, backend: typing.Any = None
+) -> Certificate:
+    return rust_x509.load_der_x509_certificate(data)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_pem_x509_csr(
+    data: bytes, backend: typing.Any = None
+) -> CertificateSigningRequest:
+    return rust_x509.load_pem_x509_csr(data)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_der_x509_csr(
+    data: bytes, backend: typing.Any = None
+) -> CertificateSigningRequest:
+    return rust_x509.load_der_x509_csr(data)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_pem_x509_crl(
+    data: bytes, backend: typing.Any = None
+) -> CertificateRevocationList:
+    return rust_x509.load_pem_x509_crl(data)
+
+
+# Backend argument preserved for API compatibility, but ignored.
+def load_der_x509_crl(
+    data: bytes, backend: typing.Any = None
+) -> CertificateRevocationList:
+    return rust_x509.load_der_x509_crl(data)
+
+
+class CertificateSigningRequestBuilder:
+    def __init__(
+        self,
+        subject_name: typing.Optional[Name] = None,
+        extensions: typing.List[Extension[ExtensionType]] = [],
+        attributes: typing.List[
+            typing.Tuple[ObjectIdentifier, bytes, typing.Optional[int]]
+        ] = [],
+    ):
+        """
+        Creates an empty X.509 certificate request (v1).
+        """
+        self._subject_name = subject_name
+        self._extensions = extensions
+        self._attributes = attributes
+
+    def subject_name(self, name: Name) -> CertificateSigningRequestBuilder:
+        """
+        Sets the certificate requestor's distinguished name.
+        """
+        if not isinstance(name, Name):
+            raise TypeError("Expecting x509.Name object.")
+        if self._subject_name is not None:
+            raise ValueError("The subject name may only be set once.")
+        return CertificateSigningRequestBuilder(
+            name, self._extensions, self._attributes
+        )
+
+    def add_extension(
+        self, extval: ExtensionType, critical: bool
+    ) -> CertificateSigningRequestBuilder:
+        """
+        Adds an X.509 extension to the certificate request.
+        """
+        if not isinstance(extval, ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+
+        return CertificateSigningRequestBuilder(
+            self._subject_name,
+            self._extensions + [extension],
+            self._attributes,
+        )
+
+    def add_attribute(
+        self,
+        oid: ObjectIdentifier,
+        value: bytes,
+        *,
+        _tag: typing.Optional[_ASN1Type] = None,
+    ) -> CertificateSigningRequestBuilder:
+        """
+        Adds an X.509 attribute with an OID and associated value.
+        """
+        if not isinstance(oid, ObjectIdentifier):
+            raise TypeError("oid must be an ObjectIdentifier")
+
+        if not isinstance(value, bytes):
+            raise TypeError("value must be bytes")
+
+        if _tag is not None and not isinstance(_tag, _ASN1Type):
+            raise TypeError("tag must be _ASN1Type")
+
+        _reject_duplicate_attribute(oid, self._attributes)
+
+        if _tag is not None:
+            tag = _tag.value
+        else:
+            tag = None
+
+        return CertificateSigningRequestBuilder(
+            self._subject_name,
+            self._extensions,
+            self._attributes + [(oid, value, tag)],
+        )
+
+    def sign(
+        self,
+        private_key: CertificateIssuerPrivateKeyTypes,
+        algorithm: typing.Optional[_AllowedHashTypes],
+        backend: typing.Any = None,
+    ) -> CertificateSigningRequest:
+        """
+        Signs the request using the requestor's private key.
+        """
+        if self._subject_name is None:
+            raise ValueError("A CertificateSigningRequest must have a subject")
+        return rust_x509.create_x509_csr(self, private_key, algorithm)
+
+
+class CertificateBuilder:
+    _extensions: typing.List[Extension[ExtensionType]]
+
+    def __init__(
+        self,
+        issuer_name: typing.Optional[Name] = None,
+        subject_name: typing.Optional[Name] = None,
+        public_key: typing.Optional[CertificatePublicKeyTypes] = None,
+        serial_number: typing.Optional[int] = None,
+        not_valid_before: typing.Optional[datetime.datetime] = None,
+        not_valid_after: typing.Optional[datetime.datetime] = None,
+        extensions: typing.List[Extension[ExtensionType]] = [],
+    ) -> None:
+        self._version = Version.v3
+        self._issuer_name = issuer_name
+        self._subject_name = subject_name
+        self._public_key = public_key
+        self._serial_number = serial_number
+        self._not_valid_before = not_valid_before
+        self._not_valid_after = not_valid_after
+        self._extensions = extensions
+
+    def issuer_name(self, name: Name) -> CertificateBuilder:
+        """
+        Sets the CA's distinguished name.
+        """
+        if not isinstance(name, Name):
+            raise TypeError("Expecting x509.Name object.")
+        if self._issuer_name is not None:
+            raise ValueError("The issuer name may only be set once.")
+        return CertificateBuilder(
+            name,
+            self._subject_name,
+            self._public_key,
+            self._serial_number,
+            self._not_valid_before,
+            self._not_valid_after,
+            self._extensions,
+        )
+
+    def subject_name(self, name: Name) -> CertificateBuilder:
+        """
+        Sets the requestor's distinguished name.
+        """
+        if not isinstance(name, Name):
+            raise TypeError("Expecting x509.Name object.")
+        if self._subject_name is not None:
+            raise ValueError("The subject name may only be set once.")
+        return CertificateBuilder(
+            self._issuer_name,
+            name,
+            self._public_key,
+            self._serial_number,
+            self._not_valid_before,
+            self._not_valid_after,
+            self._extensions,
+        )
+
+    def public_key(
+        self,
+        key: CertificatePublicKeyTypes,
+    ) -> CertificateBuilder:
+        """
+        Sets the requestor's public key (as found in the signing request).
+        """
+        if not isinstance(
+            key,
+            (
+                dsa.DSAPublicKey,
+                rsa.RSAPublicKey,
+                ec.EllipticCurvePublicKey,
+                ed25519.Ed25519PublicKey,
+                ed448.Ed448PublicKey,
+                x25519.X25519PublicKey,
+                x448.X448PublicKey,
+            ),
+        ):
+            raise TypeError(
+                "Expecting one of DSAPublicKey, RSAPublicKey,"
+                " EllipticCurvePublicKey, Ed25519PublicKey,"
+                " Ed448PublicKey, X25519PublicKey, or "
+                "X448PublicKey."
+            )
+        if self._public_key is not None:
+            raise ValueError("The public key may only be set once.")
+        return CertificateBuilder(
+            self._issuer_name,
+            self._subject_name,
+            key,
+            self._serial_number,
+            self._not_valid_before,
+            self._not_valid_after,
+            self._extensions,
+        )
+
+    def serial_number(self, number: int) -> CertificateBuilder:
+        """
+        Sets the certificate serial number.
+        """
+        if not isinstance(number, int):
+            raise TypeError("Serial number must be of integral type.")
+        if self._serial_number is not None:
+            raise ValueError("The serial number may only be set once.")
+        if number <= 0:
+            raise ValueError("The serial number should be positive.")
+
+        # ASN.1 integers are always signed, so most significant bit must be
+        # zero.
+        if number.bit_length() >= 160:  # As defined in RFC 5280
+            raise ValueError(
+                "The serial number should not be more than 159 " "bits."
+            )
+        return CertificateBuilder(
+            self._issuer_name,
+            self._subject_name,
+            self._public_key,
+            number,
+            self._not_valid_before,
+            self._not_valid_after,
+            self._extensions,
+        )
+
+    def not_valid_before(self, time: datetime.datetime) -> CertificateBuilder:
+        """
+        Sets the certificate activation time.
+        """
+        if not isinstance(time, datetime.datetime):
+            raise TypeError("Expecting datetime object.")
+        if self._not_valid_before is not None:
+            raise ValueError("The not valid before may only be set once.")
+        time = _convert_to_naive_utc_time(time)
+        if time < _EARLIEST_UTC_TIME:
+            raise ValueError(
+                "The not valid before date must be on or after"
+                " 1950 January 1)."
+            )
+        if self._not_valid_after is not None and time > self._not_valid_after:
+            raise ValueError(
+                "The not valid before date must be before the not valid after "
+                "date."
+            )
+        return CertificateBuilder(
+            self._issuer_name,
+            self._subject_name,
+            self._public_key,
+            self._serial_number,
+            time,
+            self._not_valid_after,
+            self._extensions,
+        )
+
+    def not_valid_after(self, time: datetime.datetime) -> CertificateBuilder:
+        """
+        Sets the certificate expiration time.
+        """
+        if not isinstance(time, datetime.datetime):
+            raise TypeError("Expecting datetime object.")
+        if self._not_valid_after is not None:
+            raise ValueError("The not valid after may only be set once.")
+        time = _convert_to_naive_utc_time(time)
+        if time < _EARLIEST_UTC_TIME:
+            raise ValueError(
+                "The not valid after date must be on or after"
+                " 1950 January 1."
+            )
+        if (
+            self._not_valid_before is not None
+            and time < self._not_valid_before
+        ):
+            raise ValueError(
+                "The not valid after date must be after the not valid before "
+                "date."
+            )
+        return CertificateBuilder(
+            self._issuer_name,
+            self._subject_name,
+            self._public_key,
+            self._serial_number,
+            self._not_valid_before,
+            time,
+            self._extensions,
+        )
+
+    def add_extension(
+        self, extval: ExtensionType, critical: bool
+    ) -> CertificateBuilder:
+        """
+        Adds an X.509 extension to the certificate.
+        """
+        if not isinstance(extval, ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+
+        return CertificateBuilder(
+            self._issuer_name,
+            self._subject_name,
+            self._public_key,
+            self._serial_number,
+            self._not_valid_before,
+            self._not_valid_after,
+            self._extensions + [extension],
+        )
+
+    def sign(
+        self,
+        private_key: CertificateIssuerPrivateKeyTypes,
+        algorithm: typing.Optional[_AllowedHashTypes],
+        backend: typing.Any = None,
+        *,
+        rsa_padding: typing.Optional[
+            typing.Union[padding.PSS, padding.PKCS1v15]
+        ] = None,
+    ) -> Certificate:
+        """
+        Signs the certificate using the CA's private key.
+        """
+        if self._subject_name is None:
+            raise ValueError("A certificate must have a subject name")
+
+        if self._issuer_name is None:
+            raise ValueError("A certificate must have an issuer name")
+
+        if self._serial_number is None:
+            raise ValueError("A certificate must have a serial number")
+
+        if self._not_valid_before is None:
+            raise ValueError("A certificate must have a not valid before time")
+
+        if self._not_valid_after is None:
+            raise ValueError("A certificate must have a not valid after time")
+
+        if self._public_key is None:
+            raise ValueError("A certificate must have a public key")
+
+        if rsa_padding is not None:
+            if not isinstance(rsa_padding, (padding.PSS, padding.PKCS1v15)):
+                raise TypeError("Padding must be PSS or PKCS1v15")
+            if not isinstance(private_key, rsa.RSAPrivateKey):
+                raise TypeError("Padding is only supported for RSA keys")
+
+        return rust_x509.create_x509_certificate(
+            self, private_key, algorithm, rsa_padding
+        )
+
+
+class CertificateRevocationListBuilder:
+    _extensions: typing.List[Extension[ExtensionType]]
+    _revoked_certificates: typing.List[RevokedCertificate]
+
+    def __init__(
+        self,
+        issuer_name: typing.Optional[Name] = None,
+        last_update: typing.Optional[datetime.datetime] = None,
+        next_update: typing.Optional[datetime.datetime] = None,
+        extensions: typing.List[Extension[ExtensionType]] = [],
+        revoked_certificates: typing.List[RevokedCertificate] = [],
+    ):
+        self._issuer_name = issuer_name
+        self._last_update = last_update
+        self._next_update = next_update
+        self._extensions = extensions
+        self._revoked_certificates = revoked_certificates
+
+    def issuer_name(
+        self, issuer_name: Name
+    ) -> CertificateRevocationListBuilder:
+        if not isinstance(issuer_name, Name):
+            raise TypeError("Expecting x509.Name object.")
+        if self._issuer_name is not None:
+            raise ValueError("The issuer name may only be set once.")
+        return CertificateRevocationListBuilder(
+            issuer_name,
+            self._last_update,
+            self._next_update,
+            self._extensions,
+            self._revoked_certificates,
+        )
+
+    def last_update(
+        self, last_update: datetime.datetime
+    ) -> CertificateRevocationListBuilder:
+        if not isinstance(last_update, datetime.datetime):
+            raise TypeError("Expecting datetime object.")
+        if self._last_update is not None:
+            raise ValueError("Last update may only be set once.")
+        last_update = _convert_to_naive_utc_time(last_update)
+        if last_update < _EARLIEST_UTC_TIME:
+            raise ValueError(
+                "The last update date must be on or after" " 1950 January 1."
+            )
+        if self._next_update is not None and last_update > self._next_update:
+            raise ValueError(
+                "The last update date must be before the next update date."
+            )
+        return CertificateRevocationListBuilder(
+            self._issuer_name,
+            last_update,
+            self._next_update,
+            self._extensions,
+            self._revoked_certificates,
+        )
+
+    def next_update(
+        self, next_update: datetime.datetime
+    ) -> CertificateRevocationListBuilder:
+        if not isinstance(next_update, datetime.datetime):
+            raise TypeError("Expecting datetime object.")
+        if self._next_update is not None:
+            raise ValueError("Last update may only be set once.")
+        next_update = _convert_to_naive_utc_time(next_update)
+        if next_update < _EARLIEST_UTC_TIME:
+            raise ValueError(
+                "The last update date must be on or after" " 1950 January 1."
+            )
+        if self._last_update is not None and next_update < self._last_update:
+            raise ValueError(
+                "The next update date must be after the last update date."
+            )
+        return CertificateRevocationListBuilder(
+            self._issuer_name,
+            self._last_update,
+            next_update,
+            self._extensions,
+            self._revoked_certificates,
+        )
+
+    def add_extension(
+        self, extval: ExtensionType, critical: bool
+    ) -> CertificateRevocationListBuilder:
+        """
+        Adds an X.509 extension to the certificate revocation list.
+        """
+        if not isinstance(extval, ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+        return CertificateRevocationListBuilder(
+            self._issuer_name,
+            self._last_update,
+            self._next_update,
+            self._extensions + [extension],
+            self._revoked_certificates,
+        )
+
+    def add_revoked_certificate(
+        self, revoked_certificate: RevokedCertificate
+    ) -> CertificateRevocationListBuilder:
+        """
+        Adds a revoked certificate to the CRL.
+        """
+        if not isinstance(revoked_certificate, RevokedCertificate):
+            raise TypeError("Must be an instance of RevokedCertificate")
+
+        return CertificateRevocationListBuilder(
+            self._issuer_name,
+            self._last_update,
+            self._next_update,
+            self._extensions,
+            self._revoked_certificates + [revoked_certificate],
+        )
+
+    def sign(
+        self,
+        private_key: CertificateIssuerPrivateKeyTypes,
+        algorithm: typing.Optional[_AllowedHashTypes],
+        backend: typing.Any = None,
+    ) -> CertificateRevocationList:
+        if self._issuer_name is None:
+            raise ValueError("A CRL must have an issuer name")
+
+        if self._last_update is None:
+            raise ValueError("A CRL must have a last update time")
+
+        if self._next_update is None:
+            raise ValueError("A CRL must have a next update time")
+
+        return rust_x509.create_x509_crl(self, private_key, algorithm)
+
+
+class RevokedCertificateBuilder:
+    def __init__(
+        self,
+        serial_number: typing.Optional[int] = None,
+        revocation_date: typing.Optional[datetime.datetime] = None,
+        extensions: typing.List[Extension[ExtensionType]] = [],
+    ):
+        self._serial_number = serial_number
+        self._revocation_date = revocation_date
+        self._extensions = extensions
+
+    def serial_number(self, number: int) -> RevokedCertificateBuilder:
+        if not isinstance(number, int):
+            raise TypeError("Serial number must be of integral type.")
+        if self._serial_number is not None:
+            raise ValueError("The serial number may only be set once.")
+        if number <= 0:
+            raise ValueError("The serial number should be positive")
+
+        # ASN.1 integers are always signed, so most significant bit must be
+        # zero.
+        if number.bit_length() >= 160:  # As defined in RFC 5280
+            raise ValueError(
+                "The serial number should not be more than 159 " "bits."
+            )
+        return RevokedCertificateBuilder(
+            number, self._revocation_date, self._extensions
+        )
+
+    def revocation_date(
+        self, time: datetime.datetime
+    ) -> RevokedCertificateBuilder:
+        if not isinstance(time, datetime.datetime):
+            raise TypeError("Expecting datetime object.")
+        if self._revocation_date is not None:
+            raise ValueError("The revocation date may only be set once.")
+        time = _convert_to_naive_utc_time(time)
+        if time < _EARLIEST_UTC_TIME:
+            raise ValueError(
+                "The revocation date must be on or after" " 1950 January 1."
+            )
+        return RevokedCertificateBuilder(
+            self._serial_number, time, self._extensions
+        )
+
+    def add_extension(
+        self, extval: ExtensionType, critical: bool
+    ) -> RevokedCertificateBuilder:
+        if not isinstance(extval, ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+        return RevokedCertificateBuilder(
+            self._serial_number,
+            self._revocation_date,
+            self._extensions + [extension],
+        )
+
+    def build(self, backend: typing.Any = None) -> RevokedCertificate:
+        if self._serial_number is None:
+            raise ValueError("A revoked certificate must have a serial number")
+        if self._revocation_date is None:
+            raise ValueError(
+                "A revoked certificate must have a revocation date"
+            )
+        return _RawRevokedCertificate(
+            self._serial_number,
+            self._revocation_date,
+            Extensions(self._extensions),
+        )
+
+
+def random_serial_number() -> int:
+    return int.from_bytes(os.urandom(20), "big") >> 1
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py
new file mode 100644
index 0000000000000000000000000000000000000000..73647ee716fc1c36bf255347617308522b724e5d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/certificate_transparency.py
@@ -0,0 +1,97 @@
+# 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 annotations
+
+import abc
+import datetime
+
+from cryptography import utils
+from cryptography.hazmat.bindings._rust import x509 as rust_x509
+from cryptography.hazmat.primitives.hashes import HashAlgorithm
+
+
+class LogEntryType(utils.Enum):
+    X509_CERTIFICATE = 0
+    PRE_CERTIFICATE = 1
+
+
+class Version(utils.Enum):
+    v1 = 0
+
+
+class SignatureAlgorithm(utils.Enum):
+    """
+    Signature algorithms that are valid for SCTs.
+
+    These are exactly the same as SignatureAlgorithm in RFC 5246 (TLS 1.2).
+
+    See: <https://datatracker.ietf.org/doc/html/rfc5246#section-7.4.1.4.1>
+    """
+
+    ANONYMOUS = 0
+    RSA = 1
+    DSA = 2
+    ECDSA = 3
+
+
+class SignedCertificateTimestamp(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def version(self) -> Version:
+        """
+        Returns the SCT version.
+        """
+
+    @property
+    @abc.abstractmethod
+    def log_id(self) -> bytes:
+        """
+        Returns an identifier indicating which log this SCT is for.
+        """
+
+    @property
+    @abc.abstractmethod
+    def timestamp(self) -> datetime.datetime:
+        """
+        Returns the timestamp for this SCT.
+        """
+
+    @property
+    @abc.abstractmethod
+    def entry_type(self) -> LogEntryType:
+        """
+        Returns whether this is an SCT for a certificate or pre-certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_hash_algorithm(self) -> HashAlgorithm:
+        """
+        Returns the hash algorithm used for the SCT's signature.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm(self) -> SignatureAlgorithm:
+        """
+        Returns the signing algorithm used for the SCT's signature.
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature(self) -> bytes:
+        """
+        Returns the signature for this SCT.
+        """
+
+    @property
+    @abc.abstractmethod
+    def extension_bytes(self) -> bytes:
+        """
+        Returns the raw bytes of any extensions for this SCT.
+        """
+
+
+SignedCertificateTimestamp.register(rust_x509.Sct)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/extensions.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/extensions.py
new file mode 100644
index 0000000000000000000000000000000000000000..ac99592f55a73a62e70dae2fad3c696635129bdd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/extensions.py
@@ -0,0 +1,2215 @@
+# 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 annotations
+
+import abc
+import datetime
+import hashlib
+import ipaddress
+import typing
+
+from cryptography import utils
+from cryptography.hazmat.bindings._rust import asn1
+from cryptography.hazmat.bindings._rust import x509 as rust_x509
+from cryptography.hazmat.primitives import constant_time, serialization
+from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePublicKey
+from cryptography.hazmat.primitives.asymmetric.rsa import RSAPublicKey
+from cryptography.hazmat.primitives.asymmetric.types import (
+    CertificateIssuerPublicKeyTypes,
+    CertificatePublicKeyTypes,
+)
+from cryptography.x509.certificate_transparency import (
+    SignedCertificateTimestamp,
+)
+from cryptography.x509.general_name import (
+    DirectoryName,
+    DNSName,
+    GeneralName,
+    IPAddress,
+    OtherName,
+    RegisteredID,
+    RFC822Name,
+    UniformResourceIdentifier,
+    _IPAddressTypes,
+)
+from cryptography.x509.name import Name, RelativeDistinguishedName
+from cryptography.x509.oid import (
+    CRLEntryExtensionOID,
+    ExtensionOID,
+    ObjectIdentifier,
+    OCSPExtensionOID,
+)
+
+ExtensionTypeVar = typing.TypeVar(
+    "ExtensionTypeVar", bound="ExtensionType", covariant=True
+)
+
+
+def _key_identifier_from_public_key(
+    public_key: CertificatePublicKeyTypes,
+) -> bytes:
+    if isinstance(public_key, RSAPublicKey):
+        data = public_key.public_bytes(
+            serialization.Encoding.DER,
+            serialization.PublicFormat.PKCS1,
+        )
+    elif isinstance(public_key, EllipticCurvePublicKey):
+        data = public_key.public_bytes(
+            serialization.Encoding.X962,
+            serialization.PublicFormat.UncompressedPoint,
+        )
+    else:
+        # This is a very slow way to do this.
+        serialized = public_key.public_bytes(
+            serialization.Encoding.DER,
+            serialization.PublicFormat.SubjectPublicKeyInfo,
+        )
+        data = asn1.parse_spki_for_data(serialized)
+
+    return hashlib.sha1(data).digest()
+
+
+def _make_sequence_methods(field_name: str):
+    def len_method(self) -> int:
+        return len(getattr(self, field_name))
+
+    def iter_method(self):
+        return iter(getattr(self, field_name))
+
+    def getitem_method(self, idx):
+        return getattr(self, field_name)[idx]
+
+    return len_method, iter_method, getitem_method
+
+
+class DuplicateExtension(Exception):
+    def __init__(self, msg: str, oid: ObjectIdentifier) -> None:
+        super().__init__(msg)
+        self.oid = oid
+
+
+class ExtensionNotFound(Exception):
+    def __init__(self, msg: str, oid: ObjectIdentifier) -> None:
+        super().__init__(msg)
+        self.oid = oid
+
+
+class ExtensionType(metaclass=abc.ABCMeta):
+    oid: typing.ClassVar[ObjectIdentifier]
+
+    def public_bytes(self) -> bytes:
+        """
+        Serializes the extension type to DER.
+        """
+        raise NotImplementedError(
+            "public_bytes is not implemented for extension type {!r}".format(
+                self
+            )
+        )
+
+
+class Extensions:
+    def __init__(
+        self, extensions: typing.Iterable[Extension[ExtensionType]]
+    ) -> None:
+        self._extensions = list(extensions)
+
+    def get_extension_for_oid(
+        self, oid: ObjectIdentifier
+    ) -> Extension[ExtensionType]:
+        for ext in self:
+            if ext.oid == oid:
+                return ext
+
+        raise ExtensionNotFound(f"No {oid} extension was found", oid)
+
+    def get_extension_for_class(
+        self, extclass: typing.Type[ExtensionTypeVar]
+    ) -> Extension[ExtensionTypeVar]:
+        if extclass is UnrecognizedExtension:
+            raise TypeError(
+                "UnrecognizedExtension can't be used with "
+                "get_extension_for_class because more than one instance of the"
+                " class may be present."
+            )
+
+        for ext in self:
+            if isinstance(ext.value, extclass):
+                return ext
+
+        raise ExtensionNotFound(
+            f"No {extclass} extension was found", extclass.oid
+        )
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_extensions")
+
+    def __repr__(self) -> str:
+        return f"<Extensions({self._extensions})>"
+
+
+class CRLNumber(ExtensionType):
+    oid = ExtensionOID.CRL_NUMBER
+
+    def __init__(self, crl_number: int) -> None:
+        if not isinstance(crl_number, int):
+            raise TypeError("crl_number must be an integer")
+
+        self._crl_number = crl_number
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, CRLNumber):
+            return NotImplemented
+
+        return self.crl_number == other.crl_number
+
+    def __hash__(self) -> int:
+        return hash(self.crl_number)
+
+    def __repr__(self) -> str:
+        return f"<CRLNumber({self.crl_number})>"
+
+    @property
+    def crl_number(self) -> int:
+        return self._crl_number
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class AuthorityKeyIdentifier(ExtensionType):
+    oid = ExtensionOID.AUTHORITY_KEY_IDENTIFIER
+
+    def __init__(
+        self,
+        key_identifier: typing.Optional[bytes],
+        authority_cert_issuer: typing.Optional[typing.Iterable[GeneralName]],
+        authority_cert_serial_number: typing.Optional[int],
+    ) -> None:
+        if (authority_cert_issuer is None) != (
+            authority_cert_serial_number is None
+        ):
+            raise ValueError(
+                "authority_cert_issuer and authority_cert_serial_number "
+                "must both be present or both None"
+            )
+
+        if authority_cert_issuer is not None:
+            authority_cert_issuer = list(authority_cert_issuer)
+            if not all(
+                isinstance(x, GeneralName) for x in authority_cert_issuer
+            ):
+                raise TypeError(
+                    "authority_cert_issuer must be a list of GeneralName "
+                    "objects"
+                )
+
+        if authority_cert_serial_number is not None and not isinstance(
+            authority_cert_serial_number, int
+        ):
+            raise TypeError("authority_cert_serial_number must be an integer")
+
+        self._key_identifier = key_identifier
+        self._authority_cert_issuer = authority_cert_issuer
+        self._authority_cert_serial_number = authority_cert_serial_number
+
+    # This takes a subset of CertificatePublicKeyTypes because an issuer
+    # cannot have an X25519/X448 key. This introduces some unfortunate
+    # asymmetry that requires typing users to explicitly
+    # narrow their type, but we should make this accurate and not just
+    # convenient.
+    @classmethod
+    def from_issuer_public_key(
+        cls, public_key: CertificateIssuerPublicKeyTypes
+    ) -> AuthorityKeyIdentifier:
+        digest = _key_identifier_from_public_key(public_key)
+        return cls(
+            key_identifier=digest,
+            authority_cert_issuer=None,
+            authority_cert_serial_number=None,
+        )
+
+    @classmethod
+    def from_issuer_subject_key_identifier(
+        cls, ski: SubjectKeyIdentifier
+    ) -> AuthorityKeyIdentifier:
+        return cls(
+            key_identifier=ski.digest,
+            authority_cert_issuer=None,
+            authority_cert_serial_number=None,
+        )
+
+    def __repr__(self) -> str:
+        return (
+            "<AuthorityKeyIdentifier(key_identifier={0.key_identifier!r}, "
+            "authority_cert_issuer={0.authority_cert_issuer}, "
+            "authority_cert_serial_number={0.authority_cert_serial_number}"
+            ")>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, AuthorityKeyIdentifier):
+            return NotImplemented
+
+        return (
+            self.key_identifier == other.key_identifier
+            and self.authority_cert_issuer == other.authority_cert_issuer
+            and self.authority_cert_serial_number
+            == other.authority_cert_serial_number
+        )
+
+    def __hash__(self) -> int:
+        if self.authority_cert_issuer is None:
+            aci = None
+        else:
+            aci = tuple(self.authority_cert_issuer)
+        return hash(
+            (self.key_identifier, aci, self.authority_cert_serial_number)
+        )
+
+    @property
+    def key_identifier(self) -> typing.Optional[bytes]:
+        return self._key_identifier
+
+    @property
+    def authority_cert_issuer(
+        self,
+    ) -> typing.Optional[typing.List[GeneralName]]:
+        return self._authority_cert_issuer
+
+    @property
+    def authority_cert_serial_number(self) -> typing.Optional[int]:
+        return self._authority_cert_serial_number
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class SubjectKeyIdentifier(ExtensionType):
+    oid = ExtensionOID.SUBJECT_KEY_IDENTIFIER
+
+    def __init__(self, digest: bytes) -> None:
+        self._digest = digest
+
+    @classmethod
+    def from_public_key(
+        cls, public_key: CertificatePublicKeyTypes
+    ) -> SubjectKeyIdentifier:
+        return cls(_key_identifier_from_public_key(public_key))
+
+    @property
+    def digest(self) -> bytes:
+        return self._digest
+
+    @property
+    def key_identifier(self) -> bytes:
+        return self._digest
+
+    def __repr__(self) -> str:
+        return f"<SubjectKeyIdentifier(digest={self.digest!r})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, SubjectKeyIdentifier):
+            return NotImplemented
+
+        return constant_time.bytes_eq(self.digest, other.digest)
+
+    def __hash__(self) -> int:
+        return hash(self.digest)
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class AuthorityInformationAccess(ExtensionType):
+    oid = ExtensionOID.AUTHORITY_INFORMATION_ACCESS
+
+    def __init__(
+        self, descriptions: typing.Iterable[AccessDescription]
+    ) -> None:
+        descriptions = list(descriptions)
+        if not all(isinstance(x, AccessDescription) for x in descriptions):
+            raise TypeError(
+                "Every item in the descriptions list must be an "
+                "AccessDescription"
+            )
+
+        self._descriptions = descriptions
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions")
+
+    def __repr__(self) -> str:
+        return f"<AuthorityInformationAccess({self._descriptions})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, AuthorityInformationAccess):
+            return NotImplemented
+
+        return self._descriptions == other._descriptions
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._descriptions))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class SubjectInformationAccess(ExtensionType):
+    oid = ExtensionOID.SUBJECT_INFORMATION_ACCESS
+
+    def __init__(
+        self, descriptions: typing.Iterable[AccessDescription]
+    ) -> None:
+        descriptions = list(descriptions)
+        if not all(isinstance(x, AccessDescription) for x in descriptions):
+            raise TypeError(
+                "Every item in the descriptions list must be an "
+                "AccessDescription"
+            )
+
+        self._descriptions = descriptions
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_descriptions")
+
+    def __repr__(self) -> str:
+        return f"<SubjectInformationAccess({self._descriptions})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, SubjectInformationAccess):
+            return NotImplemented
+
+        return self._descriptions == other._descriptions
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._descriptions))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class AccessDescription:
+    def __init__(
+        self, access_method: ObjectIdentifier, access_location: GeneralName
+    ) -> None:
+        if not isinstance(access_method, ObjectIdentifier):
+            raise TypeError("access_method must be an ObjectIdentifier")
+
+        if not isinstance(access_location, GeneralName):
+            raise TypeError("access_location must be a GeneralName")
+
+        self._access_method = access_method
+        self._access_location = access_location
+
+    def __repr__(self) -> str:
+        return (
+            "<AccessDescription(access_method={0.access_method}, access_locati"
+            "on={0.access_location})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, AccessDescription):
+            return NotImplemented
+
+        return (
+            self.access_method == other.access_method
+            and self.access_location == other.access_location
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.access_method, self.access_location))
+
+    @property
+    def access_method(self) -> ObjectIdentifier:
+        return self._access_method
+
+    @property
+    def access_location(self) -> GeneralName:
+        return self._access_location
+
+
+class BasicConstraints(ExtensionType):
+    oid = ExtensionOID.BASIC_CONSTRAINTS
+
+    def __init__(self, ca: bool, path_length: typing.Optional[int]) -> None:
+        if not isinstance(ca, bool):
+            raise TypeError("ca must be a boolean value")
+
+        if path_length is not None and not ca:
+            raise ValueError("path_length must be None when ca is False")
+
+        if path_length is not None and (
+            not isinstance(path_length, int) or path_length < 0
+        ):
+            raise TypeError(
+                "path_length must be a non-negative integer or None"
+            )
+
+        self._ca = ca
+        self._path_length = path_length
+
+    @property
+    def ca(self) -> bool:
+        return self._ca
+
+    @property
+    def path_length(self) -> typing.Optional[int]:
+        return self._path_length
+
+    def __repr__(self) -> str:
+        return (
+            "<BasicConstraints(ca={0.ca}, " "path_length={0.path_length})>"
+        ).format(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, BasicConstraints):
+            return NotImplemented
+
+        return self.ca == other.ca and self.path_length == other.path_length
+
+    def __hash__(self) -> int:
+        return hash((self.ca, self.path_length))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class DeltaCRLIndicator(ExtensionType):
+    oid = ExtensionOID.DELTA_CRL_INDICATOR
+
+    def __init__(self, crl_number: int) -> None:
+        if not isinstance(crl_number, int):
+            raise TypeError("crl_number must be an integer")
+
+        self._crl_number = crl_number
+
+    @property
+    def crl_number(self) -> int:
+        return self._crl_number
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DeltaCRLIndicator):
+            return NotImplemented
+
+        return self.crl_number == other.crl_number
+
+    def __hash__(self) -> int:
+        return hash(self.crl_number)
+
+    def __repr__(self) -> str:
+        return f"<DeltaCRLIndicator(crl_number={self.crl_number})>"
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class CRLDistributionPoints(ExtensionType):
+    oid = ExtensionOID.CRL_DISTRIBUTION_POINTS
+
+    def __init__(
+        self, distribution_points: typing.Iterable[DistributionPoint]
+    ) -> None:
+        distribution_points = list(distribution_points)
+        if not all(
+            isinstance(x, DistributionPoint) for x in distribution_points
+        ):
+            raise TypeError(
+                "distribution_points must be a list of DistributionPoint "
+                "objects"
+            )
+
+        self._distribution_points = distribution_points
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods(
+        "_distribution_points"
+    )
+
+    def __repr__(self) -> str:
+        return f"<CRLDistributionPoints({self._distribution_points})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, CRLDistributionPoints):
+            return NotImplemented
+
+        return self._distribution_points == other._distribution_points
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._distribution_points))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class FreshestCRL(ExtensionType):
+    oid = ExtensionOID.FRESHEST_CRL
+
+    def __init__(
+        self, distribution_points: typing.Iterable[DistributionPoint]
+    ) -> None:
+        distribution_points = list(distribution_points)
+        if not all(
+            isinstance(x, DistributionPoint) for x in distribution_points
+        ):
+            raise TypeError(
+                "distribution_points must be a list of DistributionPoint "
+                "objects"
+            )
+
+        self._distribution_points = distribution_points
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods(
+        "_distribution_points"
+    )
+
+    def __repr__(self) -> str:
+        return f"<FreshestCRL({self._distribution_points})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, FreshestCRL):
+            return NotImplemented
+
+        return self._distribution_points == other._distribution_points
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._distribution_points))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class DistributionPoint:
+    def __init__(
+        self,
+        full_name: typing.Optional[typing.Iterable[GeneralName]],
+        relative_name: typing.Optional[RelativeDistinguishedName],
+        reasons: typing.Optional[typing.FrozenSet[ReasonFlags]],
+        crl_issuer: typing.Optional[typing.Iterable[GeneralName]],
+    ) -> None:
+        if full_name and relative_name:
+            raise ValueError(
+                "You cannot provide both full_name and relative_name, at "
+                "least one must be None."
+            )
+        if not full_name and not relative_name and not crl_issuer:
+            raise ValueError(
+                "Either full_name, relative_name or crl_issuer must be "
+                "provided."
+            )
+
+        if full_name is not None:
+            full_name = list(full_name)
+            if not all(isinstance(x, GeneralName) for x in full_name):
+                raise TypeError(
+                    "full_name must be a list of GeneralName objects"
+                )
+
+        if relative_name:
+            if not isinstance(relative_name, RelativeDistinguishedName):
+                raise TypeError(
+                    "relative_name must be a RelativeDistinguishedName"
+                )
+
+        if crl_issuer is not None:
+            crl_issuer = list(crl_issuer)
+            if not all(isinstance(x, GeneralName) for x in crl_issuer):
+                raise TypeError(
+                    "crl_issuer must be None or a list of general names"
+                )
+
+        if reasons and (
+            not isinstance(reasons, frozenset)
+            or not all(isinstance(x, ReasonFlags) for x in reasons)
+        ):
+            raise TypeError("reasons must be None or frozenset of ReasonFlags")
+
+        if reasons and (
+            ReasonFlags.unspecified in reasons
+            or ReasonFlags.remove_from_crl in reasons
+        ):
+            raise ValueError(
+                "unspecified and remove_from_crl are not valid reasons in a "
+                "DistributionPoint"
+            )
+
+        self._full_name = full_name
+        self._relative_name = relative_name
+        self._reasons = reasons
+        self._crl_issuer = crl_issuer
+
+    def __repr__(self) -> str:
+        return (
+            "<DistributionPoint(full_name={0.full_name}, relative_name={0.rela"
+            "tive_name}, reasons={0.reasons}, "
+            "crl_issuer={0.crl_issuer})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DistributionPoint):
+            return NotImplemented
+
+        return (
+            self.full_name == other.full_name
+            and self.relative_name == other.relative_name
+            and self.reasons == other.reasons
+            and self.crl_issuer == other.crl_issuer
+        )
+
+    def __hash__(self) -> int:
+        if self.full_name is not None:
+            fn: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple(
+                self.full_name
+            )
+        else:
+            fn = None
+
+        if self.crl_issuer is not None:
+            crl_issuer: typing.Optional[
+                typing.Tuple[GeneralName, ...]
+            ] = tuple(self.crl_issuer)
+        else:
+            crl_issuer = None
+
+        return hash((fn, self.relative_name, self.reasons, crl_issuer))
+
+    @property
+    def full_name(self) -> typing.Optional[typing.List[GeneralName]]:
+        return self._full_name
+
+    @property
+    def relative_name(self) -> typing.Optional[RelativeDistinguishedName]:
+        return self._relative_name
+
+    @property
+    def reasons(self) -> typing.Optional[typing.FrozenSet[ReasonFlags]]:
+        return self._reasons
+
+    @property
+    def crl_issuer(self) -> typing.Optional[typing.List[GeneralName]]:
+        return self._crl_issuer
+
+
+class ReasonFlags(utils.Enum):
+    unspecified = "unspecified"
+    key_compromise = "keyCompromise"
+    ca_compromise = "cACompromise"
+    affiliation_changed = "affiliationChanged"
+    superseded = "superseded"
+    cessation_of_operation = "cessationOfOperation"
+    certificate_hold = "certificateHold"
+    privilege_withdrawn = "privilegeWithdrawn"
+    aa_compromise = "aACompromise"
+    remove_from_crl = "removeFromCRL"
+
+
+# These are distribution point bit string mappings. Not to be confused with
+# CRLReason reason flags bit string mappings.
+# ReasonFlags ::= BIT STRING {
+#      unused                  (0),
+#      keyCompromise           (1),
+#      cACompromise            (2),
+#      affiliationChanged      (3),
+#      superseded              (4),
+#      cessationOfOperation    (5),
+#      certificateHold         (6),
+#      privilegeWithdrawn      (7),
+#      aACompromise            (8) }
+_REASON_BIT_MAPPING = {
+    1: ReasonFlags.key_compromise,
+    2: ReasonFlags.ca_compromise,
+    3: ReasonFlags.affiliation_changed,
+    4: ReasonFlags.superseded,
+    5: ReasonFlags.cessation_of_operation,
+    6: ReasonFlags.certificate_hold,
+    7: ReasonFlags.privilege_withdrawn,
+    8: ReasonFlags.aa_compromise,
+}
+
+_CRLREASONFLAGS = {
+    ReasonFlags.key_compromise: 1,
+    ReasonFlags.ca_compromise: 2,
+    ReasonFlags.affiliation_changed: 3,
+    ReasonFlags.superseded: 4,
+    ReasonFlags.cessation_of_operation: 5,
+    ReasonFlags.certificate_hold: 6,
+    ReasonFlags.privilege_withdrawn: 7,
+    ReasonFlags.aa_compromise: 8,
+}
+
+
+class PolicyConstraints(ExtensionType):
+    oid = ExtensionOID.POLICY_CONSTRAINTS
+
+    def __init__(
+        self,
+        require_explicit_policy: typing.Optional[int],
+        inhibit_policy_mapping: typing.Optional[int],
+    ) -> None:
+        if require_explicit_policy is not None and not isinstance(
+            require_explicit_policy, int
+        ):
+            raise TypeError(
+                "require_explicit_policy must be a non-negative integer or "
+                "None"
+            )
+
+        if inhibit_policy_mapping is not None and not isinstance(
+            inhibit_policy_mapping, int
+        ):
+            raise TypeError(
+                "inhibit_policy_mapping must be a non-negative integer or None"
+            )
+
+        if inhibit_policy_mapping is None and require_explicit_policy is None:
+            raise ValueError(
+                "At least one of require_explicit_policy and "
+                "inhibit_policy_mapping must not be None"
+            )
+
+        self._require_explicit_policy = require_explicit_policy
+        self._inhibit_policy_mapping = inhibit_policy_mapping
+
+    def __repr__(self) -> str:
+        return (
+            "<PolicyConstraints(require_explicit_policy={0.require_explicit"
+            "_policy}, inhibit_policy_mapping={0.inhibit_policy_"
+            "mapping})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PolicyConstraints):
+            return NotImplemented
+
+        return (
+            self.require_explicit_policy == other.require_explicit_policy
+            and self.inhibit_policy_mapping == other.inhibit_policy_mapping
+        )
+
+    def __hash__(self) -> int:
+        return hash(
+            (self.require_explicit_policy, self.inhibit_policy_mapping)
+        )
+
+    @property
+    def require_explicit_policy(self) -> typing.Optional[int]:
+        return self._require_explicit_policy
+
+    @property
+    def inhibit_policy_mapping(self) -> typing.Optional[int]:
+        return self._inhibit_policy_mapping
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class CertificatePolicies(ExtensionType):
+    oid = ExtensionOID.CERTIFICATE_POLICIES
+
+    def __init__(self, policies: typing.Iterable[PolicyInformation]) -> None:
+        policies = list(policies)
+        if not all(isinstance(x, PolicyInformation) for x in policies):
+            raise TypeError(
+                "Every item in the policies list must be a "
+                "PolicyInformation"
+            )
+
+        self._policies = policies
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_policies")
+
+    def __repr__(self) -> str:
+        return f"<CertificatePolicies({self._policies})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, CertificatePolicies):
+            return NotImplemented
+
+        return self._policies == other._policies
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._policies))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class PolicyInformation:
+    def __init__(
+        self,
+        policy_identifier: ObjectIdentifier,
+        policy_qualifiers: typing.Optional[
+            typing.Iterable[typing.Union[str, UserNotice]]
+        ],
+    ) -> None:
+        if not isinstance(policy_identifier, ObjectIdentifier):
+            raise TypeError("policy_identifier must be an ObjectIdentifier")
+
+        self._policy_identifier = policy_identifier
+
+        if policy_qualifiers is not None:
+            policy_qualifiers = list(policy_qualifiers)
+            if not all(
+                isinstance(x, (str, UserNotice)) for x in policy_qualifiers
+            ):
+                raise TypeError(
+                    "policy_qualifiers must be a list of strings and/or "
+                    "UserNotice objects or None"
+                )
+
+        self._policy_qualifiers = policy_qualifiers
+
+    def __repr__(self) -> str:
+        return (
+            "<PolicyInformation(policy_identifier={0.policy_identifier}, polic"
+            "y_qualifiers={0.policy_qualifiers})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PolicyInformation):
+            return NotImplemented
+
+        return (
+            self.policy_identifier == other.policy_identifier
+            and self.policy_qualifiers == other.policy_qualifiers
+        )
+
+    def __hash__(self) -> int:
+        if self.policy_qualifiers is not None:
+            pq: typing.Optional[
+                typing.Tuple[typing.Union[str, UserNotice], ...]
+            ] = tuple(self.policy_qualifiers)
+        else:
+            pq = None
+
+        return hash((self.policy_identifier, pq))
+
+    @property
+    def policy_identifier(self) -> ObjectIdentifier:
+        return self._policy_identifier
+
+    @property
+    def policy_qualifiers(
+        self,
+    ) -> typing.Optional[typing.List[typing.Union[str, UserNotice]]]:
+        return self._policy_qualifiers
+
+
+class UserNotice:
+    def __init__(
+        self,
+        notice_reference: typing.Optional[NoticeReference],
+        explicit_text: typing.Optional[str],
+    ) -> None:
+        if notice_reference and not isinstance(
+            notice_reference, NoticeReference
+        ):
+            raise TypeError(
+                "notice_reference must be None or a NoticeReference"
+            )
+
+        self._notice_reference = notice_reference
+        self._explicit_text = explicit_text
+
+    def __repr__(self) -> str:
+        return (
+            "<UserNotice(notice_reference={0.notice_reference}, explicit_text="
+            "{0.explicit_text!r})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, UserNotice):
+            return NotImplemented
+
+        return (
+            self.notice_reference == other.notice_reference
+            and self.explicit_text == other.explicit_text
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.notice_reference, self.explicit_text))
+
+    @property
+    def notice_reference(self) -> typing.Optional[NoticeReference]:
+        return self._notice_reference
+
+    @property
+    def explicit_text(self) -> typing.Optional[str]:
+        return self._explicit_text
+
+
+class NoticeReference:
+    def __init__(
+        self,
+        organization: typing.Optional[str],
+        notice_numbers: typing.Iterable[int],
+    ) -> None:
+        self._organization = organization
+        notice_numbers = list(notice_numbers)
+        if not all(isinstance(x, int) for x in notice_numbers):
+            raise TypeError("notice_numbers must be a list of integers")
+
+        self._notice_numbers = notice_numbers
+
+    def __repr__(self) -> str:
+        return (
+            "<NoticeReference(organization={0.organization!r}, notice_numbers="
+            "{0.notice_numbers})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, NoticeReference):
+            return NotImplemented
+
+        return (
+            self.organization == other.organization
+            and self.notice_numbers == other.notice_numbers
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.organization, tuple(self.notice_numbers)))
+
+    @property
+    def organization(self) -> typing.Optional[str]:
+        return self._organization
+
+    @property
+    def notice_numbers(self) -> typing.List[int]:
+        return self._notice_numbers
+
+
+class ExtendedKeyUsage(ExtensionType):
+    oid = ExtensionOID.EXTENDED_KEY_USAGE
+
+    def __init__(self, usages: typing.Iterable[ObjectIdentifier]) -> None:
+        usages = list(usages)
+        if not all(isinstance(x, ObjectIdentifier) for x in usages):
+            raise TypeError(
+                "Every item in the usages list must be an ObjectIdentifier"
+            )
+
+        self._usages = usages
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_usages")
+
+    def __repr__(self) -> str:
+        return f"<ExtendedKeyUsage({self._usages})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, ExtendedKeyUsage):
+            return NotImplemented
+
+        return self._usages == other._usages
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._usages))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class OCSPNoCheck(ExtensionType):
+    oid = ExtensionOID.OCSP_NO_CHECK
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, OCSPNoCheck):
+            return NotImplemented
+
+        return True
+
+    def __hash__(self) -> int:
+        return hash(OCSPNoCheck)
+
+    def __repr__(self) -> str:
+        return "<OCSPNoCheck()>"
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class PrecertPoison(ExtensionType):
+    oid = ExtensionOID.PRECERT_POISON
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PrecertPoison):
+            return NotImplemented
+
+        return True
+
+    def __hash__(self) -> int:
+        return hash(PrecertPoison)
+
+    def __repr__(self) -> str:
+        return "<PrecertPoison()>"
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class TLSFeature(ExtensionType):
+    oid = ExtensionOID.TLS_FEATURE
+
+    def __init__(self, features: typing.Iterable[TLSFeatureType]) -> None:
+        features = list(features)
+        if (
+            not all(isinstance(x, TLSFeatureType) for x in features)
+            or len(features) == 0
+        ):
+            raise TypeError(
+                "features must be a list of elements from the TLSFeatureType "
+                "enum"
+            )
+
+        self._features = features
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_features")
+
+    def __repr__(self) -> str:
+        return f"<TLSFeature(features={self._features})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, TLSFeature):
+            return NotImplemented
+
+        return self._features == other._features
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._features))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class TLSFeatureType(utils.Enum):
+    # status_request is defined in RFC 6066 and is used for what is commonly
+    # called OCSP Must-Staple when present in the TLS Feature extension in an
+    # X.509 certificate.
+    status_request = 5
+    # status_request_v2 is defined in RFC 6961 and allows multiple OCSP
+    # responses to be provided. It is not currently in use by clients or
+    # servers.
+    status_request_v2 = 17
+
+
+_TLS_FEATURE_TYPE_TO_ENUM = {x.value: x for x in TLSFeatureType}
+
+
+class InhibitAnyPolicy(ExtensionType):
+    oid = ExtensionOID.INHIBIT_ANY_POLICY
+
+    def __init__(self, skip_certs: int) -> None:
+        if not isinstance(skip_certs, int):
+            raise TypeError("skip_certs must be an integer")
+
+        if skip_certs < 0:
+            raise ValueError("skip_certs must be a non-negative integer")
+
+        self._skip_certs = skip_certs
+
+    def __repr__(self) -> str:
+        return f"<InhibitAnyPolicy(skip_certs={self.skip_certs})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, InhibitAnyPolicy):
+            return NotImplemented
+
+        return self.skip_certs == other.skip_certs
+
+    def __hash__(self) -> int:
+        return hash(self.skip_certs)
+
+    @property
+    def skip_certs(self) -> int:
+        return self._skip_certs
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class KeyUsage(ExtensionType):
+    oid = ExtensionOID.KEY_USAGE
+
+    def __init__(
+        self,
+        digital_signature: bool,
+        content_commitment: bool,
+        key_encipherment: bool,
+        data_encipherment: bool,
+        key_agreement: bool,
+        key_cert_sign: bool,
+        crl_sign: bool,
+        encipher_only: bool,
+        decipher_only: bool,
+    ) -> None:
+        if not key_agreement and (encipher_only or decipher_only):
+            raise ValueError(
+                "encipher_only and decipher_only can only be true when "
+                "key_agreement is true"
+            )
+
+        self._digital_signature = digital_signature
+        self._content_commitment = content_commitment
+        self._key_encipherment = key_encipherment
+        self._data_encipherment = data_encipherment
+        self._key_agreement = key_agreement
+        self._key_cert_sign = key_cert_sign
+        self._crl_sign = crl_sign
+        self._encipher_only = encipher_only
+        self._decipher_only = decipher_only
+
+    @property
+    def digital_signature(self) -> bool:
+        return self._digital_signature
+
+    @property
+    def content_commitment(self) -> bool:
+        return self._content_commitment
+
+    @property
+    def key_encipherment(self) -> bool:
+        return self._key_encipherment
+
+    @property
+    def data_encipherment(self) -> bool:
+        return self._data_encipherment
+
+    @property
+    def key_agreement(self) -> bool:
+        return self._key_agreement
+
+    @property
+    def key_cert_sign(self) -> bool:
+        return self._key_cert_sign
+
+    @property
+    def crl_sign(self) -> bool:
+        return self._crl_sign
+
+    @property
+    def encipher_only(self) -> bool:
+        if not self.key_agreement:
+            raise ValueError(
+                "encipher_only is undefined unless key_agreement is true"
+            )
+        else:
+            return self._encipher_only
+
+    @property
+    def decipher_only(self) -> bool:
+        if not self.key_agreement:
+            raise ValueError(
+                "decipher_only is undefined unless key_agreement is true"
+            )
+        else:
+            return self._decipher_only
+
+    def __repr__(self) -> str:
+        try:
+            encipher_only = self.encipher_only
+            decipher_only = self.decipher_only
+        except ValueError:
+            # Users found None confusing because even though encipher/decipher
+            # have no meaning unless key_agreement is true, to construct an
+            # instance of the class you still need to pass False.
+            encipher_only = False
+            decipher_only = False
+
+        return (
+            "<KeyUsage(digital_signature={0.digital_signature}, "
+            "content_commitment={0.content_commitment}, "
+            "key_encipherment={0.key_encipherment}, "
+            "data_encipherment={0.data_encipherment}, "
+            "key_agreement={0.key_agreement}, "
+            "key_cert_sign={0.key_cert_sign}, crl_sign={0.crl_sign}, "
+            "encipher_only={1}, decipher_only={2})>"
+        ).format(self, encipher_only, decipher_only)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, KeyUsage):
+            return NotImplemented
+
+        return (
+            self.digital_signature == other.digital_signature
+            and self.content_commitment == other.content_commitment
+            and self.key_encipherment == other.key_encipherment
+            and self.data_encipherment == other.data_encipherment
+            and self.key_agreement == other.key_agreement
+            and self.key_cert_sign == other.key_cert_sign
+            and self.crl_sign == other.crl_sign
+            and self._encipher_only == other._encipher_only
+            and self._decipher_only == other._decipher_only
+        )
+
+    def __hash__(self) -> int:
+        return hash(
+            (
+                self.digital_signature,
+                self.content_commitment,
+                self.key_encipherment,
+                self.data_encipherment,
+                self.key_agreement,
+                self.key_cert_sign,
+                self.crl_sign,
+                self._encipher_only,
+                self._decipher_only,
+            )
+        )
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class NameConstraints(ExtensionType):
+    oid = ExtensionOID.NAME_CONSTRAINTS
+
+    def __init__(
+        self,
+        permitted_subtrees: typing.Optional[typing.Iterable[GeneralName]],
+        excluded_subtrees: typing.Optional[typing.Iterable[GeneralName]],
+    ) -> None:
+        if permitted_subtrees is not None:
+            permitted_subtrees = list(permitted_subtrees)
+            if not permitted_subtrees:
+                raise ValueError(
+                    "permitted_subtrees must be a non-empty list or None"
+                )
+            if not all(isinstance(x, GeneralName) for x in permitted_subtrees):
+                raise TypeError(
+                    "permitted_subtrees must be a list of GeneralName objects "
+                    "or None"
+                )
+
+            self._validate_tree(permitted_subtrees)
+
+        if excluded_subtrees is not None:
+            excluded_subtrees = list(excluded_subtrees)
+            if not excluded_subtrees:
+                raise ValueError(
+                    "excluded_subtrees must be a non-empty list or None"
+                )
+            if not all(isinstance(x, GeneralName) for x in excluded_subtrees):
+                raise TypeError(
+                    "excluded_subtrees must be a list of GeneralName objects "
+                    "or None"
+                )
+
+            self._validate_tree(excluded_subtrees)
+
+        if permitted_subtrees is None and excluded_subtrees is None:
+            raise ValueError(
+                "At least one of permitted_subtrees and excluded_subtrees "
+                "must not be None"
+            )
+
+        self._permitted_subtrees = permitted_subtrees
+        self._excluded_subtrees = excluded_subtrees
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, NameConstraints):
+            return NotImplemented
+
+        return (
+            self.excluded_subtrees == other.excluded_subtrees
+            and self.permitted_subtrees == other.permitted_subtrees
+        )
+
+    def _validate_tree(self, tree: typing.Iterable[GeneralName]) -> None:
+        self._validate_ip_name(tree)
+        self._validate_dns_name(tree)
+
+    def _validate_ip_name(self, tree: typing.Iterable[GeneralName]) -> None:
+        if any(
+            isinstance(name, IPAddress)
+            and not isinstance(
+                name.value, (ipaddress.IPv4Network, ipaddress.IPv6Network)
+            )
+            for name in tree
+        ):
+            raise TypeError(
+                "IPAddress name constraints must be an IPv4Network or"
+                " IPv6Network object"
+            )
+
+    def _validate_dns_name(self, tree: typing.Iterable[GeneralName]) -> None:
+        if any(
+            isinstance(name, DNSName) and "*" in name.value for name in tree
+        ):
+            raise ValueError(
+                "DNSName name constraints must not contain the '*' wildcard"
+                " character"
+            )
+
+    def __repr__(self) -> str:
+        return (
+            "<NameConstraints(permitted_subtrees={0.permitted_subtrees}, "
+            "excluded_subtrees={0.excluded_subtrees})>".format(self)
+        )
+
+    def __hash__(self) -> int:
+        if self.permitted_subtrees is not None:
+            ps: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple(
+                self.permitted_subtrees
+            )
+        else:
+            ps = None
+
+        if self.excluded_subtrees is not None:
+            es: typing.Optional[typing.Tuple[GeneralName, ...]] = tuple(
+                self.excluded_subtrees
+            )
+        else:
+            es = None
+
+        return hash((ps, es))
+
+    @property
+    def permitted_subtrees(
+        self,
+    ) -> typing.Optional[typing.List[GeneralName]]:
+        return self._permitted_subtrees
+
+    @property
+    def excluded_subtrees(
+        self,
+    ) -> typing.Optional[typing.List[GeneralName]]:
+        return self._excluded_subtrees
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class Extension(typing.Generic[ExtensionTypeVar]):
+    def __init__(
+        self, oid: ObjectIdentifier, critical: bool, value: ExtensionTypeVar
+    ) -> None:
+        if not isinstance(oid, ObjectIdentifier):
+            raise TypeError(
+                "oid argument must be an ObjectIdentifier instance."
+            )
+
+        if not isinstance(critical, bool):
+            raise TypeError("critical must be a boolean value")
+
+        self._oid = oid
+        self._critical = critical
+        self._value = value
+
+    @property
+    def oid(self) -> ObjectIdentifier:
+        return self._oid
+
+    @property
+    def critical(self) -> bool:
+        return self._critical
+
+    @property
+    def value(self) -> ExtensionTypeVar:
+        return self._value
+
+    def __repr__(self) -> str:
+        return (
+            "<Extension(oid={0.oid}, critical={0.critical}, "
+            "value={0.value})>"
+        ).format(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, Extension):
+            return NotImplemented
+
+        return (
+            self.oid == other.oid
+            and self.critical == other.critical
+            and self.value == other.value
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.oid, self.critical, self.value))
+
+
+class GeneralNames:
+    def __init__(self, general_names: typing.Iterable[GeneralName]) -> None:
+        general_names = list(general_names)
+        if not all(isinstance(x, GeneralName) for x in general_names):
+            raise TypeError(
+                "Every item in the general_names list must be an "
+                "object conforming to the GeneralName interface"
+            )
+
+        self._general_names = general_names
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names")
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[UniformResourceIdentifier],
+            typing.Type[RFC822Name],
+        ],
+    ) -> typing.List[str]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[DirectoryName],
+    ) -> typing.List[Name]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[RegisteredID],
+    ) -> typing.List[ObjectIdentifier]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[IPAddress]
+    ) -> typing.List[_IPAddressTypes]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[OtherName]
+    ) -> typing.List[OtherName]:
+        ...
+
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[DirectoryName],
+            typing.Type[IPAddress],
+            typing.Type[OtherName],
+            typing.Type[RFC822Name],
+            typing.Type[RegisteredID],
+            typing.Type[UniformResourceIdentifier],
+        ],
+    ) -> typing.Union[
+        typing.List[_IPAddressTypes],
+        typing.List[str],
+        typing.List[OtherName],
+        typing.List[Name],
+        typing.List[ObjectIdentifier],
+    ]:
+        # Return the value of each GeneralName, except for OtherName instances
+        # which we return directly because it has two important properties not
+        # just one value.
+        objs = (i for i in self if isinstance(i, type))
+        if type != OtherName:
+            return [i.value for i in objs]
+        return list(objs)
+
+    def __repr__(self) -> str:
+        return f"<GeneralNames({self._general_names})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, GeneralNames):
+            return NotImplemented
+
+        return self._general_names == other._general_names
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._general_names))
+
+
+class SubjectAlternativeName(ExtensionType):
+    oid = ExtensionOID.SUBJECT_ALTERNATIVE_NAME
+
+    def __init__(self, general_names: typing.Iterable[GeneralName]) -> None:
+        self._general_names = GeneralNames(general_names)
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names")
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[UniformResourceIdentifier],
+            typing.Type[RFC822Name],
+        ],
+    ) -> typing.List[str]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[DirectoryName],
+    ) -> typing.List[Name]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[RegisteredID],
+    ) -> typing.List[ObjectIdentifier]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[IPAddress]
+    ) -> typing.List[_IPAddressTypes]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[OtherName]
+    ) -> typing.List[OtherName]:
+        ...
+
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[DirectoryName],
+            typing.Type[IPAddress],
+            typing.Type[OtherName],
+            typing.Type[RFC822Name],
+            typing.Type[RegisteredID],
+            typing.Type[UniformResourceIdentifier],
+        ],
+    ) -> typing.Union[
+        typing.List[_IPAddressTypes],
+        typing.List[str],
+        typing.List[OtherName],
+        typing.List[Name],
+        typing.List[ObjectIdentifier],
+    ]:
+        return self._general_names.get_values_for_type(type)
+
+    def __repr__(self) -> str:
+        return f"<SubjectAlternativeName({self._general_names})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, SubjectAlternativeName):
+            return NotImplemented
+
+        return self._general_names == other._general_names
+
+    def __hash__(self) -> int:
+        return hash(self._general_names)
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class IssuerAlternativeName(ExtensionType):
+    oid = ExtensionOID.ISSUER_ALTERNATIVE_NAME
+
+    def __init__(self, general_names: typing.Iterable[GeneralName]) -> None:
+        self._general_names = GeneralNames(general_names)
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names")
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[UniformResourceIdentifier],
+            typing.Type[RFC822Name],
+        ],
+    ) -> typing.List[str]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[DirectoryName],
+    ) -> typing.List[Name]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[RegisteredID],
+    ) -> typing.List[ObjectIdentifier]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[IPAddress]
+    ) -> typing.List[_IPAddressTypes]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[OtherName]
+    ) -> typing.List[OtherName]:
+        ...
+
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[DirectoryName],
+            typing.Type[IPAddress],
+            typing.Type[OtherName],
+            typing.Type[RFC822Name],
+            typing.Type[RegisteredID],
+            typing.Type[UniformResourceIdentifier],
+        ],
+    ) -> typing.Union[
+        typing.List[_IPAddressTypes],
+        typing.List[str],
+        typing.List[OtherName],
+        typing.List[Name],
+        typing.List[ObjectIdentifier],
+    ]:
+        return self._general_names.get_values_for_type(type)
+
+    def __repr__(self) -> str:
+        return f"<IssuerAlternativeName({self._general_names})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, IssuerAlternativeName):
+            return NotImplemented
+
+        return self._general_names == other._general_names
+
+    def __hash__(self) -> int:
+        return hash(self._general_names)
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class CertificateIssuer(ExtensionType):
+    oid = CRLEntryExtensionOID.CERTIFICATE_ISSUER
+
+    def __init__(self, general_names: typing.Iterable[GeneralName]) -> None:
+        self._general_names = GeneralNames(general_names)
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods("_general_names")
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[UniformResourceIdentifier],
+            typing.Type[RFC822Name],
+        ],
+    ) -> typing.List[str]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[DirectoryName],
+    ) -> typing.List[Name]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self,
+        type: typing.Type[RegisteredID],
+    ) -> typing.List[ObjectIdentifier]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[IPAddress]
+    ) -> typing.List[_IPAddressTypes]:
+        ...
+
+    @typing.overload
+    def get_values_for_type(
+        self, type: typing.Type[OtherName]
+    ) -> typing.List[OtherName]:
+        ...
+
+    def get_values_for_type(
+        self,
+        type: typing.Union[
+            typing.Type[DNSName],
+            typing.Type[DirectoryName],
+            typing.Type[IPAddress],
+            typing.Type[OtherName],
+            typing.Type[RFC822Name],
+            typing.Type[RegisteredID],
+            typing.Type[UniformResourceIdentifier],
+        ],
+    ) -> typing.Union[
+        typing.List[_IPAddressTypes],
+        typing.List[str],
+        typing.List[OtherName],
+        typing.List[Name],
+        typing.List[ObjectIdentifier],
+    ]:
+        return self._general_names.get_values_for_type(type)
+
+    def __repr__(self) -> str:
+        return f"<CertificateIssuer({self._general_names})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, CertificateIssuer):
+            return NotImplemented
+
+        return self._general_names == other._general_names
+
+    def __hash__(self) -> int:
+        return hash(self._general_names)
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class CRLReason(ExtensionType):
+    oid = CRLEntryExtensionOID.CRL_REASON
+
+    def __init__(self, reason: ReasonFlags) -> None:
+        if not isinstance(reason, ReasonFlags):
+            raise TypeError("reason must be an element from ReasonFlags")
+
+        self._reason = reason
+
+    def __repr__(self) -> str:
+        return f"<CRLReason(reason={self._reason})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, CRLReason):
+            return NotImplemented
+
+        return self.reason == other.reason
+
+    def __hash__(self) -> int:
+        return hash(self.reason)
+
+    @property
+    def reason(self) -> ReasonFlags:
+        return self._reason
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class InvalidityDate(ExtensionType):
+    oid = CRLEntryExtensionOID.INVALIDITY_DATE
+
+    def __init__(self, invalidity_date: datetime.datetime) -> None:
+        if not isinstance(invalidity_date, datetime.datetime):
+            raise TypeError("invalidity_date must be a datetime.datetime")
+
+        self._invalidity_date = invalidity_date
+
+    def __repr__(self) -> str:
+        return "<InvalidityDate(invalidity_date={})>".format(
+            self._invalidity_date
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, InvalidityDate):
+            return NotImplemented
+
+        return self.invalidity_date == other.invalidity_date
+
+    def __hash__(self) -> int:
+        return hash(self.invalidity_date)
+
+    @property
+    def invalidity_date(self) -> datetime.datetime:
+        return self._invalidity_date
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class PrecertificateSignedCertificateTimestamps(ExtensionType):
+    oid = ExtensionOID.PRECERT_SIGNED_CERTIFICATE_TIMESTAMPS
+
+    def __init__(
+        self,
+        signed_certificate_timestamps: typing.Iterable[
+            SignedCertificateTimestamp
+        ],
+    ) -> None:
+        signed_certificate_timestamps = list(signed_certificate_timestamps)
+        if not all(
+            isinstance(sct, SignedCertificateTimestamp)
+            for sct in signed_certificate_timestamps
+        ):
+            raise TypeError(
+                "Every item in the signed_certificate_timestamps list must be "
+                "a SignedCertificateTimestamp"
+            )
+        self._signed_certificate_timestamps = signed_certificate_timestamps
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods(
+        "_signed_certificate_timestamps"
+    )
+
+    def __repr__(self) -> str:
+        return "<PrecertificateSignedCertificateTimestamps({})>".format(
+            list(self)
+        )
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._signed_certificate_timestamps))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, PrecertificateSignedCertificateTimestamps):
+            return NotImplemented
+
+        return (
+            self._signed_certificate_timestamps
+            == other._signed_certificate_timestamps
+        )
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class SignedCertificateTimestamps(ExtensionType):
+    oid = ExtensionOID.SIGNED_CERTIFICATE_TIMESTAMPS
+
+    def __init__(
+        self,
+        signed_certificate_timestamps: typing.Iterable[
+            SignedCertificateTimestamp
+        ],
+    ) -> None:
+        signed_certificate_timestamps = list(signed_certificate_timestamps)
+        if not all(
+            isinstance(sct, SignedCertificateTimestamp)
+            for sct in signed_certificate_timestamps
+        ):
+            raise TypeError(
+                "Every item in the signed_certificate_timestamps list must be "
+                "a SignedCertificateTimestamp"
+            )
+        self._signed_certificate_timestamps = signed_certificate_timestamps
+
+    __len__, __iter__, __getitem__ = _make_sequence_methods(
+        "_signed_certificate_timestamps"
+    )
+
+    def __repr__(self) -> str:
+        return f"<SignedCertificateTimestamps({list(self)})>"
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._signed_certificate_timestamps))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, SignedCertificateTimestamps):
+            return NotImplemented
+
+        return (
+            self._signed_certificate_timestamps
+            == other._signed_certificate_timestamps
+        )
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class OCSPNonce(ExtensionType):
+    oid = OCSPExtensionOID.NONCE
+
+    def __init__(self, nonce: bytes) -> None:
+        if not isinstance(nonce, bytes):
+            raise TypeError("nonce must be bytes")
+
+        self._nonce = nonce
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, OCSPNonce):
+            return NotImplemented
+
+        return self.nonce == other.nonce
+
+    def __hash__(self) -> int:
+        return hash(self.nonce)
+
+    def __repr__(self) -> str:
+        return f"<OCSPNonce(nonce={self.nonce!r})>"
+
+    @property
+    def nonce(self) -> bytes:
+        return self._nonce
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class OCSPAcceptableResponses(ExtensionType):
+    oid = OCSPExtensionOID.ACCEPTABLE_RESPONSES
+
+    def __init__(self, responses: typing.Iterable[ObjectIdentifier]) -> None:
+        responses = list(responses)
+        if any(not isinstance(r, ObjectIdentifier) for r in responses):
+            raise TypeError("All responses must be ObjectIdentifiers")
+
+        self._responses = responses
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, OCSPAcceptableResponses):
+            return NotImplemented
+
+        return self._responses == other._responses
+
+    def __hash__(self) -> int:
+        return hash(tuple(self._responses))
+
+    def __repr__(self) -> str:
+        return f"<OCSPAcceptableResponses(responses={self._responses})>"
+
+    def __iter__(self) -> typing.Iterator[ObjectIdentifier]:
+        return iter(self._responses)
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class IssuingDistributionPoint(ExtensionType):
+    oid = ExtensionOID.ISSUING_DISTRIBUTION_POINT
+
+    def __init__(
+        self,
+        full_name: typing.Optional[typing.Iterable[GeneralName]],
+        relative_name: typing.Optional[RelativeDistinguishedName],
+        only_contains_user_certs: bool,
+        only_contains_ca_certs: bool,
+        only_some_reasons: typing.Optional[typing.FrozenSet[ReasonFlags]],
+        indirect_crl: bool,
+        only_contains_attribute_certs: bool,
+    ) -> None:
+        if full_name is not None:
+            full_name = list(full_name)
+
+        if only_some_reasons and (
+            not isinstance(only_some_reasons, frozenset)
+            or not all(isinstance(x, ReasonFlags) for x in only_some_reasons)
+        ):
+            raise TypeError(
+                "only_some_reasons must be None or frozenset of ReasonFlags"
+            )
+
+        if only_some_reasons and (
+            ReasonFlags.unspecified in only_some_reasons
+            or ReasonFlags.remove_from_crl in only_some_reasons
+        ):
+            raise ValueError(
+                "unspecified and remove_from_crl are not valid reasons in an "
+                "IssuingDistributionPoint"
+            )
+
+        if not (
+            isinstance(only_contains_user_certs, bool)
+            and isinstance(only_contains_ca_certs, bool)
+            and isinstance(indirect_crl, bool)
+            and isinstance(only_contains_attribute_certs, bool)
+        ):
+            raise TypeError(
+                "only_contains_user_certs, only_contains_ca_certs, "
+                "indirect_crl and only_contains_attribute_certs "
+                "must all be boolean."
+            )
+
+        crl_constraints = [
+            only_contains_user_certs,
+            only_contains_ca_certs,
+            indirect_crl,
+            only_contains_attribute_certs,
+        ]
+
+        if len([x for x in crl_constraints if x]) > 1:
+            raise ValueError(
+                "Only one of the following can be set to True: "
+                "only_contains_user_certs, only_contains_ca_certs, "
+                "indirect_crl, only_contains_attribute_certs"
+            )
+
+        if not any(
+            [
+                only_contains_user_certs,
+                only_contains_ca_certs,
+                indirect_crl,
+                only_contains_attribute_certs,
+                full_name,
+                relative_name,
+                only_some_reasons,
+            ]
+        ):
+            raise ValueError(
+                "Cannot create empty extension: "
+                "if only_contains_user_certs, only_contains_ca_certs, "
+                "indirect_crl, and only_contains_attribute_certs are all False"
+                ", then either full_name, relative_name, or only_some_reasons "
+                "must have a value."
+            )
+
+        self._only_contains_user_certs = only_contains_user_certs
+        self._only_contains_ca_certs = only_contains_ca_certs
+        self._indirect_crl = indirect_crl
+        self._only_contains_attribute_certs = only_contains_attribute_certs
+        self._only_some_reasons = only_some_reasons
+        self._full_name = full_name
+        self._relative_name = relative_name
+
+    def __repr__(self) -> str:
+        return (
+            "<IssuingDistributionPoint(full_name={0.full_name}, "
+            "relative_name={0.relative_name}, "
+            "only_contains_user_certs={0.only_contains_user_certs}, "
+            "only_contains_ca_certs={0.only_contains_ca_certs}, "
+            "only_some_reasons={0.only_some_reasons}, "
+            "indirect_crl={0.indirect_crl}, "
+            "only_contains_attribute_certs="
+            "{0.only_contains_attribute_certs})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, IssuingDistributionPoint):
+            return NotImplemented
+
+        return (
+            self.full_name == other.full_name
+            and self.relative_name == other.relative_name
+            and self.only_contains_user_certs == other.only_contains_user_certs
+            and self.only_contains_ca_certs == other.only_contains_ca_certs
+            and self.only_some_reasons == other.only_some_reasons
+            and self.indirect_crl == other.indirect_crl
+            and self.only_contains_attribute_certs
+            == other.only_contains_attribute_certs
+        )
+
+    def __hash__(self) -> int:
+        return hash(
+            (
+                self.full_name,
+                self.relative_name,
+                self.only_contains_user_certs,
+                self.only_contains_ca_certs,
+                self.only_some_reasons,
+                self.indirect_crl,
+                self.only_contains_attribute_certs,
+            )
+        )
+
+    @property
+    def full_name(self) -> typing.Optional[typing.List[GeneralName]]:
+        return self._full_name
+
+    @property
+    def relative_name(self) -> typing.Optional[RelativeDistinguishedName]:
+        return self._relative_name
+
+    @property
+    def only_contains_user_certs(self) -> bool:
+        return self._only_contains_user_certs
+
+    @property
+    def only_contains_ca_certs(self) -> bool:
+        return self._only_contains_ca_certs
+
+    @property
+    def only_some_reasons(
+        self,
+    ) -> typing.Optional[typing.FrozenSet[ReasonFlags]]:
+        return self._only_some_reasons
+
+    @property
+    def indirect_crl(self) -> bool:
+        return self._indirect_crl
+
+    @property
+    def only_contains_attribute_certs(self) -> bool:
+        return self._only_contains_attribute_certs
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class MSCertificateTemplate(ExtensionType):
+    oid = ExtensionOID.MS_CERTIFICATE_TEMPLATE
+
+    def __init__(
+        self,
+        template_id: ObjectIdentifier,
+        major_version: typing.Optional[int],
+        minor_version: typing.Optional[int],
+    ) -> None:
+        if not isinstance(template_id, ObjectIdentifier):
+            raise TypeError("oid must be an ObjectIdentifier")
+        self._template_id = template_id
+        if (
+            major_version is not None and not isinstance(major_version, int)
+        ) or (
+            minor_version is not None and not isinstance(minor_version, int)
+        ):
+            raise TypeError(
+                "major_version and minor_version must be integers or None"
+            )
+        self._major_version = major_version
+        self._minor_version = minor_version
+
+    @property
+    def template_id(self) -> ObjectIdentifier:
+        return self._template_id
+
+    @property
+    def major_version(self) -> typing.Optional[int]:
+        return self._major_version
+
+    @property
+    def minor_version(self) -> typing.Optional[int]:
+        return self._minor_version
+
+    def __repr__(self) -> str:
+        return (
+            f"<MSCertificateTemplate(template_id={self.template_id}, "
+            f"major_version={self.major_version}, "
+            f"minor_version={self.minor_version})>"
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, MSCertificateTemplate):
+            return NotImplemented
+
+        return (
+            self.template_id == other.template_id
+            and self.major_version == other.major_version
+            and self.minor_version == other.minor_version
+        )
+
+    def __hash__(self) -> int:
+        return hash((self.template_id, self.major_version, self.minor_version))
+
+    def public_bytes(self) -> bytes:
+        return rust_x509.encode_extension_value(self)
+
+
+class UnrecognizedExtension(ExtensionType):
+    def __init__(self, oid: ObjectIdentifier, value: bytes) -> None:
+        if not isinstance(oid, ObjectIdentifier):
+            raise TypeError("oid must be an ObjectIdentifier")
+        self._oid = oid
+        self._value = value
+
+    @property
+    def oid(self) -> ObjectIdentifier:  # type: ignore[override]
+        return self._oid
+
+    @property
+    def value(self) -> bytes:
+        return self._value
+
+    def __repr__(self) -> str:
+        return (
+            "<UnrecognizedExtension(oid={0.oid}, "
+            "value={0.value!r})>".format(self)
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, UnrecognizedExtension):
+            return NotImplemented
+
+        return self.oid == other.oid and self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash((self.oid, self.value))
+
+    def public_bytes(self) -> bytes:
+        return self.value
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/general_name.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/general_name.py
new file mode 100644
index 0000000000000000000000000000000000000000..79271afbf91e5660cb34e6c189e316614a77cf61
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/general_name.py
@@ -0,0 +1,283 @@
+# 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 annotations
+
+import abc
+import ipaddress
+import typing
+from email.utils import parseaddr
+
+from cryptography.x509.name import Name
+from cryptography.x509.oid import ObjectIdentifier
+
+_IPAddressTypes = typing.Union[
+    ipaddress.IPv4Address,
+    ipaddress.IPv6Address,
+    ipaddress.IPv4Network,
+    ipaddress.IPv6Network,
+]
+
+
+class UnsupportedGeneralNameType(Exception):
+    pass
+
+
+class GeneralName(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def value(self) -> typing.Any:
+        """
+        Return the value of the object
+        """
+
+
+class RFC822Name(GeneralName):
+    def __init__(self, value: str) -> None:
+        if isinstance(value, str):
+            try:
+                value.encode("ascii")
+            except UnicodeEncodeError:
+                raise ValueError(
+                    "RFC822Name values should be passed as an A-label string. "
+                    "This means unicode characters should be encoded via "
+                    "a library like idna."
+                )
+        else:
+            raise TypeError("value must be string")
+
+        name, address = parseaddr(value)
+        if name or not address:
+            # parseaddr has found a name (e.g. Name <email>) or the entire
+            # value is an empty string.
+            raise ValueError("Invalid rfc822name value")
+
+        self._value = value
+
+    @property
+    def value(self) -> str:
+        return self._value
+
+    @classmethod
+    def _init_without_validation(cls, value: str) -> RFC822Name:
+        instance = cls.__new__(cls)
+        instance._value = value
+        return instance
+
+    def __repr__(self) -> str:
+        return f"<RFC822Name(value={self.value!r})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, RFC822Name):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class DNSName(GeneralName):
+    def __init__(self, value: str) -> None:
+        if isinstance(value, str):
+            try:
+                value.encode("ascii")
+            except UnicodeEncodeError:
+                raise ValueError(
+                    "DNSName values should be passed as an A-label string. "
+                    "This means unicode characters should be encoded via "
+                    "a library like idna."
+                )
+        else:
+            raise TypeError("value must be string")
+
+        self._value = value
+
+    @property
+    def value(self) -> str:
+        return self._value
+
+    @classmethod
+    def _init_without_validation(cls, value: str) -> DNSName:
+        instance = cls.__new__(cls)
+        instance._value = value
+        return instance
+
+    def __repr__(self) -> str:
+        return f"<DNSName(value={self.value!r})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DNSName):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class UniformResourceIdentifier(GeneralName):
+    def __init__(self, value: str) -> None:
+        if isinstance(value, str):
+            try:
+                value.encode("ascii")
+            except UnicodeEncodeError:
+                raise ValueError(
+                    "URI values should be passed as an A-label string. "
+                    "This means unicode characters should be encoded via "
+                    "a library like idna."
+                )
+        else:
+            raise TypeError("value must be string")
+
+        self._value = value
+
+    @property
+    def value(self) -> str:
+        return self._value
+
+    @classmethod
+    def _init_without_validation(cls, value: str) -> UniformResourceIdentifier:
+        instance = cls.__new__(cls)
+        instance._value = value
+        return instance
+
+    def __repr__(self) -> str:
+        return f"<UniformResourceIdentifier(value={self.value!r})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, UniformResourceIdentifier):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class DirectoryName(GeneralName):
+    def __init__(self, value: Name) -> None:
+        if not isinstance(value, Name):
+            raise TypeError("value must be a Name")
+
+        self._value = value
+
+    @property
+    def value(self) -> Name:
+        return self._value
+
+    def __repr__(self) -> str:
+        return f"<DirectoryName(value={self.value})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, DirectoryName):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class RegisteredID(GeneralName):
+    def __init__(self, value: ObjectIdentifier) -> None:
+        if not isinstance(value, ObjectIdentifier):
+            raise TypeError("value must be an ObjectIdentifier")
+
+        self._value = value
+
+    @property
+    def value(self) -> ObjectIdentifier:
+        return self._value
+
+    def __repr__(self) -> str:
+        return f"<RegisteredID(value={self.value})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, RegisteredID):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class IPAddress(GeneralName):
+    def __init__(self, value: _IPAddressTypes) -> None:
+        if not isinstance(
+            value,
+            (
+                ipaddress.IPv4Address,
+                ipaddress.IPv6Address,
+                ipaddress.IPv4Network,
+                ipaddress.IPv6Network,
+            ),
+        ):
+            raise TypeError(
+                "value must be an instance of ipaddress.IPv4Address, "
+                "ipaddress.IPv6Address, ipaddress.IPv4Network, or "
+                "ipaddress.IPv6Network"
+            )
+
+        self._value = value
+
+    @property
+    def value(self) -> _IPAddressTypes:
+        return self._value
+
+    def _packed(self) -> bytes:
+        if isinstance(
+            self.value, (ipaddress.IPv4Address, ipaddress.IPv6Address)
+        ):
+            return self.value.packed
+        else:
+            return (
+                self.value.network_address.packed + self.value.netmask.packed
+            )
+
+    def __repr__(self) -> str:
+        return f"<IPAddress(value={self.value})>"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, IPAddress):
+            return NotImplemented
+
+        return self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash(self.value)
+
+
+class OtherName(GeneralName):
+    def __init__(self, type_id: ObjectIdentifier, value: bytes) -> None:
+        if not isinstance(type_id, ObjectIdentifier):
+            raise TypeError("type_id must be an ObjectIdentifier")
+        if not isinstance(value, bytes):
+            raise TypeError("value must be a binary string")
+
+        self._type_id = type_id
+        self._value = value
+
+    @property
+    def type_id(self) -> ObjectIdentifier:
+        return self._type_id
+
+    @property
+    def value(self) -> bytes:
+        return self._value
+
+    def __repr__(self) -> str:
+        return "<OtherName(type_id={}, value={!r})>".format(
+            self.type_id, self.value
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, OtherName):
+            return NotImplemented
+
+        return self.type_id == other.type_id and self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash((self.type_id, self.value))
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/name.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/name.py
new file mode 100644
index 0000000000000000000000000000000000000000..ff98e8724af1411c3860642d7361f95f0bdeb4b0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/name.py
@@ -0,0 +1,462 @@
+# 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 annotations
+
+import binascii
+import re
+import sys
+import typing
+import warnings
+
+from cryptography import utils
+from cryptography.hazmat.bindings._rust import x509 as rust_x509
+from cryptography.x509.oid import NameOID, ObjectIdentifier
+
+
+class _ASN1Type(utils.Enum):
+    BitString = 3
+    OctetString = 4
+    UTF8String = 12
+    NumericString = 18
+    PrintableString = 19
+    T61String = 20
+    IA5String = 22
+    UTCTime = 23
+    GeneralizedTime = 24
+    VisibleString = 26
+    UniversalString = 28
+    BMPString = 30
+
+
+_ASN1_TYPE_TO_ENUM = {i.value: i for i in _ASN1Type}
+_NAMEOID_DEFAULT_TYPE: typing.Dict[ObjectIdentifier, _ASN1Type] = {
+    NameOID.COUNTRY_NAME: _ASN1Type.PrintableString,
+    NameOID.JURISDICTION_COUNTRY_NAME: _ASN1Type.PrintableString,
+    NameOID.SERIAL_NUMBER: _ASN1Type.PrintableString,
+    NameOID.DN_QUALIFIER: _ASN1Type.PrintableString,
+    NameOID.EMAIL_ADDRESS: _ASN1Type.IA5String,
+    NameOID.DOMAIN_COMPONENT: _ASN1Type.IA5String,
+}
+
+# Type alias
+_OidNameMap = typing.Mapping[ObjectIdentifier, str]
+_NameOidMap = typing.Mapping[str, ObjectIdentifier]
+
+#: Short attribute names from RFC 4514:
+#: https://tools.ietf.org/html/rfc4514#page-7
+_NAMEOID_TO_NAME: _OidNameMap = {
+    NameOID.COMMON_NAME: "CN",
+    NameOID.LOCALITY_NAME: "L",
+    NameOID.STATE_OR_PROVINCE_NAME: "ST",
+    NameOID.ORGANIZATION_NAME: "O",
+    NameOID.ORGANIZATIONAL_UNIT_NAME: "OU",
+    NameOID.COUNTRY_NAME: "C",
+    NameOID.STREET_ADDRESS: "STREET",
+    NameOID.DOMAIN_COMPONENT: "DC",
+    NameOID.USER_ID: "UID",
+}
+_NAME_TO_NAMEOID = {v: k for k, v in _NAMEOID_TO_NAME.items()}
+
+
+def _escape_dn_value(val: typing.Union[str, bytes]) -> str:
+    """Escape special characters in RFC4514 Distinguished Name value."""
+
+    if not val:
+        return ""
+
+    # RFC 4514 Section 2.4 defines the value as being the # (U+0023) character
+    # followed by the hexadecimal encoding of the octets.
+    if isinstance(val, bytes):
+        return "#" + binascii.hexlify(val).decode("utf8")
+
+    # See https://tools.ietf.org/html/rfc4514#section-2.4
+    val = val.replace("\\", "\\\\")
+    val = val.replace('"', '\\"')
+    val = val.replace("+", "\\+")
+    val = val.replace(",", "\\,")
+    val = val.replace(";", "\\;")
+    val = val.replace("<", "\\<")
+    val = val.replace(">", "\\>")
+    val = val.replace("\0", "\\00")
+
+    if val[0] in ("#", " "):
+        val = "\\" + val
+    if val[-1] == " ":
+        val = val[:-1] + "\\ "
+
+    return val
+
+
+def _unescape_dn_value(val: str) -> str:
+    if not val:
+        return ""
+
+    # See https://tools.ietf.org/html/rfc4514#section-3
+
+    # special = escaped / SPACE / SHARP / EQUALS
+    # escaped = DQUOTE / PLUS / COMMA / SEMI / LANGLE / RANGLE
+    def sub(m):
+        val = m.group(1)
+        # Regular escape
+        if len(val) == 1:
+            return val
+        # Hex-value scape
+        return chr(int(val, 16))
+
+    return _RFC4514NameParser._PAIR_RE.sub(sub, val)
+
+
+class NameAttribute:
+    def __init__(
+        self,
+        oid: ObjectIdentifier,
+        value: typing.Union[str, bytes],
+        _type: typing.Optional[_ASN1Type] = None,
+        *,
+        _validate: bool = True,
+    ) -> None:
+        if not isinstance(oid, ObjectIdentifier):
+            raise TypeError(
+                "oid argument must be an ObjectIdentifier instance."
+            )
+        if _type == _ASN1Type.BitString:
+            if oid != NameOID.X500_UNIQUE_IDENTIFIER:
+                raise TypeError(
+                    "oid must be X500_UNIQUE_IDENTIFIER for BitString type."
+                )
+            if not isinstance(value, bytes):
+                raise TypeError("value must be bytes for BitString")
+        else:
+            if not isinstance(value, str):
+                raise TypeError("value argument must be a str")
+
+        if (
+            oid == NameOID.COUNTRY_NAME
+            or oid == NameOID.JURISDICTION_COUNTRY_NAME
+        ):
+            assert isinstance(value, str)
+            c_len = len(value.encode("utf8"))
+            if c_len != 2 and _validate is True:
+                raise ValueError(
+                    "Country name must be a 2 character country code"
+                )
+            elif c_len != 2:
+                warnings.warn(
+                    "Country names should be two characters, but the "
+                    "attribute is {} characters in length.".format(c_len),
+                    stacklevel=2,
+                )
+
+        # The appropriate ASN1 string type varies by OID and is defined across
+        # multiple RFCs including 2459, 3280, and 5280. In general UTF8String
+        # is preferred (2459), but 3280 and 5280 specify several OIDs with
+        # alternate types. This means when we see the sentinel value we need
+        # to look up whether the OID has a non-UTF8 type. If it does, set it
+        # to that. Otherwise, UTF8!
+        if _type is None:
+            _type = _NAMEOID_DEFAULT_TYPE.get(oid, _ASN1Type.UTF8String)
+
+        if not isinstance(_type, _ASN1Type):
+            raise TypeError("_type must be from the _ASN1Type enum")
+
+        self._oid = oid
+        self._value = value
+        self._type = _type
+
+    @property
+    def oid(self) -> ObjectIdentifier:
+        return self._oid
+
+    @property
+    def value(self) -> typing.Union[str, bytes]:
+        return self._value
+
+    @property
+    def rfc4514_attribute_name(self) -> str:
+        """
+        The short attribute name (for example "CN") if available,
+        otherwise the OID dotted string.
+        """
+        return _NAMEOID_TO_NAME.get(self.oid, self.oid.dotted_string)
+
+    def rfc4514_string(
+        self, attr_name_overrides: typing.Optional[_OidNameMap] = None
+    ) -> str:
+        """
+        Format as RFC4514 Distinguished Name string.
+
+        Use short attribute name if available, otherwise fall back to OID
+        dotted string.
+        """
+        attr_name = (
+            attr_name_overrides.get(self.oid) if attr_name_overrides else None
+        )
+        if attr_name is None:
+            attr_name = self.rfc4514_attribute_name
+
+        return f"{attr_name}={_escape_dn_value(self.value)}"
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, NameAttribute):
+            return NotImplemented
+
+        return self.oid == other.oid and self.value == other.value
+
+    def __hash__(self) -> int:
+        return hash((self.oid, self.value))
+
+    def __repr__(self) -> str:
+        return "<NameAttribute(oid={0.oid}, value={0.value!r})>".format(self)
+
+
+class RelativeDistinguishedName:
+    def __init__(self, attributes: typing.Iterable[NameAttribute]):
+        attributes = list(attributes)
+        if not attributes:
+            raise ValueError("a relative distinguished name cannot be empty")
+        if not all(isinstance(x, NameAttribute) for x in attributes):
+            raise TypeError("attributes must be an iterable of NameAttribute")
+
+        # Keep list and frozenset to preserve attribute order where it matters
+        self._attributes = attributes
+        self._attribute_set = frozenset(attributes)
+
+        if len(self._attribute_set) != len(attributes):
+            raise ValueError("duplicate attributes are not allowed")
+
+    def get_attributes_for_oid(
+        self, oid: ObjectIdentifier
+    ) -> typing.List[NameAttribute]:
+        return [i for i in self if i.oid == oid]
+
+    def rfc4514_string(
+        self, attr_name_overrides: typing.Optional[_OidNameMap] = None
+    ) -> str:
+        """
+        Format as RFC4514 Distinguished Name string.
+
+        Within each RDN, attributes are joined by '+', although that is rarely
+        used in certificates.
+        """
+        return "+".join(
+            attr.rfc4514_string(attr_name_overrides)
+            for attr in self._attributes
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, RelativeDistinguishedName):
+            return NotImplemented
+
+        return self._attribute_set == other._attribute_set
+
+    def __hash__(self) -> int:
+        return hash(self._attribute_set)
+
+    def __iter__(self) -> typing.Iterator[NameAttribute]:
+        return iter(self._attributes)
+
+    def __len__(self) -> int:
+        return len(self._attributes)
+
+    def __repr__(self) -> str:
+        return f"<RelativeDistinguishedName({self.rfc4514_string()})>"
+
+
+class Name:
+    @typing.overload
+    def __init__(self, attributes: typing.Iterable[NameAttribute]) -> None:
+        ...
+
+    @typing.overload
+    def __init__(
+        self, attributes: typing.Iterable[RelativeDistinguishedName]
+    ) -> None:
+        ...
+
+    def __init__(
+        self,
+        attributes: typing.Iterable[
+            typing.Union[NameAttribute, RelativeDistinguishedName]
+        ],
+    ) -> None:
+        attributes = list(attributes)
+        if all(isinstance(x, NameAttribute) for x in attributes):
+            self._attributes = [
+                RelativeDistinguishedName([typing.cast(NameAttribute, x)])
+                for x in attributes
+            ]
+        elif all(isinstance(x, RelativeDistinguishedName) for x in attributes):
+            self._attributes = typing.cast(
+                typing.List[RelativeDistinguishedName], attributes
+            )
+        else:
+            raise TypeError(
+                "attributes must be a list of NameAttribute"
+                " or a list RelativeDistinguishedName"
+            )
+
+    @classmethod
+    def from_rfc4514_string(
+        cls,
+        data: str,
+        attr_name_overrides: typing.Optional[_NameOidMap] = None,
+    ) -> Name:
+        return _RFC4514NameParser(data, attr_name_overrides or {}).parse()
+
+    def rfc4514_string(
+        self, attr_name_overrides: typing.Optional[_OidNameMap] = None
+    ) -> str:
+        """
+        Format as RFC4514 Distinguished Name string.
+        For example 'CN=foobar.com,O=Foo Corp,C=US'
+
+        An X.509 name is a two-level structure: a list of sets of attributes.
+        Each list element is separated by ',' and within each list element, set
+        elements are separated by '+'. The latter is almost never used in
+        real world certificates. According to RFC4514 section 2.1 the
+        RDNSequence must be reversed when converting to string representation.
+        """
+        return ",".join(
+            attr.rfc4514_string(attr_name_overrides)
+            for attr in reversed(self._attributes)
+        )
+
+    def get_attributes_for_oid(
+        self, oid: ObjectIdentifier
+    ) -> typing.List[NameAttribute]:
+        return [i for i in self if i.oid == oid]
+
+    @property
+    def rdns(self) -> typing.List[RelativeDistinguishedName]:
+        return self._attributes
+
+    def public_bytes(self, backend: typing.Any = None) -> bytes:
+        return rust_x509.encode_name_bytes(self)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, Name):
+            return NotImplemented
+
+        return self._attributes == other._attributes
+
+    def __hash__(self) -> int:
+        # TODO: this is relatively expensive, if this looks like a bottleneck
+        # for you, consider optimizing!
+        return hash(tuple(self._attributes))
+
+    def __iter__(self) -> typing.Iterator[NameAttribute]:
+        for rdn in self._attributes:
+            for ava in rdn:
+                yield ava
+
+    def __len__(self) -> int:
+        return sum(len(rdn) for rdn in self._attributes)
+
+    def __repr__(self) -> str:
+        rdns = ",".join(attr.rfc4514_string() for attr in self._attributes)
+        return f"<Name({rdns})>"
+
+
+class _RFC4514NameParser:
+    _OID_RE = re.compile(r"(0|([1-9]\d*))(\.(0|([1-9]\d*)))+")
+    _DESCR_RE = re.compile(r"[a-zA-Z][a-zA-Z\d-]*")
+
+    _PAIR = r"\\([\\ #=\"\+,;<>]|[\da-zA-Z]{2})"
+    _PAIR_RE = re.compile(_PAIR)
+    _LUTF1 = r"[\x01-\x1f\x21\x24-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]"
+    _SUTF1 = r"[\x01-\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]"
+    _TUTF1 = r"[\x01-\x1F\x21\x23-\x2A\x2D-\x3A\x3D\x3F-\x5B\x5D-\x7F]"
+    _UTFMB = rf"[\x80-{chr(sys.maxunicode)}]"
+    _LEADCHAR = rf"{_LUTF1}|{_UTFMB}"
+    _STRINGCHAR = rf"{_SUTF1}|{_UTFMB}"
+    _TRAILCHAR = rf"{_TUTF1}|{_UTFMB}"
+    _STRING_RE = re.compile(
+        rf"""
+        (
+            ({_LEADCHAR}|{_PAIR})
+            (
+                ({_STRINGCHAR}|{_PAIR})*
+                ({_TRAILCHAR}|{_PAIR})
+            )?
+        )?
+        """,
+        re.VERBOSE,
+    )
+    _HEXSTRING_RE = re.compile(r"#([\da-zA-Z]{2})+")
+
+    def __init__(self, data: str, attr_name_overrides: _NameOidMap) -> None:
+        self._data = data
+        self._idx = 0
+
+        self._attr_name_overrides = attr_name_overrides
+
+    def _has_data(self) -> bool:
+        return self._idx < len(self._data)
+
+    def _peek(self) -> typing.Optional[str]:
+        if self._has_data():
+            return self._data[self._idx]
+        return None
+
+    def _read_char(self, ch: str) -> None:
+        if self._peek() != ch:
+            raise ValueError
+        self._idx += 1
+
+    def _read_re(self, pat) -> str:
+        match = pat.match(self._data, pos=self._idx)
+        if match is None:
+            raise ValueError
+        val = match.group()
+        self._idx += len(val)
+        return val
+
+    def parse(self) -> Name:
+        """
+        Parses the `data` string and converts it to a Name.
+
+        According to RFC4514 section 2.1 the RDNSequence must be
+        reversed when converting to string representation. So, when
+        we parse it, we need to reverse again to get the RDNs on the
+        correct order.
+        """
+        rdns = [self._parse_rdn()]
+
+        while self._has_data():
+            self._read_char(",")
+            rdns.append(self._parse_rdn())
+
+        return Name(reversed(rdns))
+
+    def _parse_rdn(self) -> RelativeDistinguishedName:
+        nas = [self._parse_na()]
+        while self._peek() == "+":
+            self._read_char("+")
+            nas.append(self._parse_na())
+
+        return RelativeDistinguishedName(nas)
+
+    def _parse_na(self) -> NameAttribute:
+        try:
+            oid_value = self._read_re(self._OID_RE)
+        except ValueError:
+            name = self._read_re(self._DESCR_RE)
+            oid = self._attr_name_overrides.get(
+                name, _NAME_TO_NAMEOID.get(name)
+            )
+            if oid is None:
+                raise ValueError
+        else:
+            oid = ObjectIdentifier(oid_value)
+
+        self._read_char("=")
+        if self._peek() == "#":
+            value = self._read_re(self._HEXSTRING_RE)
+            value = binascii.unhexlify(value[1:]).decode()
+        else:
+            raw_value = self._read_re(self._STRING_RE)
+            value = _unescape_dn_value(raw_value)
+
+        return NameAttribute(oid, value)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/ocsp.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/ocsp.py
new file mode 100644
index 0000000000000000000000000000000000000000..7054795fcda8d0c826506fc3861e11874829e4d2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/ocsp.py
@@ -0,0 +1,622 @@
+# 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 annotations
+
+import abc
+import datetime
+import typing
+
+from cryptography import utils, x509
+from cryptography.hazmat.bindings._rust import ocsp
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric.types import (
+    CertificateIssuerPrivateKeyTypes,
+)
+from cryptography.x509.base import (
+    _EARLIEST_UTC_TIME,
+    _convert_to_naive_utc_time,
+    _reject_duplicate_extension,
+)
+
+
+class OCSPResponderEncoding(utils.Enum):
+    HASH = "By Hash"
+    NAME = "By Name"
+
+
+class OCSPResponseStatus(utils.Enum):
+    SUCCESSFUL = 0
+    MALFORMED_REQUEST = 1
+    INTERNAL_ERROR = 2
+    TRY_LATER = 3
+    SIG_REQUIRED = 5
+    UNAUTHORIZED = 6
+
+
+_ALLOWED_HASHES = (
+    hashes.SHA1,
+    hashes.SHA224,
+    hashes.SHA256,
+    hashes.SHA384,
+    hashes.SHA512,
+)
+
+
+def _verify_algorithm(algorithm: hashes.HashAlgorithm) -> None:
+    if not isinstance(algorithm, _ALLOWED_HASHES):
+        raise ValueError(
+            "Algorithm must be SHA1, SHA224, SHA256, SHA384, or SHA512"
+        )
+
+
+class OCSPCertStatus(utils.Enum):
+    GOOD = 0
+    REVOKED = 1
+    UNKNOWN = 2
+
+
+class _SingleResponse:
+    def __init__(
+        self,
+        cert: x509.Certificate,
+        issuer: x509.Certificate,
+        algorithm: hashes.HashAlgorithm,
+        cert_status: OCSPCertStatus,
+        this_update: datetime.datetime,
+        next_update: typing.Optional[datetime.datetime],
+        revocation_time: typing.Optional[datetime.datetime],
+        revocation_reason: typing.Optional[x509.ReasonFlags],
+    ):
+        if not isinstance(cert, x509.Certificate) or not isinstance(
+            issuer, x509.Certificate
+        ):
+            raise TypeError("cert and issuer must be a Certificate")
+
+        _verify_algorithm(algorithm)
+        if not isinstance(this_update, datetime.datetime):
+            raise TypeError("this_update must be a datetime object")
+        if next_update is not None and not isinstance(
+            next_update, datetime.datetime
+        ):
+            raise TypeError("next_update must be a datetime object or None")
+
+        self._cert = cert
+        self._issuer = issuer
+        self._algorithm = algorithm
+        self._this_update = this_update
+        self._next_update = next_update
+
+        if not isinstance(cert_status, OCSPCertStatus):
+            raise TypeError(
+                "cert_status must be an item from the OCSPCertStatus enum"
+            )
+        if cert_status is not OCSPCertStatus.REVOKED:
+            if revocation_time is not None:
+                raise ValueError(
+                    "revocation_time can only be provided if the certificate "
+                    "is revoked"
+                )
+            if revocation_reason is not None:
+                raise ValueError(
+                    "revocation_reason can only be provided if the certificate"
+                    " is revoked"
+                )
+        else:
+            if not isinstance(revocation_time, datetime.datetime):
+                raise TypeError("revocation_time must be a datetime object")
+
+            revocation_time = _convert_to_naive_utc_time(revocation_time)
+            if revocation_time < _EARLIEST_UTC_TIME:
+                raise ValueError(
+                    "The revocation_time must be on or after"
+                    " 1950 January 1."
+                )
+
+            if revocation_reason is not None and not isinstance(
+                revocation_reason, x509.ReasonFlags
+            ):
+                raise TypeError(
+                    "revocation_reason must be an item from the ReasonFlags "
+                    "enum or None"
+                )
+
+        self._cert_status = cert_status
+        self._revocation_time = revocation_time
+        self._revocation_reason = revocation_reason
+
+
+class OCSPRequest(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def issuer_key_hash(self) -> bytes:
+        """
+        The hash of the issuer public key
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer_name_hash(self) -> bytes:
+        """
+        The hash of the issuer name
+        """
+
+    @property
+    @abc.abstractmethod
+    def hash_algorithm(self) -> hashes.HashAlgorithm:
+        """
+        The hash algorithm used in the issuer name and key hashes
+        """
+
+    @property
+    @abc.abstractmethod
+    def serial_number(self) -> int:
+        """
+        The serial number of the cert whose status is being checked
+        """
+
+    @abc.abstractmethod
+    def public_bytes(self, encoding: serialization.Encoding) -> bytes:
+        """
+        Serializes the request to DER
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> x509.Extensions:
+        """
+        The list of request extensions. Not single request extensions.
+        """
+
+
+class OCSPSingleResponse(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def certificate_status(self) -> OCSPCertStatus:
+        """
+        The status of the certificate (an element from the OCSPCertStatus enum)
+        """
+
+    @property
+    @abc.abstractmethod
+    def revocation_time(self) -> typing.Optional[datetime.datetime]:
+        """
+        The date of when the certificate was revoked or None if not
+        revoked.
+        """
+
+    @property
+    @abc.abstractmethod
+    def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]:
+        """
+        The reason the certificate was revoked or None if not specified or
+        not revoked.
+        """
+
+    @property
+    @abc.abstractmethod
+    def this_update(self) -> datetime.datetime:
+        """
+        The most recent time at which the status being indicated is known by
+        the responder to have been correct
+        """
+
+    @property
+    @abc.abstractmethod
+    def next_update(self) -> typing.Optional[datetime.datetime]:
+        """
+        The time when newer information will be available
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer_key_hash(self) -> bytes:
+        """
+        The hash of the issuer public key
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer_name_hash(self) -> bytes:
+        """
+        The hash of the issuer name
+        """
+
+    @property
+    @abc.abstractmethod
+    def hash_algorithm(self) -> hashes.HashAlgorithm:
+        """
+        The hash algorithm used in the issuer name and key hashes
+        """
+
+    @property
+    @abc.abstractmethod
+    def serial_number(self) -> int:
+        """
+        The serial number of the cert whose status is being checked
+        """
+
+
+class OCSPResponse(metaclass=abc.ABCMeta):
+    @property
+    @abc.abstractmethod
+    def responses(self) -> typing.Iterator[OCSPSingleResponse]:
+        """
+        An iterator over the individual SINGLERESP structures in the
+        response
+        """
+
+    @property
+    @abc.abstractmethod
+    def response_status(self) -> OCSPResponseStatus:
+        """
+        The status of the response. This is a value from the OCSPResponseStatus
+        enumeration
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_algorithm_oid(self) -> x509.ObjectIdentifier:
+        """
+        The ObjectIdentifier of the signature algorithm
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature_hash_algorithm(
+        self,
+    ) -> typing.Optional[hashes.HashAlgorithm]:
+        """
+        Returns a HashAlgorithm corresponding to the type of the digest signed
+        """
+
+    @property
+    @abc.abstractmethod
+    def signature(self) -> bytes:
+        """
+        The signature bytes
+        """
+
+    @property
+    @abc.abstractmethod
+    def tbs_response_bytes(self) -> bytes:
+        """
+        The tbsResponseData bytes
+        """
+
+    @property
+    @abc.abstractmethod
+    def certificates(self) -> typing.List[x509.Certificate]:
+        """
+        A list of certificates used to help build a chain to verify the OCSP
+        response. This situation occurs when the OCSP responder uses a delegate
+        certificate.
+        """
+
+    @property
+    @abc.abstractmethod
+    def responder_key_hash(self) -> typing.Optional[bytes]:
+        """
+        The responder's key hash or None
+        """
+
+    @property
+    @abc.abstractmethod
+    def responder_name(self) -> typing.Optional[x509.Name]:
+        """
+        The responder's Name or None
+        """
+
+    @property
+    @abc.abstractmethod
+    def produced_at(self) -> datetime.datetime:
+        """
+        The time the response was produced
+        """
+
+    @property
+    @abc.abstractmethod
+    def certificate_status(self) -> OCSPCertStatus:
+        """
+        The status of the certificate (an element from the OCSPCertStatus enum)
+        """
+
+    @property
+    @abc.abstractmethod
+    def revocation_time(self) -> typing.Optional[datetime.datetime]:
+        """
+        The date of when the certificate was revoked or None if not
+        revoked.
+        """
+
+    @property
+    @abc.abstractmethod
+    def revocation_reason(self) -> typing.Optional[x509.ReasonFlags]:
+        """
+        The reason the certificate was revoked or None if not specified or
+        not revoked.
+        """
+
+    @property
+    @abc.abstractmethod
+    def this_update(self) -> datetime.datetime:
+        """
+        The most recent time at which the status being indicated is known by
+        the responder to have been correct
+        """
+
+    @property
+    @abc.abstractmethod
+    def next_update(self) -> typing.Optional[datetime.datetime]:
+        """
+        The time when newer information will be available
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer_key_hash(self) -> bytes:
+        """
+        The hash of the issuer public key
+        """
+
+    @property
+    @abc.abstractmethod
+    def issuer_name_hash(self) -> bytes:
+        """
+        The hash of the issuer name
+        """
+
+    @property
+    @abc.abstractmethod
+    def hash_algorithm(self) -> hashes.HashAlgorithm:
+        """
+        The hash algorithm used in the issuer name and key hashes
+        """
+
+    @property
+    @abc.abstractmethod
+    def serial_number(self) -> int:
+        """
+        The serial number of the cert whose status is being checked
+        """
+
+    @property
+    @abc.abstractmethod
+    def extensions(self) -> x509.Extensions:
+        """
+        The list of response extensions. Not single response extensions.
+        """
+
+    @property
+    @abc.abstractmethod
+    def single_extensions(self) -> x509.Extensions:
+        """
+        The list of single response extensions. Not response extensions.
+        """
+
+    @abc.abstractmethod
+    def public_bytes(self, encoding: serialization.Encoding) -> bytes:
+        """
+        Serializes the response to DER
+        """
+
+
+class OCSPRequestBuilder:
+    def __init__(
+        self,
+        request: typing.Optional[
+            typing.Tuple[
+                x509.Certificate, x509.Certificate, hashes.HashAlgorithm
+            ]
+        ] = None,
+        request_hash: typing.Optional[
+            typing.Tuple[bytes, bytes, int, hashes.HashAlgorithm]
+        ] = None,
+        extensions: typing.List[x509.Extension[x509.ExtensionType]] = [],
+    ) -> None:
+        self._request = request
+        self._request_hash = request_hash
+        self._extensions = extensions
+
+    def add_certificate(
+        self,
+        cert: x509.Certificate,
+        issuer: x509.Certificate,
+        algorithm: hashes.HashAlgorithm,
+    ) -> OCSPRequestBuilder:
+        if self._request is not None or self._request_hash is not None:
+            raise ValueError("Only one certificate can be added to a request")
+
+        _verify_algorithm(algorithm)
+        if not isinstance(cert, x509.Certificate) or not isinstance(
+            issuer, x509.Certificate
+        ):
+            raise TypeError("cert and issuer must be a Certificate")
+
+        return OCSPRequestBuilder(
+            (cert, issuer, algorithm), self._request_hash, self._extensions
+        )
+
+    def add_certificate_by_hash(
+        self,
+        issuer_name_hash: bytes,
+        issuer_key_hash: bytes,
+        serial_number: int,
+        algorithm: hashes.HashAlgorithm,
+    ) -> OCSPRequestBuilder:
+        if self._request is not None or self._request_hash is not None:
+            raise ValueError("Only one certificate can be added to a request")
+
+        if not isinstance(serial_number, int):
+            raise TypeError("serial_number must be an integer")
+
+        _verify_algorithm(algorithm)
+        utils._check_bytes("issuer_name_hash", issuer_name_hash)
+        utils._check_bytes("issuer_key_hash", issuer_key_hash)
+        if algorithm.digest_size != len(
+            issuer_name_hash
+        ) or algorithm.digest_size != len(issuer_key_hash):
+            raise ValueError(
+                "issuer_name_hash and issuer_key_hash must be the same length "
+                "as the digest size of the algorithm"
+            )
+
+        return OCSPRequestBuilder(
+            self._request,
+            (issuer_name_hash, issuer_key_hash, serial_number, algorithm),
+            self._extensions,
+        )
+
+    def add_extension(
+        self, extval: x509.ExtensionType, critical: bool
+    ) -> OCSPRequestBuilder:
+        if not isinstance(extval, x509.ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = x509.Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+
+        return OCSPRequestBuilder(
+            self._request, self._request_hash, self._extensions + [extension]
+        )
+
+    def build(self) -> OCSPRequest:
+        if self._request is None and self._request_hash is None:
+            raise ValueError("You must add a certificate before building")
+
+        return ocsp.create_ocsp_request(self)
+
+
+class OCSPResponseBuilder:
+    def __init__(
+        self,
+        response: typing.Optional[_SingleResponse] = None,
+        responder_id: typing.Optional[
+            typing.Tuple[x509.Certificate, OCSPResponderEncoding]
+        ] = None,
+        certs: typing.Optional[typing.List[x509.Certificate]] = None,
+        extensions: typing.List[x509.Extension[x509.ExtensionType]] = [],
+    ):
+        self._response = response
+        self._responder_id = responder_id
+        self._certs = certs
+        self._extensions = extensions
+
+    def add_response(
+        self,
+        cert: x509.Certificate,
+        issuer: x509.Certificate,
+        algorithm: hashes.HashAlgorithm,
+        cert_status: OCSPCertStatus,
+        this_update: datetime.datetime,
+        next_update: typing.Optional[datetime.datetime],
+        revocation_time: typing.Optional[datetime.datetime],
+        revocation_reason: typing.Optional[x509.ReasonFlags],
+    ) -> OCSPResponseBuilder:
+        if self._response is not None:
+            raise ValueError("Only one response per OCSPResponse.")
+
+        singleresp = _SingleResponse(
+            cert,
+            issuer,
+            algorithm,
+            cert_status,
+            this_update,
+            next_update,
+            revocation_time,
+            revocation_reason,
+        )
+        return OCSPResponseBuilder(
+            singleresp,
+            self._responder_id,
+            self._certs,
+            self._extensions,
+        )
+
+    def responder_id(
+        self, encoding: OCSPResponderEncoding, responder_cert: x509.Certificate
+    ) -> OCSPResponseBuilder:
+        if self._responder_id is not None:
+            raise ValueError("responder_id can only be set once")
+        if not isinstance(responder_cert, x509.Certificate):
+            raise TypeError("responder_cert must be a Certificate")
+        if not isinstance(encoding, OCSPResponderEncoding):
+            raise TypeError(
+                "encoding must be an element from OCSPResponderEncoding"
+            )
+
+        return OCSPResponseBuilder(
+            self._response,
+            (responder_cert, encoding),
+            self._certs,
+            self._extensions,
+        )
+
+    def certificates(
+        self, certs: typing.Iterable[x509.Certificate]
+    ) -> OCSPResponseBuilder:
+        if self._certs is not None:
+            raise ValueError("certificates may only be set once")
+        certs = list(certs)
+        if len(certs) == 0:
+            raise ValueError("certs must not be an empty list")
+        if not all(isinstance(x, x509.Certificate) for x in certs):
+            raise TypeError("certs must be a list of Certificates")
+        return OCSPResponseBuilder(
+            self._response,
+            self._responder_id,
+            certs,
+            self._extensions,
+        )
+
+    def add_extension(
+        self, extval: x509.ExtensionType, critical: bool
+    ) -> OCSPResponseBuilder:
+        if not isinstance(extval, x509.ExtensionType):
+            raise TypeError("extension must be an ExtensionType")
+
+        extension = x509.Extension(extval.oid, critical, extval)
+        _reject_duplicate_extension(extension, self._extensions)
+
+        return OCSPResponseBuilder(
+            self._response,
+            self._responder_id,
+            self._certs,
+            self._extensions + [extension],
+        )
+
+    def sign(
+        self,
+        private_key: CertificateIssuerPrivateKeyTypes,
+        algorithm: typing.Optional[hashes.HashAlgorithm],
+    ) -> OCSPResponse:
+        if self._response is None:
+            raise ValueError("You must add a response before signing")
+        if self._responder_id is None:
+            raise ValueError("You must add a responder_id before signing")
+
+        return ocsp.create_ocsp_response(
+            OCSPResponseStatus.SUCCESSFUL, self, private_key, algorithm
+        )
+
+    @classmethod
+    def build_unsuccessful(
+        cls, response_status: OCSPResponseStatus
+    ) -> OCSPResponse:
+        if not isinstance(response_status, OCSPResponseStatus):
+            raise TypeError(
+                "response_status must be an item from OCSPResponseStatus"
+            )
+        if response_status is OCSPResponseStatus.SUCCESSFUL:
+            raise ValueError("response_status cannot be SUCCESSFUL")
+
+        return ocsp.create_ocsp_response(response_status, None, None, None)
+
+
+def load_der_ocsp_request(data: bytes) -> OCSPRequest:
+    return ocsp.load_der_ocsp_request(data)
+
+
+def load_der_ocsp_response(data: bytes) -> OCSPResponse:
+    return ocsp.load_der_ocsp_response(data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/oid.py b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/oid.py
new file mode 100644
index 0000000000000000000000000000000000000000..cda50cced5c418de1820f5acb25178a62a1ede4a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/cryptography/x509/oid.py
@@ -0,0 +1,33 @@
+# 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 annotations
+
+from cryptography.hazmat._oid import (
+    AttributeOID,
+    AuthorityInformationAccessOID,
+    CertificatePoliciesOID,
+    CRLEntryExtensionOID,
+    ExtendedKeyUsageOID,
+    ExtensionOID,
+    NameOID,
+    ObjectIdentifier,
+    OCSPExtensionOID,
+    SignatureAlgorithmOID,
+    SubjectInformationAccessOID,
+)
+
+__all__ = [
+    "AttributeOID",
+    "AuthorityInformationAccessOID",
+    "CRLEntryExtensionOID",
+    "CertificatePoliciesOID",
+    "ExtendedKeyUsageOID",
+    "ExtensionOID",
+    "NameOID",
+    "OCSPExtensionOID",
+    "ObjectIdentifier",
+    "SignatureAlgorithmOID",
+    "SubjectInformationAccessOID",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/LICENSE.txt b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..b0ade0487e9e9eb252d9f8032bbe6b1c37abfb36
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/LICENSE.txt
@@ -0,0 +1,26 @@
+Copyright (c) 2005-2018, Michele Simionato
+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 bytecode 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
+HOLDERS 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/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..df407f8057f14a5a8eb7bdb1bd4a00412f546a9f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/METADATA
@@ -0,0 +1,127 @@
+Metadata-Version: 2.1
+Name: decorator
+Version: 5.1.1
+Summary: Decorators for Humans
+Home-page: https://github.com/micheles/decorator
+Author: Michele Simionato
+Author-email: michele.simionato@gmail.com
+License: new BSD License
+Keywords: decorators generic utility
+Platform: All
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Natural Language :: English
+Classifier: Operating System :: OS Independent
+Classifier: Programming Language :: Python
+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 :: Implementation :: CPython
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Utilities
+Requires-Python: >=3.5
+
+Decorators for Humans
+=====================
+
+The goal of the decorator module is to make it easy to define
+signature-preserving function decorators and decorator factories.
+It also includes an implementation of multiple dispatch and other niceties
+(please check the docs). It is released under a two-clauses
+BSD license, i.e. basically you can do whatever you want with it but I am not
+responsible.
+
+Installation
+-------------
+
+If you are lazy, just perform
+
+ ``$ pip install decorator``
+
+which will install just the module on your system.
+
+If you prefer to install the full distribution from source, including
+the documentation, clone the `GitHub repo`_ or download the tarball_, unpack it and run
+
+ ``$ pip install .``
+
+in the main directory, possibly as superuser.
+
+.. _tarball: https://pypi.org/project/decorator/#files
+.. _GitHub repo: https://github.com/micheles/decorator
+
+Testing
+--------
+
+If you have the source code installation you can run the tests with
+
+ `$ python src/tests/test.py -v`
+
+or (if you have setuptools installed)
+
+ `$ python setup.py test`
+
+Notice that you may run into trouble if in your system there
+is an older version of the decorator module; in such a case remove the
+old version. It is safe even to copy the module `decorator.py` over
+an existing one, since we kept backward-compatibility for a long time.
+
+Repository
+---------------
+
+The project is hosted on GitHub. You can look at the source here:
+
+ https://github.com/micheles/decorator
+
+Documentation
+---------------
+
+The documentation has been moved to https://github.com/micheles/decorator/blob/master/docs/documentation.md
+
+From there you can get a PDF version by simply using the print
+functionality of your browser.
+
+Here is the documentation for previous versions of the module:
+
+https://github.com/micheles/decorator/blob/4.3.2/docs/tests.documentation.rst
+https://github.com/micheles/decorator/blob/4.2.1/docs/tests.documentation.rst
+https://github.com/micheles/decorator/blob/4.1.2/docs/tests.documentation.rst
+https://github.com/micheles/decorator/blob/4.0.0/documentation.rst
+https://github.com/micheles/decorator/blob/3.4.2/documentation.rst
+
+For the impatient
+-----------------
+
+Here is an example of how to define a family of decorators tracing slow
+operations:
+
+.. code-block:: python
+
+   from decorator import decorator
+
+   @decorator
+   def warn_slow(func, timelimit=60, *args, **kw):
+       t0 = time.time()
+       result = func(*args, **kw)
+       dt = time.time() - t0
+       if dt > timelimit:
+           logging.warn('%s took %d seconds', func.__name__, dt)
+       else:
+           logging.info('%s took %d seconds', func.__name__, dt)
+       return result
+
+   @warn_slow  # warn if it takes more than 1 minute
+   def preprocess_input_files(inputdir, tempdir):
+       ...
+
+   @warn_slow(timelimit=600)  # warn if it takes more than 10 minutes
+   def run_calculation(tempdir, outdir):
+       ...
+
+Enjoy!
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..798cb041ca3e72e1247a0bf15bc6205cfa04a44f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/RECORD
@@ -0,0 +1,9 @@
+__pycache__/decorator.cpython-39.pyc,,
+decorator-5.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+decorator-5.1.1.dist-info/LICENSE.txt,sha256=_RFmDKvwUyCCxFcGhi-vwpSQfsf44heBgkCkmZgGeC4,1309
+decorator-5.1.1.dist-info/METADATA,sha256=XAr2zbYpRxCkcPbsmg1oaiS5ea7mhTq-j-wb0XjuVho,3955
+decorator-5.1.1.dist-info/RECORD,,
+decorator-5.1.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92
+decorator-5.1.1.dist-info/pbr.json,sha256=AL84oUUWQHwkd8OCPhLRo2NJjU5MDdmXMqRHv-posqs,47
+decorator-5.1.1.dist-info/top_level.txt,sha256=Kn6eQjo83ctWxXVyBMOYt0_YpjRjBznKYVuNyuC_DSI,10
+decorator.py,sha256=el5cAEgoTEpRQN65tOxGhElue-CccMv0xol-J2MwOc0,16752
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..5bad85fdc1cd08553756d0fb2c7be8b5ad6af7fb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.37.0)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/pbr.json b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/pbr.json
new file mode 100644
index 0000000000000000000000000000000000000000..cd04599789742039ac2f3b2b5cd60ce7a6d81c71
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/pbr.json
@@ -0,0 +1 @@
+{"is_release": false, "git_version": "8608a46"}
\ No newline at end of file
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..3fe18a4d1c20592171597e32e7f633bc61fff1ed
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator-5.1.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+decorator
diff --git a/TP03/TP03/lib/python3.9/site-packages/decorator.py b/TP03/TP03/lib/python3.9/site-packages/decorator.py
new file mode 100644
index 0000000000000000000000000000000000000000..2479b6f7ba723b933978d10a6f80e28f60c3c1c6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/decorator.py
@@ -0,0 +1,451 @@
+# #########################     LICENSE     ############################ #
+
+# Copyright (c) 2005-2021, Michele Simionato
+# 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 bytecode 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
+# HOLDERS 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.
+
+"""
+Decorator module, see
+https://github.com/micheles/decorator/blob/master/docs/documentation.md
+for the documentation.
+"""
+import re
+import sys
+import inspect
+import operator
+import itertools
+from contextlib import _GeneratorContextManager
+from inspect import getfullargspec, iscoroutinefunction, isgeneratorfunction
+
+__version__ = '5.1.1'
+
+DEF = re.compile(r'\s*def\s*([_\w][_\w\d]*)\s*\(')
+POS = inspect.Parameter.POSITIONAL_OR_KEYWORD
+EMPTY = inspect.Parameter.empty
+
+
+# this is not used anymore in the core, but kept for backward compatibility
+class FunctionMaker(object):
+    """
+    An object with the ability to create functions with a given signature.
+    It has attributes name, doc, module, signature, defaults, dict and
+    methods update and make.
+    """
+
+    # Atomic get-and-increment provided by the GIL
+    _compile_count = itertools.count()
+
+    # make pylint happy
+    args = varargs = varkw = defaults = kwonlyargs = kwonlydefaults = ()
+
+    def __init__(self, func=None, name=None, signature=None,
+                 defaults=None, doc=None, module=None, funcdict=None):
+        self.shortsignature = signature
+        if func:
+            # func can be a class or a callable, but not an instance method
+            self.name = func.__name__
+            if self.name == '<lambda>':  # small hack for lambda functions
+                self.name = '_lambda_'
+            self.doc = func.__doc__
+            self.module = func.__module__
+            if inspect.isroutine(func):
+                argspec = getfullargspec(func)
+                self.annotations = getattr(func, '__annotations__', {})
+                for a in ('args', 'varargs', 'varkw', 'defaults', 'kwonlyargs',
+                          'kwonlydefaults'):
+                    setattr(self, a, getattr(argspec, a))
+                for i, arg in enumerate(self.args):
+                    setattr(self, 'arg%d' % i, arg)
+                allargs = list(self.args)
+                allshortargs = list(self.args)
+                if self.varargs:
+                    allargs.append('*' + self.varargs)
+                    allshortargs.append('*' + self.varargs)
+                elif self.kwonlyargs:
+                    allargs.append('*')  # single star syntax
+                for a in self.kwonlyargs:
+                    allargs.append('%s=None' % a)
+                    allshortargs.append('%s=%s' % (a, a))
+                if self.varkw:
+                    allargs.append('**' + self.varkw)
+                    allshortargs.append('**' + self.varkw)
+                self.signature = ', '.join(allargs)
+                self.shortsignature = ', '.join(allshortargs)
+                self.dict = func.__dict__.copy()
+        # func=None happens when decorating a caller
+        if name:
+            self.name = name
+        if signature is not None:
+            self.signature = signature
+        if defaults:
+            self.defaults = defaults
+        if doc:
+            self.doc = doc
+        if module:
+            self.module = module
+        if funcdict:
+            self.dict = funcdict
+        # check existence required attributes
+        assert hasattr(self, 'name')
+        if not hasattr(self, 'signature'):
+            raise TypeError('You are decorating a non function: %s' % func)
+
+    def update(self, func, **kw):
+        """
+        Update the signature of func with the data in self
+        """
+        func.__name__ = self.name
+        func.__doc__ = getattr(self, 'doc', None)
+        func.__dict__ = getattr(self, 'dict', {})
+        func.__defaults__ = self.defaults
+        func.__kwdefaults__ = self.kwonlydefaults or None
+        func.__annotations__ = getattr(self, 'annotations', None)
+        try:
+            frame = sys._getframe(3)
+        except AttributeError:  # for IronPython and similar implementations
+            callermodule = '?'
+        else:
+            callermodule = frame.f_globals.get('__name__', '?')
+        func.__module__ = getattr(self, 'module', callermodule)
+        func.__dict__.update(kw)
+
+    def make(self, src_templ, evaldict=None, addsource=False, **attrs):
+        """
+        Make a new function from a given template and update the signature
+        """
+        src = src_templ % vars(self)  # expand name and signature
+        evaldict = evaldict or {}
+        mo = DEF.search(src)
+        if mo is None:
+            raise SyntaxError('not a valid function template\n%s' % src)
+        name = mo.group(1)  # extract the function name
+        names = set([name] + [arg.strip(' *') for arg in
+                              self.shortsignature.split(',')])
+        for n in names:
+            if n in ('_func_', '_call_'):
+                raise NameError('%s is overridden in\n%s' % (n, src))
+
+        if not src.endswith('\n'):  # add a newline for old Pythons
+            src += '\n'
+
+        # Ensure each generated function has a unique filename for profilers
+        # (such as cProfile) that depend on the tuple of (<filename>,
+        # <definition line>, <function name>) being unique.
+        filename = '<decorator-gen-%d>' % next(self._compile_count)
+        try:
+            code = compile(src, filename, 'single')
+            exec(code, evaldict)
+        except Exception:
+            print('Error in generated code:', file=sys.stderr)
+            print(src, file=sys.stderr)
+            raise
+        func = evaldict[name]
+        if addsource:
+            attrs['__source__'] = src
+        self.update(func, **attrs)
+        return func
+
+    @classmethod
+    def create(cls, obj, body, evaldict, defaults=None,
+               doc=None, module=None, addsource=True, **attrs):
+        """
+        Create a function from the strings name, signature and body.
+        evaldict is the evaluation dictionary. If addsource is true an
+        attribute __source__ is added to the result. The attributes attrs
+        are added, if any.
+        """
+        if isinstance(obj, str):  # "name(signature)"
+            name, rest = obj.strip().split('(', 1)
+            signature = rest[:-1]  # strip a right parens
+            func = None
+        else:  # a function
+            name = None
+            signature = None
+            func = obj
+        self = cls(func, name, signature, defaults, doc, module)
+        ibody = '\n'.join('    ' + line for line in body.splitlines())
+        caller = evaldict.get('_call_')  # when called from `decorate`
+        if caller and iscoroutinefunction(caller):
+            body = ('async def %(name)s(%(signature)s):\n' + ibody).replace(
+                'return', 'return await')
+        else:
+            body = 'def %(name)s(%(signature)s):\n' + ibody
+        return self.make(body, evaldict, addsource, **attrs)
+
+
+def fix(args, kwargs, sig):
+    """
+    Fix args and kwargs to be consistent with the signature
+    """
+    ba = sig.bind(*args, **kwargs)
+    ba.apply_defaults()  # needed for test_dan_schult
+    return ba.args, ba.kwargs
+
+
+def decorate(func, caller, extras=(), kwsyntax=False):
+    """
+    Decorates a function/generator/coroutine using a caller.
+    If kwsyntax is True calling the decorated functions with keyword
+    syntax will pass the named arguments inside the ``kw`` dictionary,
+    even if such argument are positional, similarly to what functools.wraps
+    does. By default kwsyntax is False and the the arguments are untouched.
+    """
+    sig = inspect.signature(func)
+    if iscoroutinefunction(caller):
+        async def fun(*args, **kw):
+            if not kwsyntax:
+                args, kw = fix(args, kw, sig)
+            return await caller(func, *(extras + args), **kw)
+    elif isgeneratorfunction(caller):
+        def fun(*args, **kw):
+            if not kwsyntax:
+                args, kw = fix(args, kw, sig)
+            for res in caller(func, *(extras + args), **kw):
+                yield res
+    else:
+        def fun(*args, **kw):
+            if not kwsyntax:
+                args, kw = fix(args, kw, sig)
+            return caller(func, *(extras + args), **kw)
+    fun.__name__ = func.__name__
+    fun.__doc__ = func.__doc__
+    fun.__wrapped__ = func
+    fun.__signature__ = sig
+    fun.__qualname__ = func.__qualname__
+    # builtin functions like defaultdict.__setitem__ lack many attributes
+    try:
+        fun.__defaults__ = func.__defaults__
+    except AttributeError:
+        pass
+    try:
+        fun.__kwdefaults__ = func.__kwdefaults__
+    except AttributeError:
+        pass
+    try:
+        fun.__annotations__ = func.__annotations__
+    except AttributeError:
+        pass
+    try:
+        fun.__module__ = func.__module__
+    except AttributeError:
+        pass
+    try:
+        fun.__dict__.update(func.__dict__)
+    except AttributeError:
+        pass
+    return fun
+
+
+def decoratorx(caller):
+    """
+    A version of "decorator" implemented via "exec" and not via the
+    Signature object. Use this if you are want to preserve the `.__code__`
+    object properties (https://github.com/micheles/decorator/issues/129).
+    """
+    def dec(func):
+        return FunctionMaker.create(
+            func,
+            "return _call_(_func_, %(shortsignature)s)",
+            dict(_call_=caller, _func_=func),
+            __wrapped__=func, __qualname__=func.__qualname__)
+    return dec
+
+
+def decorator(caller, _func=None, kwsyntax=False):
+    """
+    decorator(caller) converts a caller function into a decorator
+    """
+    if _func is not None:  # return a decorated function
+        # this is obsolete behavior; you should use decorate instead
+        return decorate(_func, caller, (), kwsyntax)
+    # else return a decorator function
+    sig = inspect.signature(caller)
+    dec_params = [p for p in sig.parameters.values() if p.kind is POS]
+
+    def dec(func=None, *args, **kw):
+        na = len(args) + 1
+        extras = args + tuple(kw.get(p.name, p.default)
+                              for p in dec_params[na:]
+                              if p.default is not EMPTY)
+        if func is None:
+            return lambda func: decorate(func, caller, extras, kwsyntax)
+        else:
+            return decorate(func, caller, extras, kwsyntax)
+    dec.__signature__ = sig.replace(parameters=dec_params)
+    dec.__name__ = caller.__name__
+    dec.__doc__ = caller.__doc__
+    dec.__wrapped__ = caller
+    dec.__qualname__ = caller.__qualname__
+    dec.__kwdefaults__ = getattr(caller, '__kwdefaults__', None)
+    dec.__dict__.update(caller.__dict__)
+    return dec
+
+
+# ####################### contextmanager ####################### #
+
+
+class ContextManager(_GeneratorContextManager):
+    def __init__(self, g, *a, **k):
+        _GeneratorContextManager.__init__(self, g, a, k)
+
+    def __call__(self, func):
+        def caller(f, *a, **k):
+            with self.__class__(self.func, *self.args, **self.kwds):
+                return f(*a, **k)
+        return decorate(func, caller)
+
+
+_contextmanager = decorator(ContextManager)
+
+
+def contextmanager(func):
+    # Enable Pylint config: contextmanager-decorators=decorator.contextmanager
+    return _contextmanager(func)
+
+
+# ############################ dispatch_on ############################ #
+
+def append(a, vancestors):
+    """
+    Append ``a`` to the list of the virtual ancestors, unless it is already
+    included.
+    """
+    add = True
+    for j, va in enumerate(vancestors):
+        if issubclass(va, a):
+            add = False
+            break
+        if issubclass(a, va):
+            vancestors[j] = a
+            add = False
+    if add:
+        vancestors.append(a)
+
+
+# inspired from simplegeneric by P.J. Eby and functools.singledispatch
+def dispatch_on(*dispatch_args):
+    """
+    Factory of decorators turning a function into a generic function
+    dispatching on the given arguments.
+    """
+    assert dispatch_args, 'No dispatch args passed'
+    dispatch_str = '(%s,)' % ', '.join(dispatch_args)
+
+    def check(arguments, wrong=operator.ne, msg=''):
+        """Make sure one passes the expected number of arguments"""
+        if wrong(len(arguments), len(dispatch_args)):
+            raise TypeError('Expected %d arguments, got %d%s' %
+                            (len(dispatch_args), len(arguments), msg))
+
+    def gen_func_dec(func):
+        """Decorator turning a function into a generic function"""
+
+        # first check the dispatch arguments
+        argset = set(getfullargspec(func).args)
+        if not set(dispatch_args) <= argset:
+            raise NameError('Unknown dispatch arguments %s' % dispatch_str)
+
+        typemap = {}
+
+        def vancestors(*types):
+            """
+            Get a list of sets of virtual ancestors for the given types
+            """
+            check(types)
+            ras = [[] for _ in range(len(dispatch_args))]
+            for types_ in typemap:
+                for t, type_, ra in zip(types, types_, ras):
+                    if issubclass(t, type_) and type_ not in t.mro():
+                        append(type_, ra)
+            return [set(ra) for ra in ras]
+
+        def ancestors(*types):
+            """
+            Get a list of virtual MROs, one for each type
+            """
+            check(types)
+            lists = []
+            for t, vas in zip(types, vancestors(*types)):
+                n_vas = len(vas)
+                if n_vas > 1:
+                    raise RuntimeError(
+                        'Ambiguous dispatch for %s: %s' % (t, vas))
+                elif n_vas == 1:
+                    va, = vas
+                    mro = type('t', (t, va), {}).mro()[1:]
+                else:
+                    mro = t.mro()
+                lists.append(mro[:-1])  # discard t and object
+            return lists
+
+        def register(*types):
+            """
+            Decorator to register an implementation for the given types
+            """
+            check(types)
+
+            def dec(f):
+                check(getfullargspec(f).args, operator.lt, ' in ' + f.__name__)
+                typemap[types] = f
+                return f
+            return dec
+
+        def dispatch_info(*types):
+            """
+            An utility to introspect the dispatch algorithm
+            """
+            check(types)
+            lst = []
+            for anc in itertools.product(*ancestors(*types)):
+                lst.append(tuple(a.__name__ for a in anc))
+            return lst
+
+        def _dispatch(dispatch_args, *args, **kw):
+            types = tuple(type(arg) for arg in dispatch_args)
+            try:  # fast path
+                f = typemap[types]
+            except KeyError:
+                pass
+            else:
+                return f(*args, **kw)
+            combinations = itertools.product(*ancestors(*types))
+            next(combinations)  # the first one has been already tried
+            for types_ in combinations:
+                f = typemap.get(types_)
+                if f is not None:
+                    return f(*args, **kw)
+
+            # else call the default implementation
+            return func(*args, **kw)
+
+        return FunctionMaker.create(
+            func, 'return _f_(%s, %%(shortsignature)s)' % dispatch_str,
+            dict(_f_=_dispatch), register=register, default=func,
+            typemap=typemap, vancestors=vancestors, ancestors=ancestors,
+            dispatch_info=dispatch_info, __wrapped__=func)
+
+    gen_func_dec.__name__ = 'dispatch_on' + dispatch_str
+    return gen_func_dec
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/__init__.py b/TP03/TP03/lib/python3.9/site-packages/deprecated/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c554dbfc2a9fec6e680e9315a1a8e137e12b95e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/deprecated/__init__.py
@@ -0,0 +1,15 @@
+# -*- coding: utf-8 -*-
+"""
+Deprecated Library
+==================
+
+Python ``@deprecated`` decorator to deprecate old python classes, functions or methods.
+
+"""
+
+__version__ = "1.2.14"
+__author__ = u"Laurent LAPORTE <tantale.solutions@gmail.com>"
+__date__ = "unreleased"
+__credits__ = "(c) Laurent LAPORTE"
+
+from deprecated.classic import deprecated
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..50016e6918cf271c357418aa80e8f0b81324f032
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/classic.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/classic.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bbac2565c9d5b986d03ce0fe7e0bcd7bff2a9b0a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/classic.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/sphinx.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/sphinx.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a5e4578b1fe6fe1addbfb952c03c280f9aac395a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/deprecated/__pycache__/sphinx.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/classic.py b/TP03/TP03/lib/python3.9/site-packages/deprecated/classic.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ca3f27854ff5aba9aa7dcdc3ba1c65b78e62959
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/deprecated/classic.py
@@ -0,0 +1,292 @@
+# -*- coding: utf-8 -*-
+"""
+Classic deprecation warning
+===========================
+
+Classic ``@deprecated`` decorator to deprecate old python classes, functions or methods.
+
+.. _The Warnings Filter: https://docs.python.org/3/library/warnings.html#the-warnings-filter
+"""
+import functools
+import inspect
+import platform
+import warnings
+
+import wrapt
+
+try:
+    # If the C extension for wrapt was compiled and wrapt/_wrappers.pyd exists, then the
+    # stack level that should be passed to warnings.warn should be 2. However, if using
+    # a pure python wrapt, a extra stacklevel is required.
+    import wrapt._wrappers
+
+    _routine_stacklevel = 2
+    _class_stacklevel = 2
+except ImportError:
+    _routine_stacklevel = 3
+    if platform.python_implementation() == "PyPy":
+        _class_stacklevel = 2
+    else:
+        _class_stacklevel = 3
+
+string_types = (type(b''), type(u''))
+
+
+class ClassicAdapter(wrapt.AdapterFactory):
+    """
+    Classic adapter -- *for advanced usage only*
+
+    This adapter is used to get the deprecation message according to the wrapped object type:
+    class, function, standard method, static method, or class method.
+
+    This is the base class of the :class:`~deprecated.sphinx.SphinxAdapter` class
+    which is used to update the wrapped object docstring.
+
+    You can also inherit this class to change the deprecation message.
+
+    In the following example, we change the message into "The ... is deprecated.":
+
+    .. code-block:: python
+
+       import inspect
+
+       from deprecated.classic import ClassicAdapter
+       from deprecated.classic import deprecated
+
+
+       class MyClassicAdapter(ClassicAdapter):
+           def get_deprecated_msg(self, wrapped, instance):
+               if instance is None:
+                   if inspect.isclass(wrapped):
+                       fmt = "The class {name} is deprecated."
+                   else:
+                       fmt = "The function {name} is deprecated."
+               else:
+                   if inspect.isclass(instance):
+                       fmt = "The class method {name} is deprecated."
+                   else:
+                       fmt = "The method {name} is deprecated."
+               if self.reason:
+                   fmt += " ({reason})"
+               if self.version:
+                   fmt += " -- Deprecated since version {version}."
+               return fmt.format(name=wrapped.__name__,
+                                 reason=self.reason or "",
+                                 version=self.version or "")
+
+    Then, you can use your ``MyClassicAdapter`` class like this in your source code:
+
+    .. code-block:: python
+
+       @deprecated(reason="use another function", adapter_cls=MyClassicAdapter)
+       def some_old_function(x, y):
+           return x + y
+    """
+
+    def __init__(self, reason="", version="", action=None, category=DeprecationWarning):
+        """
+        Construct a wrapper adapter.
+
+        :type  reason: str
+        :param reason:
+            Reason message which documents the deprecation in your library (can be omitted).
+
+        :type  version: str
+        :param version:
+            Version of your project which deprecates this feature.
+            If you follow the `Semantic Versioning <https://semver.org/>`_,
+            the version number has the format "MAJOR.MINOR.PATCH".
+
+        :type  action: str
+        :param action:
+            A warning filter used to activate or not the deprecation warning.
+            Can be one of "error", "ignore", "always", "default", "module", or "once".
+            If ``None`` or empty, the the global filtering mechanism is used.
+            See: `The Warnings Filter`_ in the Python documentation.
+
+        :type  category: type
+        :param category:
+            The warning category to use for the deprecation warning.
+            By default, the category class is :class:`~DeprecationWarning`,
+            you can inherit this class to define your own deprecation warning category.
+        """
+        self.reason = reason or ""
+        self.version = version or ""
+        self.action = action
+        self.category = category
+        super(ClassicAdapter, self).__init__()
+
+    def get_deprecated_msg(self, wrapped, instance):
+        """
+        Get the deprecation warning message for the user.
+
+        :param wrapped: Wrapped class or function.
+
+        :param instance: The object to which the wrapped function was bound when it was called.
+
+        :return: The warning message.
+        """
+        if instance is None:
+            if inspect.isclass(wrapped):
+                fmt = "Call to deprecated class {name}."
+            else:
+                fmt = "Call to deprecated function (or staticmethod) {name}."
+        else:
+            if inspect.isclass(instance):
+                fmt = "Call to deprecated class method {name}."
+            else:
+                fmt = "Call to deprecated method {name}."
+        if self.reason:
+            fmt += " ({reason})"
+        if self.version:
+            fmt += " -- Deprecated since version {version}."
+        return fmt.format(name=wrapped.__name__, reason=self.reason or "", version=self.version or "")
+
+    def __call__(self, wrapped):
+        """
+        Decorate your class or function.
+
+        :param wrapped: Wrapped class or function.
+
+        :return: the decorated class or function.
+
+        .. versionchanged:: 1.2.4
+           Don't pass arguments to :meth:`object.__new__` (other than *cls*).
+
+        .. versionchanged:: 1.2.8
+           The warning filter is not set if the *action* parameter is ``None`` or empty.
+        """
+        if inspect.isclass(wrapped):
+            old_new1 = wrapped.__new__
+
+            def wrapped_cls(cls, *args, **kwargs):
+                msg = self.get_deprecated_msg(wrapped, None)
+                if self.action:
+                    with warnings.catch_warnings():
+                        warnings.simplefilter(self.action, self.category)
+                        warnings.warn(msg, category=self.category, stacklevel=_class_stacklevel)
+                else:
+                    warnings.warn(msg, category=self.category, stacklevel=_class_stacklevel)
+                if old_new1 is object.__new__:
+                    return old_new1(cls)
+                # actually, we don't know the real signature of *old_new1*
+                return old_new1(cls, *args, **kwargs)
+
+            wrapped.__new__ = staticmethod(wrapped_cls)
+
+        return wrapped
+
+
+def deprecated(*args, **kwargs):
+    """
+    This is a decorator which can be used to mark functions
+    as deprecated. It will result in a warning being emitted
+    when the function is used.
+
+    **Classic usage:**
+
+    To use this, decorate your deprecated function with **@deprecated** decorator:
+
+    .. code-block:: python
+
+       from deprecated import deprecated
+
+
+       @deprecated
+       def some_old_function(x, y):
+           return x + y
+
+    You can also decorate a class or a method:
+
+    .. code-block:: python
+
+       from deprecated import deprecated
+
+
+       class SomeClass(object):
+           @deprecated
+           def some_old_method(self, x, y):
+               return x + y
+
+
+       @deprecated
+       class SomeOldClass(object):
+           pass
+
+    You can give a *reason* message to help the developer to choose another function/class,
+    and a *version* number to specify the starting version number of the deprecation.
+
+    .. code-block:: python
+
+       from deprecated import deprecated
+
+
+       @deprecated(reason="use another function", version='1.2.0')
+       def some_old_function(x, y):
+           return x + y
+
+    The *category* keyword argument allow you to specify the deprecation warning class of your choice.
+    By default, :exc:`DeprecationWarning` is used but you can choose :exc:`FutureWarning`,
+    :exc:`PendingDeprecationWarning` or a custom subclass.
+
+    .. code-block:: python
+
+       from deprecated import deprecated
+
+
+       @deprecated(category=PendingDeprecationWarning)
+       def some_old_function(x, y):
+           return x + y
+
+    The *action* keyword argument allow you to locally change the warning filtering.
+    *action* can be one of "error", "ignore", "always", "default", "module", or "once".
+    If ``None``, empty or missing, the the global filtering mechanism is used.
+    See: `The Warnings Filter`_ in the Python documentation.
+
+    .. code-block:: python
+
+       from deprecated import deprecated
+
+
+       @deprecated(action="error")
+       def some_old_function(x, y):
+           return x + y
+
+    """
+    if args and isinstance(args[0], string_types):
+        kwargs['reason'] = args[0]
+        args = args[1:]
+
+    if args and not callable(args[0]):
+        raise TypeError(repr(type(args[0])))
+
+    if args:
+        action = kwargs.get('action')
+        category = kwargs.get('category', DeprecationWarning)
+        adapter_cls = kwargs.pop('adapter_cls', ClassicAdapter)
+        adapter = adapter_cls(**kwargs)
+
+        wrapped = args[0]
+        if inspect.isclass(wrapped):
+            wrapped = adapter(wrapped)
+            return wrapped
+
+        elif inspect.isroutine(wrapped):
+
+            @wrapt.decorator(adapter=adapter)
+            def wrapper_function(wrapped_, instance_, args_, kwargs_):
+                msg = adapter.get_deprecated_msg(wrapped_, instance_)
+                if action:
+                    with warnings.catch_warnings():
+                        warnings.simplefilter(action, category)
+                        warnings.warn(msg, category=category, stacklevel=_routine_stacklevel)
+                else:
+                    warnings.warn(msg, category=category, stacklevel=_routine_stacklevel)
+                return wrapped_(*args_, **kwargs_)
+
+            return wrapper_function(wrapped)
+
+        else:
+            raise TypeError(repr(type(wrapped)))
+
+    return functools.partial(deprecated, **kwargs)
diff --git a/TP03/TP03/lib/python3.9/site-packages/deprecated/sphinx.py b/TP03/TP03/lib/python3.9/site-packages/deprecated/sphinx.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e717fbf0f20eab949d64e5d53b49e3bd1acb12a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/deprecated/sphinx.py
@@ -0,0 +1,262 @@
+# coding: utf-8
+"""
+Sphinx directive integration
+============================
+
+We usually need to document the life-cycle of functions and classes:
+when they are created, modified or deprecated.
+
+To do that, `Sphinx <http://www.sphinx-doc.org>`_ has a set
+of `Paragraph-level markups <http://www.sphinx-doc.org/en/stable/markup/para.html>`_:
+
+- ``versionadded``: to document the version of the project which added the described feature to the library,
+- ``versionchanged``: to document changes of a feature,
+- ``deprecated``: to document a deprecated feature.
+
+The purpose of this module is to defined decorators which adds this Sphinx directives
+to the docstring of your function and classes.
+
+Of course, the ``@deprecated`` decorator will emit a deprecation warning
+when the function/method is called or the class is constructed.
+"""
+import re
+import textwrap
+
+import wrapt
+
+from deprecated.classic import ClassicAdapter
+from deprecated.classic import deprecated as _classic_deprecated
+
+
+class SphinxAdapter(ClassicAdapter):
+    """
+    Sphinx adapter -- *for advanced usage only*
+
+    This adapter override the :class:`~deprecated.classic.ClassicAdapter`
+    in order to add the Sphinx directives to the end of the function/class docstring.
+    Such a directive is a `Paragraph-level markup <http://www.sphinx-doc.org/en/stable/markup/para.html>`_
+
+    - The directive can be one of "versionadded", "versionchanged" or "deprecated".
+    - The version number is added if provided.
+    - The reason message is obviously added in the directive block if not empty.
+    """
+
+    def __init__(
+        self,
+        directive,
+        reason="",
+        version="",
+        action=None,
+        category=DeprecationWarning,
+        line_length=70,
+    ):
+        """
+        Construct a wrapper adapter.
+
+        :type  directive: str
+        :param directive:
+            Sphinx directive: can be one of "versionadded", "versionchanged" or "deprecated".
+
+        :type  reason: str
+        :param reason:
+            Reason message which documents the deprecation in your library (can be omitted).
+
+        :type  version: str
+        :param version:
+            Version of your project which deprecates this feature.
+            If you follow the `Semantic Versioning <https://semver.org/>`_,
+            the version number has the format "MAJOR.MINOR.PATCH".
+
+        :type  action: str
+        :param action:
+            A warning filter used to activate or not the deprecation warning.
+            Can be one of "error", "ignore", "always", "default", "module", or "once".
+            If ``None`` or empty, the the global filtering mechanism is used.
+            See: `The Warnings Filter`_ in the Python documentation.
+
+        :type  category: type
+        :param category:
+            The warning category to use for the deprecation warning.
+            By default, the category class is :class:`~DeprecationWarning`,
+            you can inherit this class to define your own deprecation warning category.
+
+        :type  line_length: int
+        :param line_length:
+            Max line length of the directive text. If non nul, a long text is wrapped in several lines.
+        """
+        if not version:
+            # https://github.com/tantale/deprecated/issues/40
+            raise ValueError("'version' argument is required in Sphinx directives")
+        self.directive = directive
+        self.line_length = line_length
+        super(SphinxAdapter, self).__init__(reason=reason, version=version, action=action, category=category)
+
+    def __call__(self, wrapped):
+        """
+        Add the Sphinx directive to your class or function.
+
+        :param wrapped: Wrapped class or function.
+
+        :return: the decorated class or function.
+        """
+        # -- build the directive division
+        fmt = ".. {directive}:: {version}" if self.version else ".. {directive}::"
+        div_lines = [fmt.format(directive=self.directive, version=self.version)]
+        width = self.line_length - 3 if self.line_length > 3 else 2 ** 16
+        reason = textwrap.dedent(self.reason).strip()
+        for paragraph in reason.splitlines():
+            if paragraph:
+                div_lines.extend(
+                    textwrap.fill(
+                        paragraph,
+                        width=width,
+                        initial_indent="   ",
+                        subsequent_indent="   ",
+                    ).splitlines()
+                )
+            else:
+                div_lines.append("")
+
+        # -- get the docstring, normalize the trailing newlines
+        # keep a consistent behaviour if the docstring starts with newline or directly on the first one
+        docstring = wrapped.__doc__ or ""
+        lines = docstring.splitlines(keepends=True) or [""]
+        docstring = textwrap.dedent("".join(lines[1:])) if len(lines) > 1 else ""
+        docstring = lines[0] + docstring
+        if docstring:
+            # An empty line must separate the original docstring and the directive.
+            docstring = re.sub(r"\n+$", "", docstring, flags=re.DOTALL) + "\n\n"
+        else:
+            # Avoid "Explicit markup ends without a blank line" when the decorated function has no docstring
+            docstring = "\n"
+
+        # -- append the directive division to the docstring
+        docstring += "".join("{}\n".format(line) for line in div_lines)
+
+        wrapped.__doc__ = docstring
+        if self.directive in {"versionadded", "versionchanged"}:
+            return wrapped
+        return super(SphinxAdapter, self).__call__(wrapped)
+
+    def get_deprecated_msg(self, wrapped, instance):
+        """
+        Get the deprecation warning message (without Sphinx cross-referencing syntax) for the user.
+
+        :param wrapped: Wrapped class or function.
+
+        :param instance: The object to which the wrapped function was bound when it was called.
+
+        :return: The warning message.
+
+        .. versionadded:: 1.2.12
+           Strip Sphinx cross-referencing syntax from warning message.
+
+        """
+        msg = super(SphinxAdapter, self).get_deprecated_msg(wrapped, instance)
+        # Strip Sphinx cross reference syntax (like ":function:", ":py:func:" and ":py:meth:")
+        # Possible values are ":role:`foo`", ":domain:role:`foo`"
+        # where ``role`` and ``domain`` should match "[a-zA-Z]+"
+        msg = re.sub(r"(?: : [a-zA-Z]+ )? : [a-zA-Z]+ : (`[^`]*`)", r"\1", msg, flags=re.X)
+        return msg
+
+
+def versionadded(reason="", version="", line_length=70):
+    """
+    This decorator can be used to insert a "versionadded" directive
+    in your function/class docstring in order to documents the
+    version of the project which adds this new functionality in your library.
+
+    :param str reason:
+        Reason message which documents the addition in your library (can be omitted).
+
+    :param str version:
+        Version of your project which adds this feature.
+        If you follow the `Semantic Versioning <https://semver.org/>`_,
+        the version number has the format "MAJOR.MINOR.PATCH", and,
+        in the case of a new functionality, the "PATCH" component should be "0".
+
+    :type  line_length: int
+    :param line_length:
+        Max line length of the directive text. If non nul, a long text is wrapped in several lines.
+
+    :return: the decorated function.
+    """
+    adapter = SphinxAdapter(
+        'versionadded',
+        reason=reason,
+        version=version,
+        line_length=line_length,
+    )
+    return adapter
+
+
+def versionchanged(reason="", version="", line_length=70):
+    """
+    This decorator can be used to insert a "versionchanged" directive
+    in your function/class docstring in order to documents the
+    version of the project which modifies this functionality in your library.
+
+    :param str reason:
+        Reason message which documents the modification in your library (can be omitted).
+
+    :param str version:
+        Version of your project which modifies this feature.
+        If you follow the `Semantic Versioning <https://semver.org/>`_,
+        the version number has the format "MAJOR.MINOR.PATCH".
+
+    :type  line_length: int
+    :param line_length:
+        Max line length of the directive text. If non nul, a long text is wrapped in several lines.
+
+    :return: the decorated function.
+    """
+    adapter = SphinxAdapter(
+        'versionchanged',
+        reason=reason,
+        version=version,
+        line_length=line_length,
+    )
+    return adapter
+
+
+def deprecated(reason="", version="", line_length=70, **kwargs):
+    """
+    This decorator can be used to insert a "deprecated" directive
+    in your function/class docstring in order to documents the
+    version of the project which deprecates this functionality in your library.
+
+    :param str reason:
+        Reason message which documents the deprecation in your library (can be omitted).
+
+    :param str version:
+        Version of your project which deprecates this feature.
+        If you follow the `Semantic Versioning <https://semver.org/>`_,
+        the version number has the format "MAJOR.MINOR.PATCH".
+
+    :type  line_length: int
+    :param line_length:
+        Max line length of the directive text. If non nul, a long text is wrapped in several lines.
+
+    Keyword arguments can be:
+
+    -   "action":
+        A warning filter used to activate or not the deprecation warning.
+        Can be one of "error", "ignore", "always", "default", "module", or "once".
+        If ``None``, empty or missing, the the global filtering mechanism is used.
+
+    -   "category":
+        The warning category to use for the deprecation warning.
+        By default, the category class is :class:`~DeprecationWarning`,
+        you can inherit this class to define your own deprecation warning category.
+
+    :return: a decorator used to deprecate a function.
+
+    .. versionchanged:: 1.2.13
+       Change the signature of the decorator to reflect the valid use cases.
+    """
+    directive = kwargs.pop('directive', 'deprecated')
+    adapter_cls = kwargs.pop('adapter_cls', SphinxAdapter)
+    kwargs["reason"] = reason
+    kwargs["version"] = version
+    kwargs["line_length"] = line_length
+    return _classic_deprecated(directive=directive, adapter_cls=adapter_cls, **kwargs)
diff --git a/TP03/TP03/lib/python3.9/site-packages/easy_install.py b/TP03/TP03/lib/python3.9/site-packages/easy_install.py
new file mode 100644
index 0000000000000000000000000000000000000000..d87e984034b6e6e9eb456ebcb2b3f420c07a48bc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/easy_install.py
@@ -0,0 +1,5 @@
+"""Run the EasyInstall command"""
+
+if __name__ == '__main__':
+    from setuptools.command.easy_install import main
+    main()
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..10e0dcedd556981a2ea6c21acbf7763731992e07
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2020 Jeff Forcier.
+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.
+
+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/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..1146cd8cb7fd5232645f15cf789f9af6d8bc89be
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/METADATA
@@ -0,0 +1,84 @@
+Metadata-Version: 2.1
+Name: fabric
+Version: 3.2.2
+Summary: High level SSH command execution
+Home-page: https://fabfile.org
+Author: Jeff Forcier
+Author-email: jeff@bitprophet.org
+License: BSD
+Project-URL: Docs, https://docs.fabfile.org
+Project-URL: Source, https://github.com/fabric/fabric
+Project-URL: Issues, https://github.com/fabric/fabric/issues
+Project-URL: Changelog, https://www.fabfile.org/changelog.html
+Project-URL: CI, https://app.circleci.com/pipelines/github/fabric/fabric
+Project-URL: Twitter, https://twitter.com/pyfabric
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Unix
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+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
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Build Tools
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: System :: Clustering
+Classifier: Topic :: System :: Software Distribution
+Classifier: Topic :: System :: Systems Administration
+License-File: LICENSE
+Requires-Dist: invoke >=2.0
+Requires-Dist: paramiko >=2.4
+Requires-Dist: decorator >=5
+Requires-Dist: deprecated >=1.2
+Provides-Extra: pytest
+Requires-Dist: pytest >=7 ; extra == 'pytest'
+Provides-Extra: testing
+
+|version| |python| |license| |ci| |coverage|
+
+.. |version| image:: https://img.shields.io/pypi/v/fabric
+    :target: https://pypi.org/project/fabric/
+    :alt: PyPI - Package Version
+.. |python| image:: https://img.shields.io/pypi/pyversions/fabric
+    :target: https://pypi.org/project/fabric/
+    :alt: PyPI - Python Version
+.. |license| image:: https://img.shields.io/pypi/l/fabric
+    :target: https://github.com/fabric/fabric/blob/main/LICENSE
+    :alt: PyPI - License
+.. |ci| image:: https://img.shields.io/circleci/build/github/fabric/fabric/main
+    :target: https://app.circleci.com/pipelines/github/fabric/fabric
+    :alt: CircleCI
+.. |coverage| image:: https://img.shields.io/codecov/c/gh/fabric/fabric
+    :target: https://app.codecov.io/gh/fabric/fabric
+    :alt: Codecov
+
+Welcome to Fabric!
+==================
+
+Fabric is a high level Python (2.7, 3.4+) library designed to execute shell
+commands remotely over SSH, yielding useful Python objects in return. It builds
+on top of `Invoke <https://pyinvoke.org>`_ (subprocess command execution and
+command-line features) and `Paramiko <https://paramiko.org>`_ (SSH protocol
+implementation), extending their APIs to complement one another and provide
+additional functionality.
+
+To find out what's new in this version of Fabric, please see `the changelog
+<https://fabfile.org/changelog.html#{}>`_.
+
+The project maintainer keeps a `roadmap
+<https://bitprophet.org/projects#roadmap>`_ on his website.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..428ce2fadc26c781289b2cf88a3d3dbcbde4d394
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/RECORD
@@ -0,0 +1,45 @@
+../../../bin/fab,sha256=PyjfGUS2vd6Otx1SCJwPn166nwaqH3htka9lLkT3ZEY,276
+fabric-3.2.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+fabric-3.2.2.dist-info/LICENSE,sha256=eSL5f4lvHRYeHr9HCD4wSiNjg2GyVcaQK15PNO7aDa0,1314
+fabric-3.2.2.dist-info/METADATA,sha256=gZbCZwt5MraCavgBO29IlcorMs2JDq6uRJd5rRgeXz4,3492
+fabric-3.2.2.dist-info/RECORD,,
+fabric-3.2.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+fabric-3.2.2.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
+fabric-3.2.2.dist-info/entry_points.txt,sha256=99Ejmtcqa9WQsIvfWs4sbXCosRbL_XWqr3XxdREeoTA,49
+fabric-3.2.2.dist-info/top_level.txt,sha256=thYVtHqxtidDsGQhNcBi6HDNM13leiLr6ISHkR66xO8,7
+fabric/__init__.py,sha256=xcVl4Vhd7Z9DtRb7w9COYgOWbtkwdCCv7d_VYEz33yQ,540
+fabric/__main__.py,sha256=z00JNvzM0vdT76LERJuZgWe0H5ndouXX6j3j-t60kvw,139
+fabric/__pycache__/__init__.cpython-39.pyc,,
+fabric/__pycache__/__main__.cpython-39.pyc,,
+fabric/__pycache__/_version.cpython-39.pyc,,
+fabric/__pycache__/auth.cpython-39.pyc,,
+fabric/__pycache__/config.cpython-39.pyc,,
+fabric/__pycache__/connection.cpython-39.pyc,,
+fabric/__pycache__/exceptions.cpython-39.pyc,,
+fabric/__pycache__/executor.cpython-39.pyc,,
+fabric/__pycache__/group.cpython-39.pyc,,
+fabric/__pycache__/main.cpython-39.pyc,,
+fabric/__pycache__/runners.cpython-39.pyc,,
+fabric/__pycache__/tasks.cpython-39.pyc,,
+fabric/__pycache__/transfer.cpython-39.pyc,,
+fabric/__pycache__/tunnels.cpython-39.pyc,,
+fabric/__pycache__/util.cpython-39.pyc,,
+fabric/_version.py,sha256=8f5EbbsSqdasItUa9mGyEo0hs9pmnewPrcf0QPc4dX0,80
+fabric/auth.py,sha256=TUsDa1x9LL9VxlCzGHDEmAUQnAuqYDNBagg_ZDXPISw,9086
+fabric/config.py,sha256=1c6ugXmLPKWfKlCr4GhNw_OXnszMeflf1dspl_921a8,14381
+fabric/connection.py,sha256=1RHLX50orCZewzAadaRPndWP2VESl0p1YM7hyKFP5Ws,45993
+fabric/exceptions.py,sha256=PVRwZWTccVcuXe9u-P5HR1eQV5PuO49ACaNGS9AEc88,698
+fabric/executor.py,sha256=_7gvs1AT6fH0eqR2jraif-PchuloY7Iqt6djHjwSmAU,5512
+fabric/group.py,sha256=zfvdOX2aO-q8Pu2NXDQAQ8qTPLtnsFG8mdC89l0phlM,12340
+fabric/main.py,sha256=S8aHZOcpjTXWh4CX4gOwUo-Um_qrWntkXR9XqjS08_s,7979
+fabric/runners.py,sha256=WcsYYD8kS8udWeaNvxF4mjA864p1V9-wIOqpvxyIxRM,6959
+fabric/tasks.py,sha256=MaJk2HxFOPZ-Uk0w5FAfJI17-3tIMl9jDVyQGerYpBs,4654
+fabric/testing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+fabric/testing/__pycache__/__init__.cpython-39.pyc,,
+fabric/testing/__pycache__/base.cpython-39.pyc,,
+fabric/testing/__pycache__/fixtures.cpython-39.pyc,,
+fabric/testing/base.py,sha256=xp-ctJowN17y4uxiqmreeT2JeiTbQfcOW8YpI9duFNA,19833
+fabric/testing/fixtures.py,sha256=bXSCeIptQbeq-LASu2ME8rOzQ018Lp9H-uCxQezFa7I,5971
+fabric/transfer.py,sha256=-ZBt92hCZkwcth6d45pBV1YGWXITY3ex4CdMnCfCxTo,14760
+fabric/tunnels.py,sha256=XAgbpF71B6jvYqgwcDZR1ZLnjhvS5MjxARwD3PfLCAw,5415
+fabric/util.py,sha256=pefFk-NChhaZp0OT3q-qe6qzsDdJx5hAXYwuefLCXyQ,1446
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/REQUESTED b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..7e688737d490be3643d705bc16b5a77f7bd567b7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.41.2)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1affc295910de75fe4f105fa297e15c4432c4b40
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+fab = fabric.main:program.run
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2610efb943bdc2e22c470c5278050431ef1814ef
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric-3.2.2.dist-info/top_level.txt
@@ -0,0 +1 @@
+fabric
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__init__.py b/TP03/TP03/lib/python3.9/site-packages/fabric/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..68120d770bf73640a20f2e876547ec5652dab91a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/__init__.py
@@ -0,0 +1,15 @@
+# flake8: noqa
+from ._version import __version_info__, __version__
+from .connection import Config, Connection
+from .runners import Remote, RemoteShell, Result
+from .group import Group, SerialGroup, ThreadingGroup, GroupResult
+from .tasks import task, Task
+from .executor import Executor
+
+# Best-effort import of module relying on a Paramiko 3.2+ API member
+# TODO: this is chiefly a concession to our "v1->v2 shim test" in CI, since
+# Fabric 1.x wants Paramiko<3.
+try:
+    from .auth import OpenSSHAuthStrategy
+except ImportError:
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__main__.py b/TP03/TP03/lib/python3.9/site-packages/fabric/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c58801b7217bbc054cc51935716f868529c8a43f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/__main__.py
@@ -0,0 +1,9 @@
+"""
+This code provides the ability to run fabric
+package as a script
+Usage: python -m fabric
+"""
+
+from .main import program
+
+program.run()
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..66edfec8de91db50fe9a5e60cb7202132588c901
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__main__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__main__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6049ade8ccd986841debd310ae7f12a1bb72d037
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/__main__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/_version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/_version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f6ea1718cc622733d8ff3c7a8d359799bb100b5f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/_version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/auth.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/auth.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9d6f39da76374dd9f9e6faf6ace482e85a890a54
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/auth.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/config.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/config.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5ff3aecdf3dfbff937d97f59a8d5e7d612bb7472
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/config.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/connection.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/connection.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..959afc8a0e1d4c50aecda26a12de90953e9081fc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/connection.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/exceptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/exceptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..87a7a8a2227b9da1c6e0f201081faf822399fbd7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/exceptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/executor.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/executor.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6952f4c8e171e6e12b18c76bbc2938c6b8c53f3b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/executor.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/group.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/group.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dcb8ddf34c0df101189e9d3c3cfd53f074b89d33
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/group.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/main.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/main.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..59487fc0efcb0df920343d20fc813fdc463abf48
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/main.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/runners.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/runners.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..94bb97d1a483e1fb2fe0f688e46c918a2e2deb86
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/runners.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tasks.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tasks.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..85c45e0b43e4ab2a108bd55e468ec27db4129bf7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tasks.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/transfer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/transfer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..31b82ef88973e704c9ffbfbdd71d96d1bbdf445f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/transfer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tunnels.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tunnels.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c86e0177222467445699ed5366b7f6054fd25475
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/tunnels.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/util.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/util.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7571bf0d54ff61b4d598f2f1effaddf5367ca36a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/__pycache__/util.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/_version.py b/TP03/TP03/lib/python3.9/site-packages/fabric/_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..f9a16f8888960f47aee215bb7fc076f04708bc9b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/_version.py
@@ -0,0 +1,2 @@
+__version_info__ = (3, 2, 2)
+__version__ = ".".join(map(str, __version_info__))
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/auth.py b/TP03/TP03/lib/python3.9/site-packages/fabric/auth.py
new file mode 100644
index 0000000000000000000000000000000000000000..b09529addc255a9933c8c88acd3f171a76048e7a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/auth.py
@@ -0,0 +1,207 @@
+from functools import partial
+from getpass import getpass
+from pathlib import Path
+
+from paramiko import Agent, PKey
+from paramiko.auth_strategy import (
+    AuthStrategy,
+    Password,
+    InMemoryPrivateKey,
+    OnDiskPrivateKey,
+)
+
+from .util import win32
+
+
+class OpenSSHAuthStrategy(AuthStrategy):
+    """
+    Auth strategy that tries very hard to act like the OpenSSH client.
+
+    .. warning::
+        As of version 3.1, this class is **EXPERIMENTAL** and **incomplete**.
+        It works best with passphraseless (eg ssh-agent) private key auth for
+        now and will grow more features in future releases.
+
+    For example, it accepts a `~paramiko.config.SSHConfig` and uses any
+    relevant ``IdentityFile`` directives from that object, along with keys from
+    your home directory and any local SSH agent. Keys specified at runtime are
+    tried last, just as with ``ssh -i /path/to/key`` (this is one departure
+    from the legacy/off-spec auth behavior observed in older Paramiko and
+    Fabric versions).
+
+    We explicitly do not document the full details here, because the point is
+    to match the documented/observed behavior of OpenSSH. Please see the `ssh
+    <https://man.openbsd.org/ssh>`_ and `ssh_config
+    <https://man.openbsd.org/ssh_config>`_ man pages for more information.
+
+    .. versionadded:: 3.1
+    """
+
+    # Skimming openssh code (ssh.c and sshconnect2.c) gives us the following
+    # behavior to crib from:
+    # - parse cli (initializing identity_files if any given)
+    # - parse user config, then system config _unless_ user gave cli config
+    # path; this will also add to identity_files if any IdentityFile found
+    # (after the CLI ones)
+    # - lots of value init, string interpolation, etc
+    # - if no other identity_files exist at this point, fill in the ~/.ssh/
+    # defaults:
+    #   - in order: rsa, dsa, ecdsa, ecdsa_sk, ed25519, xmss (???)
+    # - initial connection (ssh_connect() - presumably handshake/hostkey/kex)
+    # - load all identity_files (and any implicit certs of those)
+    # - eventually runs pubkey_prepare() which, per its own comment,
+    # loads/assembles key material in this order:
+    #   - certs - config file, then cli, skipping any non-user (?) certs
+    #   - agent keys that are also listed in the config file
+    #   - agent keys _not_ listed in config files
+    #   - non-agent config file keys (this seems like it includes cli and
+    #   implicit defaults)
+    #   - once list is assembled, drop anything not listed in configured pubkey
+    #   algorithms list
+    # - auth_none to get list of acceptable authmethods
+    # - while-loops along that, or next returned, list of acceptable
+    # authmethods, using a handler table, so eg a 'standard' openssh on both
+    # ends might start with 'publickey,password,keyboard-interactive'; so it'll
+    # try all pubkeys found above before eventually trying a password prompt,
+    # and then if THAT fails, it will try kbdint call-and-response (similar to
+    # password but where server sends you the prompt(s) it wants displayed)
+
+    def __init__(self, ssh_config, fabric_config, username):
+        """
+        Extends superclass with additional inputs.
+
+        Specifically:
+
+        - ``fabric_config``, a `fabric.Config` instance for the current
+          session.
+        - ``username``, which is unified by our intended caller so we don't
+          have to - it's a synthesis of CLI, runtime,
+          invoke/fabric-configuration, and ssh_config configuration.
+
+        Also handles connecting to an SSH agent, if possible, for easier
+        lifecycle tracking.
+        """
+        super().__init__(ssh_config=ssh_config)
+        self.username = username
+        self.config = fabric_config
+        # NOTE: Agent seems designed to always 'work' even w/o a live agent, in
+        # which case it just yields an empty key list.
+        self.agent = Agent()
+
+    def get_pubkeys(self):
+        # Similar to OpenSSH, we first obtain sources in arbitrary order,
+        # tracking where they came from and whether they were a cert.
+        config_certs, config_keys, cli_certs, cli_keys = [], [], [], []
+        # Our own configuration is treated like `ssh -i`, partly because that's
+        # where our -i flag ends up, partly because our config data has no
+        # direct OpenSSH analogue (it's _not_ in your ssh_config! it's
+        # elsewhere!)
+        for path in self.config.authentication.identities:
+            try:
+                key = PKey.from_path(path)
+            except FileNotFoundError:
+                continue
+            source = OnDiskPrivateKey(
+                username=self.username,
+                source="python-config",
+                path=path,
+                pkey=key,
+            )
+            (cli_certs if key.public_blob else cli_keys).append(source)
+        # Now load ssh_config IdentityFile directives, sorting again into
+        # cert/key split.
+        # NOTE: Config's ssh_config loader already behaves OpenSSH-compatibly:
+        # if the user supplied a custom ssh_config file path, that is the only
+        # one loaded; otherwise, it loads and merges the user and system paths.
+        # TODO: CertificateFile support? Most people seem to rely on the
+        # implicit cert loading of IdentityFile...
+        for path in self.ssh_config.get("identityfile", []):
+            try:
+                key = PKey.from_path(path)
+            except FileNotFoundError:
+                continue
+            source = OnDiskPrivateKey(
+                username=self.username,
+                source="ssh-config",
+                path=path,
+                pkey=key,
+            )
+            (config_certs if key.public_blob else config_keys).append(source)
+        # At this point, if we've still got no keys or certs, look in the
+        # default user locations.
+        if not any((config_certs, config_keys, cli_certs, cli_keys)):
+            user_ssh = Path.home() / f"{'' if win32 else '.'}ssh"
+            # This is the same order OpenSSH documents as using.
+            for type_ in ("rsa", "ecdsa", "ed25519", "dsa"):
+                path = user_ssh / f"id_{type_}"
+                try:
+                    key = PKey.from_path(path)
+                except FileNotFoundError:
+                    continue
+                source = OnDiskPrivateKey(
+                    username=self.username,
+                    source="implicit-home",
+                    path=path,
+                    pkey=key,
+                )
+                dest = config_certs if key.public_blob else config_keys
+                dest.append(source)
+        # TODO: set agent_keys to empty list if IdentitiesOnly is true
+        agent_keys = self.agent.get_keys()
+
+        # We've finally loaded everything; now it's time to throw them upwards
+        # in the intended order...
+        # TODO: define subroutine that dedupes (& honors
+        # PubkeyAcceptedAlgorithms) then rub that on all of the below.
+        # First, all local _certs_ (config wins over cli, for w/e reason)
+        for source in config_certs:
+            yield source
+        for source in cli_certs:
+            yield source
+        # Then all agent keys, first ones that were also mentioned in configs,
+        # then 'new' ones not found in configs.
+        deferred_agent_keys = []
+        for key in agent_keys:
+            config_index = None
+            for i, config_key in enumerate(config_keys):
+                if config_key.pkey == key:
+                    config_index = i
+                    break
+            if config_index:
+                yield InMemoryPrivateKey(username=self.username, pkey=key)
+                # Nuke so it doesn't get re-yielded by regular conf keys bit
+                del config_keys[config_index]
+            else:
+                deferred_agent_keys.append(key)
+        for key in deferred_agent_keys:
+            yield InMemoryPrivateKey(username=self.username, pkey=key)
+        for source in cli_keys:
+            yield source
+        # This will now be just the config-borne keys that were NOT in agent
+        for source in config_keys:
+            yield source
+
+    def get_sources(self):
+        # TODO: initial none-auth + tracking the response's allowed types.
+        # however, SSHClient never did this deeply, and there's no guarantee a
+        # server _will_ send anything but "any" anyways...
+        # Public keys of all kinds typically first.
+        yield from self.get_pubkeys()
+        user = self.username
+        prompter = partial(getpass, f"{user}'s password: ")
+        # Then password.
+        yield Password(username=self.username, password_getter=prompter)
+
+    def authenticate(self, *args, **kwargs):
+        # Just do what our parent would, except make sure we close() after.
+        try:
+            return super().authenticate(*args, **kwargs)
+        finally:
+            self.close()
+
+    def close(self):
+        """
+        Shut down any resources we ourselves opened up.
+        """
+        # TODO: bare try/except here as "best effort"? ugh
+        self.agent.close()
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/config.py b/TP03/TP03/lib/python3.9/site-packages/fabric/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..c56f3434e32d5c1175472edef05aa22198a737f0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/config.py
@@ -0,0 +1,331 @@
+import copy
+import errno
+import os
+
+from invoke.config import Config as InvokeConfig, merge_dicts
+from paramiko.config import SSHConfig
+
+from .runners import Remote, RemoteShell
+from .util import get_local_user, debug
+
+
+class Config(InvokeConfig):
+    """
+    An `invoke.config.Config` subclass with extra Fabric-related behavior.
+
+    This class behaves like `invoke.config.Config` in every way, with the
+    following exceptions:
+
+    - its `global_defaults` staticmethod has been extended to add/modify some
+      default settings (see its documentation, below, for details);
+    - it triggers loading of Fabric-specific env vars (e.g.
+      ``FABRIC_RUN_HIDE=true`` instead of ``INVOKE_RUN_HIDE=true``) and
+      filenames (e.g. ``/etc/fabric.yaml`` instead of ``/etc/invoke.yaml``).
+    - it extends the API to account for loading ``ssh_config`` files (which are
+      stored as additional attributes and have no direct relation to the
+      regular config data/hierarchy.)
+    - it adds a new optional constructor, `from_v1`, which :ref:`generates
+      configuration data from Fabric 1 <from-v1>`.
+
+    Intended for use with `.Connection`, as using vanilla
+    `invoke.config.Config` objects would require users to manually define
+    ``port``, ``user`` and so forth.
+
+    .. seealso:: :doc:`/concepts/configuration`, :ref:`ssh-config`
+
+    .. versionadded:: 2.0
+    """
+
+    prefix = "fabric"
+
+    @classmethod
+    def from_v1(cls, env, **kwargs):
+        """
+        Alternate constructor which uses Fabric 1's ``env`` dict for settings.
+
+        All keyword arguments besides ``env`` are passed unmolested into the
+        primary constructor, with the exception of ``overrides``, which is used
+        internally & will end up resembling the data from ``env`` with the
+        user-supplied overrides on top.
+
+        .. warning::
+            Because your own config overrides will win over data from ``env``,
+            make sure you only set values you *intend* to change from your v1
+            environment!
+
+        For details on exactly which ``env`` vars are imported and what they
+        become in the new API, please see :ref:`v1-env-var-imports`.
+
+        :param env:
+            An explicit Fabric 1 ``env`` dict (technically, any
+            ``fabric.utils._AttributeDict`` instance should work) to pull
+            configuration from.
+
+        .. versionadded:: 2.4
+        """
+        # TODO: automagic import, if we can find a way to test that
+        # Use overrides level (and preserve whatever the user may have given)
+        # TODO: we really do want arbitrary number of config levels, don't we?
+        # TODO: most of these need more care re: only filling in when they
+        # differ from the v1 default. As-is these won't overwrite runtime
+        # overrides (due to .setdefault) but they may still be filling in empty
+        # values to stomp on lower level config levels...
+        data = kwargs.pop("overrides", {})
+        # TODO: just use a dataproxy or defaultdict??
+        for subdict in ("connect_kwargs", "run", "sudo", "timeouts"):
+            data.setdefault(subdict, {})
+        # PTY use
+        data["run"].setdefault("pty", env.always_use_pty)
+        # Gateway
+        data.setdefault("gateway", env.gateway)
+        # Agent forwarding
+        data.setdefault("forward_agent", env.forward_agent)
+        # Key filename(s)
+        if env.key_filename is not None:
+            data["connect_kwargs"].setdefault("key_filename", env.key_filename)
+        # Load keys from agent?
+        data["connect_kwargs"].setdefault("allow_agent", not env.no_agent)
+        data.setdefault("ssh_config_path", env.ssh_config_path)
+        # Sudo password
+        data["sudo"].setdefault("password", env.sudo_password)
+        # Vanilla password (may be used for regular and/or sudo, depending)
+        passwd = env.password
+        data["connect_kwargs"].setdefault("password", passwd)
+        if not data["sudo"]["password"]:
+            data["sudo"]["password"] = passwd
+        data["sudo"].setdefault("prompt", env.sudo_prompt)
+        data["timeouts"].setdefault("connect", env.timeout)
+        data.setdefault("load_ssh_configs", env.use_ssh_config)
+        data["run"].setdefault("warn", env.warn_only)
+        # Put overrides back for real constructor and go
+        kwargs["overrides"] = data
+        return cls(**kwargs)
+
+    def __init__(self, *args, **kwargs):
+        """
+        Creates a new Fabric-specific config object.
+
+        For most API details, see `invoke.config.Config.__init__`. Parameters
+        new to this subclass are listed below.
+
+        :param ssh_config:
+            Custom/explicit `paramiko.config.SSHConfig` object. If given,
+            prevents loading of any SSH config files. Default: ``None``.
+
+        :param str runtime_ssh_path:
+            Runtime SSH config path to load. Prevents loading of system/user
+            files if given. Default: ``None``.
+
+        :param str system_ssh_path:
+            Location of the system-level SSH config file. Default:
+            ``/etc/ssh/ssh_config``.
+
+        :param str user_ssh_path:
+            Location of the user-level SSH config file. Default:
+            ``~/.ssh/config``.
+
+        :param bool lazy:
+            Has the same meaning as the parent class' ``lazy``, but
+            additionally controls whether SSH config file loading is deferred
+            (requires manually calling `load_ssh_config` sometime.) For
+            example, one may need to wait for user input before calling
+            `set_runtime_ssh_path`, which will inform exactly what
+            `load_ssh_config` does.
+        """
+        # Tease out our own kwargs.
+        # TODO: consider moving more stuff out of __init__ and into methods so
+        # there's less of this sort of splat-args + pop thing? Eh.
+        ssh_config = kwargs.pop("ssh_config", None)
+        lazy = kwargs.get("lazy", False)
+        self.set_runtime_ssh_path(kwargs.pop("runtime_ssh_path", None))
+        system_path = kwargs.pop("system_ssh_path", "/etc/ssh/ssh_config")
+        self._set(_system_ssh_path=system_path)
+        self._set(_user_ssh_path=kwargs.pop("user_ssh_path", "~/.ssh/config"))
+
+        # Record whether we were given an explicit object (so other steps know
+        # whether to bother loading from disk or not)
+        # This needs doing before super __init__ as that calls our post_init
+        explicit = ssh_config is not None
+        self._set(_given_explicit_object=explicit)
+
+        # Arrive at some non-None SSHConfig object (upon which to run .parse()
+        # later, in _load_ssh_file())
+        if ssh_config is None:
+            ssh_config = SSHConfig()
+        self._set(base_ssh_config=ssh_config)
+
+        # Now that our own attributes have been prepared & kwargs yanked, we
+        # can fall up into parent __init__()
+        super().__init__(*args, **kwargs)
+
+        # And finally perform convenience non-lazy bits if needed
+        if not lazy:
+            self.load_ssh_config()
+
+    def set_runtime_ssh_path(self, path):
+        """
+        Configure a runtime-level SSH config file path.
+
+        If set, this will cause `load_ssh_config` to skip system and user
+        files, as OpenSSH does.
+
+        .. versionadded:: 2.0
+        """
+        self._set(_runtime_ssh_path=path)
+
+    def load_ssh_config(self):
+        """
+        Load SSH config file(s) from disk.
+
+        Also (beforehand) ensures that Invoke-level config re: runtime SSH
+        config file paths, is accounted for.
+
+        .. versionadded:: 2.0
+        """
+        # Update the runtime SSH config path (assumes enough regular config
+        # levels have been loaded that anyone wanting to transmit this info
+        # from a 'vanilla' Invoke config, has gotten it set.)
+        if self.ssh_config_path:
+            self._runtime_ssh_path = self.ssh_config_path
+        # Load files from disk if we weren't given an explicit SSHConfig in
+        # __init__
+        if not self._given_explicit_object:
+            self._load_ssh_files()
+
+    def clone(self, *args, **kwargs):
+        # TODO: clone() at this point kinda-sorta feels like it's retreading
+        # __reduce__ and the related (un)pickling stuff...
+        # Get cloned obj.
+        # NOTE: Because we also extend .init_kwargs, the actual core SSHConfig
+        # data is passed in at init time (ensuring no files get loaded a 2nd,
+        # etc time) and will already be present, so we don't need to set
+        # .base_ssh_config ourselves. Similarly, there's no need to worry about
+        # how the SSH config paths may be inaccurate until below; nothing will
+        # be referencing them.
+        new = super().clone(*args, **kwargs)
+        # Copy over our custom attributes, so that the clone still resembles us
+        # re: recording where the data originally came from (in case anything
+        # re-runs ._load_ssh_files(), for example).
+        for attr in (
+            "_runtime_ssh_path",
+            "_system_ssh_path",
+            "_user_ssh_path",
+        ):
+            setattr(new, attr, getattr(self, attr))
+        # Load SSH configs, in case they weren't prior to now (e.g. a vanilla
+        # Invoke clone(into), instead of a us-to-us clone.)
+        self.load_ssh_config()
+        # All done
+        return new
+
+    def _clone_init_kwargs(self, *args, **kw):
+        # Parent kwargs
+        kwargs = super()._clone_init_kwargs(*args, **kw)
+        # Transmit our internal SSHConfig via explicit-obj kwarg, thus
+        # bypassing any file loading. (Our extension of clone() above copies
+        # over other attributes as well so that the end result looks consistent
+        # with reality.)
+        new_config = SSHConfig()
+        # TODO: as with other spots, this implies SSHConfig needs a cleaner
+        # public API re: creating and updating its core data.
+        new_config._config = copy.deepcopy(self.base_ssh_config._config)
+        return dict(kwargs, ssh_config=new_config)
+
+    def _load_ssh_files(self):
+        """
+        Trigger loading of configured SSH config file paths.
+
+        Expects that ``base_ssh_config`` has already been set to an
+        `~paramiko.config.SSHConfig` object.
+
+        :returns: ``None``.
+        """
+        # TODO: does this want to more closely ape the behavior of
+        # InvokeConfig.load_files? re: having a _found attribute for each that
+        # determines whether to load or skip
+        if self._runtime_ssh_path is not None:
+            path = self._runtime_ssh_path
+            # Manually blow up like open() (_load_ssh_file normally doesn't)
+            if not os.path.exists(path):
+                raise FileNotFoundError(
+                    errno.ENOENT, "No such file or directory", path
+                )
+            self._load_ssh_file(os.path.expanduser(path))
+        elif self.load_ssh_configs:
+            for path in (self._user_ssh_path, self._system_ssh_path):
+                self._load_ssh_file(os.path.expanduser(path))
+
+    def _load_ssh_file(self, path):
+        """
+        Attempt to open and parse an SSH config file at ``path``.
+
+        Does nothing if ``path`` is not a path to a valid file.
+
+        :returns: ``None``.
+        """
+        if os.path.isfile(path):
+            old_rules = len(self.base_ssh_config._config)
+            with open(path) as fd:
+                self.base_ssh_config.parse(fd)
+            new_rules = len(self.base_ssh_config._config)
+            msg = "Loaded {} new ssh_config rules from {!r}"
+            debug(msg.format(new_rules - old_rules, path))
+        else:
+            debug("File not found, skipping")
+
+    @staticmethod
+    def global_defaults():
+        """
+        Default configuration values and behavior toggles.
+
+        Fabric only extends this method in order to make minor adjustments and
+        additions to Invoke's `~invoke.config.Config.global_defaults`; see its
+        documentation for the base values, such as the config subtrees
+        controlling behavior of ``run`` or how ``tasks`` behave.
+
+        For Fabric-specific modifications and additions to the Invoke-level
+        defaults, see our own config docs at :ref:`default-values`.
+
+        .. versionadded:: 2.0
+        .. versionchanged:: 3.1
+            Added the ``authentication`` settings section, plus sub-attributes
+            such as ``authentication.strategy_class``.
+        """
+        # TODO: hrm should the run-related things actually be derived from the
+        # runner_class? E.g. Local defines local stuff, Remote defines remote
+        # stuff? Doesn't help with the final config tree tho...
+        # TODO: as to that, this is a core problem, Fabric wants split
+        # local/remote stuff, eg replace_env wants to be False for local and
+        # True remotely; shell wants to differ depending on target (and either
+        # way, does not want to use local interrogation for remote)
+        # TODO: is it worth moving all of our 'new' settings to a discrete
+        # namespace for cleanliness' sake? e.g. ssh.port, ssh.user etc.
+        # It wouldn't actually simplify this code any, but it would make it
+        # easier for users to determine what came from which library/repo.
+        defaults = InvokeConfig.global_defaults()
+        # TODO 4.0: this is already a mess, strongly consider a new 'ssh'
+        # subtree because otherwise it's guessing where, or whether, 'ssh' is
+        # in the setting name! i.e. 'inline_ssh_env' -> ssh.use_inline_env,
+        # 'load_ssh_configs' -> ssh.load_configs, 'ssh_config_path' ->
+        # ssh.config_path, etc
+        ours = {
+            "authentication": {
+                "identities": [],
+                "strategy_class": None,
+            },
+            "connect_kwargs": {},
+            "forward_agent": False,
+            "gateway": None,
+            "inline_ssh_env": True,
+            "load_ssh_configs": True,
+            "port": 22,
+            "runners": {"remote": Remote, "remote_shell": RemoteShell},
+            "ssh_config_path": None,
+            "tasks": {"collection_name": "fabfile"},
+            # TODO: this becomes an override/extend once Invoke grows execution
+            # timeouts (which should be timeouts.execute)
+            "timeouts": {"connect": None},
+            "user": get_local_user(),
+        }
+        merge_dicts(defaults, ours)
+        return defaults
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/connection.py b/TP03/TP03/lib/python3.9/site-packages/fabric/connection.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d4c49b75f52ff42a71411525407b63c0a765f6a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/connection.py
@@ -0,0 +1,1115 @@
+from contextlib import contextmanager
+from io import StringIO
+from threading import Event
+import socket
+
+from decorator import decorator
+from invoke import Context
+from invoke.exceptions import ThreadException
+from paramiko.agent import AgentRequestHandler
+from paramiko.client import SSHClient, AutoAddPolicy
+from paramiko.config import SSHConfig
+from paramiko.proxy import ProxyCommand
+
+from .config import Config
+from .exceptions import InvalidV1Env
+from .transfer import Transfer
+from .tunnels import TunnelManager, Tunnel
+
+
+@decorator
+def opens(method, self, *args, **kwargs):
+    self.open()
+    return method(self, *args, **kwargs)
+
+
+def derive_shorthand(host_string):
+    user_hostport = host_string.rsplit("@", 1)
+    hostport = user_hostport.pop()
+    user = user_hostport[0] if user_hostport and user_hostport[0] else None
+
+    # IPv6: can't reliably tell where addr ends and port begins, so don't
+    # try (and don't bother adding special syntax either, user should avoid
+    # this situation by using port=).
+    if hostport.count(":") > 1:
+        host = hostport
+        port = None
+    # IPv4: can split on ':' reliably.
+    else:
+        host_port = hostport.rsplit(":", 1)
+        host = host_port.pop(0) or None
+        port = host_port[0] if host_port and host_port[0] else None
+
+    if port is not None:
+        port = int(port)
+
+    return {"user": user, "host": host, "port": port}
+
+
+class Connection(Context):
+    """
+    A connection to an SSH daemon, with methods for commands and file transfer.
+
+    **Basics**
+
+    This class inherits from Invoke's `~invoke.context.Context`, as it is a
+    context within which commands, tasks etc can operate. It also encapsulates
+    a Paramiko `~paramiko.client.SSHClient` instance, performing useful high
+    level operations with that `~paramiko.client.SSHClient` and
+    `~paramiko.channel.Channel` instances generated from it.
+
+    .. _connect_kwargs:
+
+    .. note::
+        Many SSH specific options -- such as specifying private keys and
+        passphrases, timeouts, disabling SSH agents, etc -- are handled
+        directly by Paramiko and should be specified via the
+        :ref:`connect_kwargs argument <connect_kwargs-arg>` of the constructor.
+
+    **Lifecycle**
+
+    `.Connection` has a basic "`create <__init__>`, `connect/open <open>`, `do
+    work <run>`, `disconnect/close <close>`" lifecycle:
+
+    - `Instantiation <__init__>` imprints the object with its connection
+      parameters (but does **not** actually initiate the network connection).
+
+        - An alternate constructor exists for users :ref:`upgrading piecemeal
+          from Fabric 1 <from-v1>`: `from_v1`
+
+    - Methods like `run`, `get` etc automatically trigger a call to
+      `open` if the connection is not active; users may of course call `open`
+      manually if desired.
+    - It's best to explicitly close your connections when done using them. This
+      can be accomplished by manually calling `close`, or by using the object
+      as a contextmanager::
+
+          with Connection('host') as c:
+             c.run('command')
+             c.put('file')
+
+      .. warning::
+          While Fabric (and Paramiko) attempt to register connections for
+          automatic garbage collection, it's not currently safe to rely on that
+          feature, as it can lead to end-of-process hangs and similar behavior.
+
+    .. note::
+        This class rebinds `invoke.context.Context.run` to `.local` so both
+        remote and local command execution can coexist.
+
+    **Configuration**
+
+    Most `.Connection` parameters honor :doc:`Invoke-style configuration
+    </concepts/configuration>` as well as any applicable :ref:`SSH config file
+    directives <connection-ssh-config>`. For example, to end up with a
+    connection to ``admin@myhost``, one could:
+
+    - Use any built-in config mechanism, such as ``/etc/fabric.yml``,
+      ``~/.fabric.json``, collection-driven configuration, env vars, etc,
+      stating ``user: admin`` (or ``{"user": "admin"}``, depending on config
+      format.) Then ``Connection('myhost')`` would implicitly have a ``user``
+      of ``admin``.
+    - Use an SSH config file containing ``User admin`` within any applicable
+      ``Host`` header (``Host myhost``, ``Host *``, etc.) Again,
+      ``Connection('myhost')`` will default to an ``admin`` user.
+    - Leverage host-parameter shorthand (described in `.Config.__init__`), i.e.
+      ``Connection('admin@myhost')``.
+    - Give the parameter directly: ``Connection('myhost', user='admin')``.
+
+    The same applies to agent forwarding, gateways, and so forth.
+
+    .. versionadded:: 2.0
+    """
+
+    # NOTE: these are initialized here to hint to invoke.Config.__setattr__
+    # that they should be treated as real attributes instead of config proxies.
+    # (Additionally, we're doing this instead of using invoke.Config._set() so
+    # we can take advantage of Sphinx's attribute-doc-comment static analysis.)
+    # Once an instance is created, these values will usually be non-None
+    # because they default to the default config values.
+    host = None
+    original_host = None
+    user = None
+    port = None
+    ssh_config = None
+    gateway = None
+    forward_agent = None
+    connect_timeout = None
+    connect_kwargs = None
+    client = None
+    transport = None
+    _sftp = None
+    _agent_handler = None
+
+    @classmethod
+    def from_v1(cls, env, **kwargs):
+        """
+        Alternate constructor which uses Fabric 1's ``env`` dict for settings.
+
+        All keyword arguments besides ``env`` are passed unmolested into the
+        primary constructor.
+
+        .. warning::
+            Because your own config overrides will win over data from ``env``,
+            make sure you only set values you *intend* to change from your v1
+            environment!
+
+        For details on exactly which ``env`` vars are imported and what they
+        become in the new API, please see :ref:`v1-env-var-imports`.
+
+        :param env:
+            An explicit Fabric 1 ``env`` dict (technically, any
+            ``fabric.utils._AttributeDict`` instance should work) to pull
+            configuration from.
+
+        .. versionadded:: 2.4
+        """
+        # TODO: import fabric.state.env (need good way to test it first...)
+        # TODO: how to handle somebody accidentally calling this in a process
+        # where 'fabric' is fabric 2, and there's no fabric 1? Probably just a
+        # re-raise of ImportError??
+        # Our only requirement is a non-empty host_string
+        if not env.host_string:
+            raise InvalidV1Env(
+                "Supplied v1 env has an empty `host_string` value! Please make sure you're calling Connection.from_v1 within a connected Fabric 1 session."  # noqa
+            )
+        # TODO: detect collisions with kwargs & except instead of overwriting?
+        # (More Zen of Python compliant, but also, effort, and also, makes it
+        # harder for users to intentionally overwrite!)
+        connect_kwargs = kwargs.setdefault("connect_kwargs", {})
+        kwargs.setdefault("host", env.host_string)
+        shorthand = derive_shorthand(env.host_string)
+        # TODO: don't we need to do the below skipping for user too?
+        kwargs.setdefault("user", env.user)
+        # Skip port if host string seemed to have it; otherwise we hit our own
+        # ambiguity clause in __init__. v1 would also have been doing this
+        # anyways (host string wins over other settings).
+        if not shorthand["port"]:
+            # Run port through int(); v1 inexplicably has a string default...
+            kwargs.setdefault("port", int(env.port))
+        # key_filename defaults to None in v1, but in v2, we expect it to be
+        # either unset, or set to a list. Thus, we only pull it over if it is
+        # not None.
+        if env.key_filename is not None:
+            connect_kwargs.setdefault("key_filename", env.key_filename)
+        # Obtain config values, if not given, from its own from_v1
+        # NOTE: not using setdefault as we truly only want to call
+        # Config.from_v1 when necessary.
+        if "config" not in kwargs:
+            kwargs["config"] = Config.from_v1(env)
+        return cls(**kwargs)
+
+    # TODO: should "reopening" an existing Connection object that has been
+    # closed, be allowed? (See e.g. how v1 detects closed/semi-closed
+    # connections & nukes them before creating a new client to the same host.)
+    # TODO: push some of this into paramiko.client.Client? e.g. expand what
+    # Client.exec_command does, it already allows configuring a subset of what
+    # we do / will eventually do / did in 1.x. It's silly to have to do
+    # .get_transport().open_session().
+    def __init__(
+        self,
+        host,
+        user=None,
+        port=None,
+        config=None,
+        gateway=None,
+        forward_agent=None,
+        connect_timeout=None,
+        connect_kwargs=None,
+        inline_ssh_env=None,
+    ):
+        """
+        Set up a new object representing a server connection.
+
+        :param str host:
+            the hostname (or IP address) of this connection.
+
+            May include shorthand for the ``user`` and/or ``port`` parameters,
+            of the form ``user@host``, ``host:port``, or ``user@host:port``.
+
+            .. note::
+                Due to ambiguity, IPv6 host addresses are incompatible with the
+                ``host:port`` shorthand (though ``user@host`` will still work
+                OK). In other words, the presence of >1 ``:`` character will
+                prevent any attempt to derive a shorthand port number; use the
+                explicit ``port`` parameter instead.
+
+            .. note::
+                If ``host`` matches a ``Host`` clause in loaded SSH config
+                data, and that ``Host`` clause contains a ``Hostname``
+                directive, the resulting `.Connection` object will behave as if
+                ``host`` is equal to that ``Hostname`` value.
+
+                In all cases, the original value of ``host`` is preserved as
+                the ``original_host`` attribute.
+
+                Thus, given SSH config like so::
+
+                    Host myalias
+                        Hostname realhostname
+
+                a call like ``Connection(host='myalias')`` will result in an
+                object whose ``host`` attribute is ``realhostname``, and whose
+                ``original_host`` attribute is ``myalias``.
+
+        :param str user:
+            the login user for the remote connection. Defaults to
+            ``config.user``.
+
+        :param int port:
+            the remote port. Defaults to ``config.port``.
+
+        :param config:
+            configuration settings to use when executing methods on this
+            `.Connection` (e.g. default SSH port and so forth).
+
+            Should be a `.Config` or an `invoke.config.Config`
+            (which will be turned into a `.Config`).
+
+            Default is an anonymous `.Config` object.
+
+        :param gateway:
+            An object to use as a proxy or gateway for this connection.
+
+            This parameter accepts one of the following:
+
+            - another `.Connection` (for a ``ProxyJump`` style gateway);
+            - a shell command string (for a ``ProxyCommand`` style style
+              gateway).
+
+            Default: ``None``, meaning no gatewaying will occur (unless
+            otherwise configured; if one wants to override a configured gateway
+            at runtime, specify ``gateway=False``.)
+
+            .. seealso:: :ref:`ssh-gateways`
+
+        :param bool forward_agent:
+            Whether to enable SSH agent forwarding.
+
+            Default: ``config.forward_agent``.
+
+        :param int connect_timeout:
+            Connection timeout, in seconds.
+
+            Default: ``config.timeouts.connect``.
+
+
+        :param dict connect_kwargs:
+
+            .. _connect_kwargs-arg:
+
+            Keyword arguments handed verbatim to
+            `SSHClient.connect <paramiko.client.SSHClient.connect>` (when
+            `.open` is called).
+
+            `.Connection` tries not to grow additional settings/kwargs of its
+            own unless it is adding value of some kind; thus,
+            ``connect_kwargs`` is currently the right place to hand in paramiko
+            connection parameters such as ``pkey`` or ``key_filename``. For
+            example::
+
+                c = Connection(
+                    host="hostname",
+                    user="admin",
+                    connect_kwargs={
+                        "key_filename": "/home/myuser/.ssh/private.key",
+                    },
+                )
+
+            Default: ``config.connect_kwargs``.
+
+        :param bool inline_ssh_env:
+            Whether to send environment variables "inline" as prefixes in front
+            of command strings (``export VARNAME=value && mycommand here``;
+            this is the default behavior), or submit them through the SSH
+            protocol itself.
+
+            In Fabric 2.x this defaulted to ``False`` (try using the protocol
+            behavior), but in 3.x it changed to ``True`` due to the simple fact
+            that most remote servers are deployed with a restricted
+            ``AcceptEnv`` setting, making use of the protocol approach
+            non-viable.
+
+            The actual default value is the value of the ``inline_ssh_env``
+            :ref:`configuration value <default-values>` (which, as above,
+            currently defaults to ``True``).
+
+            .. warning::
+                This functionality does **not** currently perform any shell
+                escaping on your behalf! Be careful when using nontrivial
+                values, and note that you can put in your own quoting,
+                backslashing etc if desired.
+
+                Consider using a different approach (such as actual
+                remote shell scripts) if you run into too many issues here.
+
+            .. note::
+                When serializing into prefixed ``FOO=bar`` format, we apply the
+                builtin `sorted` function to the env dictionary's keys, to
+                remove what would otherwise be ambiguous/arbitrary ordering.
+
+            .. note::
+                This setting has no bearing on *local* shell commands; it only
+                affects remote commands, and thus, methods like `.run` and
+                `.sudo`.
+
+        :raises ValueError:
+            if user or port values are given via both ``host`` shorthand *and*
+            their own arguments. (We `refuse the temptation to guess`_).
+
+        .. _refuse the temptation to guess:
+            http://zen-of-python.info/
+            in-the-face-of-ambiguity-refuse-the-temptation-to-guess.html#12
+
+        .. versionchanged:: 2.3
+            Added the ``inline_ssh_env`` parameter.
+
+        .. versionchanged:: 3.0
+            ``inline_ssh_env`` still defaults to the config value, but said
+            config value has now changed and defaults to ``True``, not
+            ``False``.
+        """
+        # NOTE: parent __init__ sets self._config; for now we simply overwrite
+        # that below. If it's somehow problematic we would want to break parent
+        # __init__ up in a manner that is more cleanly overrideable.
+        super().__init__(config=config)
+
+        #: The .Config object referenced when handling default values (for e.g.
+        #: user or port, when not explicitly given) or deciding how to behave.
+        if config is None:
+            config = Config()
+        # Handle 'vanilla' Invoke config objects, which need cloning 'into' one
+        # of our own Configs (which grants the new defaults, etc, while not
+        # squashing them if the Invoke-level config already accounted for them)
+        elif not isinstance(config, Config):
+            config = config.clone(into=Config)
+        self._set(_config=config)
+        # TODO: when/how to run load_files, merge, load_shell_env, etc?
+        # TODO: i.e. what is the lib use case here (and honestly in invoke too)
+
+        shorthand = self.derive_shorthand(host)
+        host = shorthand["host"]
+        err = "You supplied the {} via both shorthand and kwarg! Please pick one."  # noqa
+        if shorthand["user"] is not None:
+            if user is not None:
+                raise ValueError(err.format("user"))
+            user = shorthand["user"]
+        if shorthand["port"] is not None:
+            if port is not None:
+                raise ValueError(err.format("port"))
+            port = shorthand["port"]
+
+        # NOTE: we load SSH config data as early as possible as it has
+        # potential to affect nearly every other attribute.
+        #: The per-host SSH config data, if any. (See :ref:`ssh-config`.)
+        self.ssh_config = self.config.base_ssh_config.lookup(host)
+
+        self.original_host = host
+        #: The hostname of the target server.
+        self.host = host
+        if "hostname" in self.ssh_config:
+            # TODO: log that this occurred?
+            self.host = self.ssh_config["hostname"]
+
+        #: The username this connection will use to connect to the remote end.
+        self.user = user or self.ssh_config.get("user", self.config.user)
+        # TODO: is it _ever_ possible to give an empty user value (e.g.
+        # user='')? E.g. do some SSH server specs allow for that?
+
+        #: The network port to connect on.
+        self.port = port or int(self.ssh_config.get("port", self.config.port))
+
+        # Gateway/proxy/bastion/jump setting: non-None values - string,
+        # Connection, even eg False - get set directly; None triggers seek in
+        # config/ssh_config
+        #: The gateway `.Connection` or ``ProxyCommand`` string to be used,
+        #: if any.
+        self.gateway = gateway if gateway is not None else self.get_gateway()
+        # NOTE: we use string above, vs ProxyCommand obj, to avoid spinning up
+        # the ProxyCommand subprocess at init time, vs open() time.
+        # TODO: make paramiko.proxy.ProxyCommand lazy instead?
+
+        if forward_agent is None:
+            # Default to config...
+            forward_agent = self.config.forward_agent
+            # But if ssh_config is present, it wins
+            if "forwardagent" in self.ssh_config:
+                # TODO: SSHConfig really, seriously needs some love here, god
+                map_ = {"yes": True, "no": False}
+                forward_agent = map_[self.ssh_config["forwardagent"]]
+        #: Whether agent forwarding is enabled.
+        self.forward_agent = forward_agent
+
+        if connect_timeout is None:
+            connect_timeout = self.ssh_config.get(
+                "connecttimeout", self.config.timeouts.connect
+            )
+        if connect_timeout is not None:
+            connect_timeout = int(connect_timeout)
+        #: Connection timeout
+        self.connect_timeout = connect_timeout
+
+        #: Keyword arguments given to `paramiko.client.SSHClient.connect` when
+        #: `open` is called.
+        self.connect_kwargs = self.resolve_connect_kwargs(connect_kwargs)
+
+        #: The `paramiko.client.SSHClient` instance this connection wraps.
+        client = SSHClient()
+        client.set_missing_host_key_policy(AutoAddPolicy())
+        self.client = client
+
+        #: A convenience handle onto the return value of
+        #: ``self.client.get_transport()`` (after connection time).
+        self.transport = None
+
+        if inline_ssh_env is None:
+            inline_ssh_env = self.config.inline_ssh_env
+        #: Whether to construct remote command lines with env vars prefixed
+        #: inline.
+        self.inline_ssh_env = inline_ssh_env
+
+    def resolve_connect_kwargs(self, connect_kwargs):
+        # TODO: is it better to pre-empt conflicts w/ manually-handled
+        # connect() kwargs (hostname, username, etc) here or in open()? We're
+        # doing open() for now in case e.g. someone manually modifies
+        # .connect_kwargs attributewise, but otherwise it feels better to do it
+        # early instead of late.
+        constructor_kwargs = connect_kwargs or {}
+        config_kwargs = self.config.connect_kwargs
+        constructor_keys = constructor_kwargs.get("key_filename", [])
+        config_keys = config_kwargs.get("key_filename", [])
+        ssh_config_keys = self.ssh_config.get("identityfile", [])
+
+        # Default data: constructor if given, config otherwise
+        final_kwargs = constructor_kwargs or config_kwargs
+
+        # Key filename: merge, in order, config (which includes CLI flags),
+        # then constructor kwargs, and finally SSH config file data.
+        # Make sure all are normalized to list as well!
+        final_keys = []
+        for value in (config_keys, constructor_keys, ssh_config_keys):
+            if isinstance(value, str):
+                value = [value]
+            final_keys.extend(value)
+        # Only populate if non-empty.
+        if final_keys:
+            final_kwargs["key_filename"] = final_keys
+
+        return final_kwargs
+
+    def get_gateway(self):
+        # SSH config wins over Invoke-style config
+        if "proxyjump" in self.ssh_config:
+            # Reverse hop1,hop2,hop3 style ProxyJump directive so we start
+            # with the final (itself non-gatewayed) hop and work up to
+            # the front (actual, supplied as our own gateway) hop
+            hops = reversed(self.ssh_config["proxyjump"].split(","))
+            prev_gw = None
+            for hop in hops:
+                # Short-circuit if we appear to be our own proxy, which would
+                # be a RecursionError. Implies SSH config wildcards.
+                # TODO: in an ideal world we'd check user/port too in case they
+                # differ, but...seriously? They can file a PR with those extra
+                # half dozen test cases in play, E_NOTIME
+                if self.derive_shorthand(hop)["host"] == self.host:
+                    return None
+                # Happily, ProxyJump uses identical format to our host
+                # shorthand...
+                kwargs = dict(config=self.config.clone())
+                if prev_gw is not None:
+                    kwargs["gateway"] = prev_gw
+                cxn = Connection(hop, **kwargs)
+                prev_gw = cxn
+            return prev_gw
+        elif "proxycommand" in self.ssh_config:
+            # Just a string, which we interpret as a proxy command..
+            return self.ssh_config["proxycommand"]
+        # Fallback: config value (may be None).
+        return self.config.gateway
+
+    def __repr__(self):
+        # Host comes first as it's the most common differentiator by far
+        bits = [("host", self.host)]
+        # TODO: maybe always show user regardless? Explicit is good...
+        if self.user != self.config.user:
+            bits.append(("user", self.user))
+        # TODO: harder to make case for 'always show port'; maybe if it's
+        # non-22 (even if config has overridden the local default)?
+        if self.port != self.config.port:
+            bits.append(("port", self.port))
+        # NOTE: sometimes self.gateway may be eg False if someone wants to
+        # explicitly override a configured non-None value (as otherwise it's
+        # impossible for __init__ to tell if a None means "nothing given" or
+        # "seriously please no gatewaying". So, this must always be a vanilla
+        # truth test and not eg "is not None".
+        if self.gateway:
+            # Displaying type because gw params would probs be too verbose
+            val = "proxyjump"
+            if isinstance(self.gateway, str):
+                val = "proxycommand"
+            bits.append(("gw", val))
+        return "<Connection {}>".format(
+            " ".join("{}={}".format(*x) for x in bits)
+        )
+
+    def _identity(self):
+        # TODO: consider including gateway and maybe even other init kwargs?
+        # Whether two cxns w/ same user/host/port but different
+        # gateway/keys/etc, should be considered "the same", is unclear.
+        return (self.host, self.user, self.port)
+
+    def __eq__(self, other):
+        if not isinstance(other, Connection):
+            return False
+        return self._identity() == other._identity()
+
+    def __lt__(self, other):
+        return self._identity() < other._identity()
+
+    def __hash__(self):
+        # NOTE: this departs from Context/DataProxy, which is not usefully
+        # hashable.
+        return hash(self._identity())
+
+    def derive_shorthand(self, host_string):
+        # NOTE: used to be defined inline; preserving API call for both
+        # backwards compatibility and because it seems plausible we may want to
+        # modify behavior later, using eg config or other attributes.
+        return derive_shorthand(host_string)
+
+    @property
+    def is_connected(self):
+        """
+        Whether or not this connection is actually open.
+
+        .. versionadded:: 2.0
+        """
+        return self.transport.active if self.transport else False
+
+    def open(self):
+        """
+        Initiate an SSH connection to the host/port this object is bound to.
+
+        This may include activating the configured gateway connection, if one
+        is set.
+
+        Also saves a handle to the now-set Transport object for easier access.
+
+        Various connect-time settings (and/or their corresponding :ref:`SSH
+        config options <ssh-config>`) are utilized here in the call to
+        `SSHClient.connect <paramiko.client.SSHClient.connect>`. (For details,
+        see :doc:`the configuration docs </concepts/configuration>`.)
+
+        :returns:
+            The result of the internal call to `.SSHClient.connect`, if
+            performing an initial connection; ``None`` otherwise.
+
+        .. versionadded:: 2.0
+        .. versionchanged:: 3.1
+            Now returns the inner Paramiko connect call's return value instead
+            of always returning the implicit ``None``.
+        """
+        # Short-circuit
+        if self.is_connected:
+            return
+        err = "Refusing to be ambiguous: connect() kwarg '{}' was given both via regular arg and via connect_kwargs!"  # noqa
+        # These may not be given, period
+        for key in """
+            hostname
+            port
+            username
+        """.split():
+            if key in self.connect_kwargs:
+                raise ValueError(err.format(key))
+        # These may be given one way or the other, but not both
+        if (
+            "timeout" in self.connect_kwargs
+            and self.connect_timeout is not None
+        ):
+            raise ValueError(err.format("timeout"))
+        # No conflicts -> merge 'em together
+        kwargs = dict(
+            self.connect_kwargs,
+            username=self.user,
+            hostname=self.host,
+            port=self.port,
+        )
+        if self.gateway:
+            kwargs["sock"] = self.open_gateway()
+        if self.connect_timeout:
+            kwargs["timeout"] = self.connect_timeout
+        # Strip out empty defaults for less noisy debugging
+        if "key_filename" in kwargs and not kwargs["key_filename"]:
+            del kwargs["key_filename"]
+        auth_strategy_class = self.authentication.strategy_class
+        if auth_strategy_class is not None:
+            # Pop connect_kwargs related to auth to avoid giving Paramiko
+            # conflicting signals.
+            for key in (
+                "allow_agent",
+                "key_filename",
+                "look_for_keys",
+                "passphrase",
+                "password",
+                "pkey",
+                "username",
+            ):
+                kwargs.pop(key, None)
+
+            kwargs["auth_strategy"] = auth_strategy_class(
+                ssh_config=self.ssh_config,
+                fabric_config=self.config,
+                username=self.user,
+            )
+        # Actually connect!
+        result = self.client.connect(**kwargs)
+        self.transport = self.client.get_transport()
+        return result
+
+    def open_gateway(self):
+        """
+        Obtain a socket-like object from `gateway`.
+
+        :returns:
+            A ``direct-tcpip`` `paramiko.channel.Channel`, if `gateway` was a
+            `.Connection`; or a `~paramiko.proxy.ProxyCommand`, if `gateway`
+            was a string.
+
+        .. versionadded:: 2.0
+        """
+        # ProxyCommand is faster to set up, so do it first.
+        if isinstance(self.gateway, str):
+            # Leverage a dummy SSHConfig to ensure %h/%p/etc are parsed.
+            # TODO: use real SSH config once loading one properly is
+            # implemented.
+            ssh_conf = SSHConfig()
+            dummy = "Host {}\n    ProxyCommand {}"
+            ssh_conf.parse(StringIO(dummy.format(self.host, self.gateway)))
+            return ProxyCommand(ssh_conf.lookup(self.host)["proxycommand"])
+        # Handle inner-Connection gateway type here.
+        # TODO: logging
+        self.gateway.open()
+        # TODO: expose the opened channel itself as an attribute? (another
+        # possible argument for separating the two gateway types...) e.g. if
+        # someone wanted to piggyback on it for other same-interpreter socket
+        # needs...
+        # TODO: and the inverse? allow users to supply their own socket/like
+        # object they got via $WHEREEVER?
+        # TODO: how best to expose timeout param? reuse general connection
+        # timeout from config?
+        return self.gateway.transport.open_channel(
+            kind="direct-tcpip",
+            dest_addr=(self.host, int(self.port)),
+            # NOTE: src_addr needs to be 'empty but not None' values to
+            # correctly encode into a network message. Theoretically Paramiko
+            # could auto-interpret None sometime & save us the trouble.
+            src_addr=("", 0),
+        )
+
+    def close(self):
+        """
+        Terminate the network connection to the remote end, if open.
+
+        If any SFTP sessions are open, they will also be closed.
+
+        If no connection or SFTP session is open, this method does nothing.
+
+        .. versionadded:: 2.0
+        .. versionchanged:: 3.0
+            Now closes SFTP sessions too (2.x required manually doing so).
+        """
+        if self._sftp is not None:
+            self._sftp.close()
+            self._sftp = None
+
+        if self.is_connected:
+            self.client.close()
+            if self.forward_agent and self._agent_handler is not None:
+                self._agent_handler.close()
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *exc):
+        self.close()
+
+    @opens
+    def create_session(self):
+        channel = self.transport.open_session()
+        if self.forward_agent:
+            self._agent_handler = AgentRequestHandler(channel)
+        return channel
+
+    def _remote_runner(self):
+        return self.config.runners.remote(
+            context=self, inline_env=self.inline_ssh_env
+        )
+
+    @opens
+    def run(self, command, **kwargs):
+        """
+        Execute a shell command on the remote end of this connection.
+
+        This method wraps an SSH-capable implementation of
+        `invoke.runners.Runner.run`; see its documentation for details.
+
+        .. warning::
+            There are a few spots where Fabric departs from Invoke's default
+            settings/behaviors; they are documented under
+            `.Config.global_defaults`.
+
+        .. versionadded:: 2.0
+        """
+        return self._run(self._remote_runner(), command, **kwargs)
+
+    @opens
+    def sudo(self, command, **kwargs):
+        """
+        Execute a shell command, via ``sudo``, on the remote end.
+
+        This method is identical to `invoke.context.Context.sudo` in every way,
+        except in that -- like `run` -- it honors per-host/per-connection
+        configuration overrides in addition to the generic/global ones. Thus,
+        for example, per-host sudo passwords may be configured.
+
+        .. versionadded:: 2.0
+        """
+        return self._sudo(self._remote_runner(), command, **kwargs)
+
+    @opens
+    def shell(self, **kwargs):
+        """
+        Run an interactive login shell on the remote end, as with ``ssh``.
+
+        This method is intended strictly for use cases where you can't know
+        what remote shell to invoke, or are connecting to a non-POSIX-server
+        environment such as a network appliance or other custom SSH server.
+        Nearly every other use case, including interactively-focused ones, will
+        be better served by using `run` plus an explicit remote shell command
+        (eg ``bash``).
+
+        `shell` has the following differences in behavior from `run`:
+
+        - It still returns a `~invoke.runners.Result` instance, but the object
+          will have a less useful set of attributes than with `run` or `local`:
+
+            - ``command`` will be ``None``, as there is no such input argument.
+            - ``stdout`` will contain a full record of the session, including
+              all interactive input, as that is echoed back to the user. This
+              can be useful for logging but is much less so for doing
+              programmatic things after the method returns.
+            - ``stderr`` will always be empty (same as `run` when
+              ``pty==True``).
+            - ``pty`` will always be True (because one was automatically used).
+            - ``exited`` and similar attributes will only reflect the overall
+              session, which may vary by shell or appliance but often has no
+              useful relationship with the internally executed commands' exit
+              codes.
+
+        - This method behaves as if ``warn`` is set to ``True``: even if the
+          remote shell exits uncleanly, no exception will be raised.
+        - A pty is always allocated remotely, as with ``pty=True`` under `run`.
+        - The ``inline_env`` setting is ignored, as there is no default shell
+          command to add the parameters to (and no guarantee the remote end
+          even is a shell!)
+
+        It supports **only** the following kwargs, which behave identically to
+        their counterparts in `run` unless otherwise stated:
+
+        - ``encoding``
+        - ``env``
+        - ``in_stream`` (useful in niche cases, but make sure regular `run`
+          with this argument isn't more suitable!)
+        - ``replace_env``
+        - ``watchers`` (note that due to pty echoing your stdin back to stdout,
+          a watcher will see your input as well as program stdout!)
+
+        Those keyword arguments also honor the ``run.*`` configuration tree, as
+        in `run`/`sudo`.
+
+        :returns: `~invoke.runners.Result`
+
+        :raises:
+            `~invoke.exceptions.ThreadException` (if the background I/O threads
+            encountered exceptions other than
+            `~invoke.exceptions.WatcherError`).
+
+        .. versionadded:: 2.7
+        """
+        runner = self.config.runners.remote_shell(context=self)
+        # Reinstate most defaults as explicit kwargs to ensure user's config
+        # doesn't make this mode break horribly. Then override a few that need
+        # to change, like pty.
+        allowed = ("encoding", "env", "in_stream", "replace_env", "watchers")
+        new_kwargs = {}
+        for key, value in self.config.global_defaults()["run"].items():
+            if key in allowed:
+                # Use allowed kwargs if given, otherwise also fill them from
+                # defaults
+                new_kwargs[key] = kwargs.pop(key, self.config.run[key])
+            else:
+                new_kwargs[key] = value
+        new_kwargs.update(pty=True)
+        # At this point, any leftover kwargs would be ignored, so yell instead
+        if kwargs:
+            err = "shell() got unexpected keyword arguments: {!r}"
+            raise TypeError(err.format(list(kwargs.keys())))
+        return runner.run(command=None, **new_kwargs)
+
+    def local(self, *args, **kwargs):
+        """
+        Execute a shell command on the local system.
+
+        This method is effectively a wrapper of `invoke.run`; see its docs for
+        details and call signature.
+
+        .. versionadded:: 2.0
+        """
+        # Superclass run() uses runners.local, so we can literally just call it
+        # straight.
+        return super().run(*args, **kwargs)
+
+    @opens
+    def sftp(self):
+        """
+        Return a `~paramiko.sftp_client.SFTPClient` object.
+
+        If called more than one time, memoizes the first result; thus, any
+        given `.Connection` instance will only ever have a single SFTP client,
+        and state (such as that managed by
+        `~paramiko.sftp_client.SFTPClient.chdir`) will be preserved.
+
+        .. versionadded:: 2.0
+        """
+        if self._sftp is None:
+            self._sftp = self.client.open_sftp()
+        return self._sftp
+
+    def get(self, *args, **kwargs):
+        """
+        Get a remote file to the local filesystem or file-like object.
+
+        Simply a wrapper for `.Transfer.get`. Please see its documentation for
+        all details.
+
+        .. versionadded:: 2.0
+        """
+        return Transfer(self).get(*args, **kwargs)
+
+    def put(self, *args, **kwargs):
+        """
+        Put a local file (or file-like object) to the remote filesystem.
+
+        Simply a wrapper for `.Transfer.put`. Please see its documentation for
+        all details.
+
+        .. versionadded:: 2.0
+        """
+        return Transfer(self).put(*args, **kwargs)
+
+    # TODO: yield the socket for advanced users? Other advanced use cases
+    # (perhaps factor out socket creation itself)?
+    # TODO: probably push some of this down into Paramiko
+    @contextmanager
+    @opens
+    def forward_local(
+        self,
+        local_port,
+        remote_port=None,
+        remote_host="localhost",
+        local_host="localhost",
+    ):
+        """
+        Open a tunnel connecting ``local_port`` to the server's environment.
+
+        For example, say you want to connect to a remote PostgreSQL database
+        which is locked down and only accessible via the system it's running
+        on. You have SSH access to this server, so you can temporarily make
+        port 5432 on your local system act like port 5432 on the server::
+
+            import psycopg2
+            from fabric import Connection
+
+            with Connection('my-db-server').forward_local(5432):
+                db = psycopg2.connect(
+                    host='localhost', port=5432, database='mydb'
+                )
+                # Do things with 'db' here
+
+        This method is analogous to using the ``-L`` option of OpenSSH's
+        ``ssh`` program.
+
+        :param int local_port: The local port number on which to listen.
+
+        :param int remote_port:
+            The remote port number. Defaults to the same value as
+            ``local_port``.
+
+        :param str local_host:
+            The local hostname/interface on which to listen. Default:
+            ``localhost``.
+
+        :param str remote_host:
+            The remote hostname serving the forwarded remote port. Default:
+            ``localhost`` (i.e., the host this `.Connection` is connected to.)
+
+        :returns:
+            Nothing; this method is only useful as a context manager affecting
+            local operating system state.
+
+        .. versionadded:: 2.0
+        """
+        if not remote_port:
+            remote_port = local_port
+
+        # TunnelManager does all of the work, sitting in the background (so we
+        # can yield) and spawning threads every time somebody connects to our
+        # local port.
+        finished = Event()
+        manager = TunnelManager(
+            local_port=local_port,
+            local_host=local_host,
+            remote_port=remote_port,
+            remote_host=remote_host,
+            # TODO: not a huge fan of handing in our transport, but...?
+            transport=self.transport,
+            finished=finished,
+        )
+        manager.start()
+
+        # Return control to caller now that things ought to be operational
+        try:
+            yield
+        # Teardown once user exits block
+        finally:
+            # Signal to manager that it should close all open tunnels
+            finished.set()
+            # Then wait for it to do so
+            manager.join()
+            # Raise threading errors from within the manager, which would be
+            # one of:
+            # - an inner ThreadException, which was created by the manager on
+            # behalf of its Tunnels; this gets directly raised.
+            # - some other exception, which would thus have occurred in the
+            # manager itself; we wrap this in a new ThreadException.
+            # NOTE: in these cases, some of the metadata tracking in
+            # ExceptionHandlingThread/ExceptionWrapper/ThreadException (which
+            # is useful when dealing with multiple nearly-identical sibling IO
+            # threads) is superfluous, but it doesn't feel worth breaking
+            # things up further; we just ignore it for now.
+            wrapper = manager.exception()
+            if wrapper is not None:
+                if wrapper.type is ThreadException:
+                    raise wrapper.value
+                else:
+                    raise ThreadException([wrapper])
+
+            # TODO: cancel port forward on transport? Does that even make sense
+            # here (where we used direct-tcpip) vs the opposite method (which
+            # is what uses forward-tcpip)?
+
+    # TODO: probably push some of this down into Paramiko
+    @contextmanager
+    @opens
+    def forward_remote(
+        self,
+        remote_port,
+        local_port=None,
+        remote_host="127.0.0.1",
+        local_host="localhost",
+    ):
+        """
+        Open a tunnel connecting ``remote_port`` to the local environment.
+
+        For example, say you're running a daemon in development mode on your
+        workstation at port 8080, and want to funnel traffic to it from a
+        production or staging environment.
+
+        In most situations this isn't possible as your office/home network
+        probably blocks inbound traffic. But you have SSH access to this
+        server, so you can temporarily make port 8080 on that server act like
+        port 8080 on your workstation::
+
+            from fabric import Connection
+
+            c = Connection('my-remote-server')
+            with c.forward_remote(8080):
+                c.run("remote-data-writer --port 8080")
+                # Assuming remote-data-writer runs until interrupted, this will
+                # stay open until you Ctrl-C...
+
+        This method is analogous to using the ``-R`` option of OpenSSH's
+        ``ssh`` program.
+
+        :param int remote_port: The remote port number on which to listen.
+
+        :param int local_port:
+            The local port number. Defaults to the same value as
+            ``remote_port``.
+
+        :param str local_host:
+            The local hostname/interface the forwarded connection talks to.
+            Default: ``localhost``.
+
+        :param str remote_host:
+            The remote interface address to listen on when forwarding
+            connections. Default: ``127.0.0.1`` (i.e. only listen on the remote
+            localhost).
+
+        :returns:
+            Nothing; this method is only useful as a context manager affecting
+            local operating system state.
+
+        .. versionadded:: 2.0
+        """
+        if not local_port:
+            local_port = remote_port
+        # Callback executes on each connection to the remote port and is given
+        # a Channel hooked up to said port. (We don't actually care about the
+        # source/dest host/port pairs at all; only whether the channel has data
+        # to read and suchlike.)
+        # We then pair that channel with a new 'outbound' socket connection to
+        # the local host/port being forwarded, in a new Tunnel.
+        # That Tunnel is then added to a shared data structure so we can track
+        # & close them during shutdown.
+        #
+        # TODO: this approach is less than ideal because we have to share state
+        # between ourselves & the callback handed into the transport's own
+        # thread handling (which is roughly analogous to our self-controlled
+        # TunnelManager for local forwarding). See if we can use more of
+        # Paramiko's API (or improve it and then do so) so that isn't
+        # necessary.
+        tunnels = []
+
+        def callback(channel, src_addr_tup, dst_addr_tup):
+            sock = socket.socket()
+            # TODO: handle connection failure such that channel, etc get closed
+            sock.connect((local_host, local_port))
+            # TODO: we don't actually need to generate the Events at our level,
+            # do we? Just let Tunnel.__init__ do it; all we do is "press its
+            # button" on shutdown...
+            tunnel = Tunnel(channel=channel, sock=sock, finished=Event())
+            tunnel.start()
+            # Communication between ourselves & the Paramiko handling subthread
+            tunnels.append(tunnel)
+
+        # Ask Paramiko (really, the remote sshd) to call our callback whenever
+        # connections are established on the remote iface/port.
+        # transport.request_port_forward(remote_host, remote_port, callback)
+        try:
+            self.transport.request_port_forward(
+                address=remote_host, port=remote_port, handler=callback
+            )
+            yield
+        finally:
+            # TODO: see above re: lack of a TunnelManager
+            # TODO: and/or also refactor with TunnelManager re: shutdown logic.
+            # E.g. maybe have a non-thread TunnelManager-alike with a method
+            # that acts as the callback? At least then there's a tiny bit more
+            # encapsulation...meh.
+            for tunnel in tunnels:
+                tunnel.finished.set()
+                tunnel.join()
+            self.transport.cancel_port_forward(
+                address=remote_host, port=remote_port
+            )
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/exceptions.py b/TP03/TP03/lib/python3.9/site-packages/fabric/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..f965219e1732426b3ffaf361a702aa875bb29121
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/exceptions.py
@@ -0,0 +1,26 @@
+# TODO: this may want to move to Invoke if we can find a use for it there too?
+# Or make it _more_ narrowly focused and stay here?
+class NothingToDo(Exception):
+    pass
+
+
+class GroupException(Exception):
+    """
+    Lightweight exception wrapper for `.GroupResult` when one contains errors.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(self, result):
+        #: The `.GroupResult` object which would have been returned, had there
+        #: been no errors. See its docstring (and that of `.Group`) for
+        #: details.
+        self.result = result
+
+
+class InvalidV1Env(Exception):
+    """
+    Raised when attempting to import a Fabric 1 ``env`` which is missing data.
+    """
+
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/executor.py b/TP03/TP03/lib/python3.9/site-packages/fabric/executor.py
new file mode 100644
index 0000000000000000000000000000000000000000..4ef06f684738a17d487b511daf27b9bd33c93c39
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/executor.py
@@ -0,0 +1,127 @@
+import invoke
+from invoke import Call, Task
+
+from .tasks import ConnectionCall
+from .exceptions import NothingToDo
+from .util import debug
+
+
+class Executor(invoke.Executor):
+    """
+    `~invoke.executor.Executor` subclass which understands Fabric concepts.
+
+    Designed to work in tandem with Fabric's `@task
+    <fabric.tasks.task>`/`~fabric.tasks.Task`, and is capable of acting on
+    information stored on the resulting objects -- such as default host lists.
+
+    This class is written to be backwards compatible with vanilla Invoke-level
+    tasks, which it simply delegates to its superclass.
+
+    Please see the parent class' `documentation <invoke.executor.Executor>` for
+    details on most public API members and object lifecycle.
+    """
+
+    def normalize_hosts(self, hosts):
+        """
+        Normalize mixed host-strings-or-kwarg-dicts into kwarg dicts only.
+
+        In other words, transforms data taken from the CLI (--hosts, always
+        strings) or decorator arguments (may be strings or kwarg dicts) into
+        kwargs suitable for creating Connection instances.
+
+        Subclasses may wish to override or extend this to perform, for example,
+        database or custom config file lookups (vs this default behavior, which
+        is to simply assume that strings are 'host' kwargs).
+
+        :param hosts:
+            Potentially heterogenous list of host connection values, as per the
+            ``hosts`` param to `.task`.
+
+        :returns: Homogenous list of Connection init kwarg dicts.
+        """
+        dicts = []
+        for value in hosts or []:
+            # Assume first posarg to Connection() if not already a dict.
+            if not isinstance(value, dict):
+                value = dict(host=value)
+            dicts.append(value)
+        return dicts
+
+    def expand_calls(self, calls, apply_hosts=True):
+        # Generate new call list with per-host variants & Connections inserted
+        ret = []
+        cli_hosts = []
+        host_str = self.core[0].args.hosts.value
+        if apply_hosts and host_str:
+            cli_hosts = host_str.split(",")
+        for call in calls:
+            if isinstance(call, Task):
+                call = Call(task=call)
+            # TODO: expand this to allow multiple types of execution plans,
+            # pending outcome of invoke#461 (which, if flexible enough to
+            # handle intersect of dependencies+parameterization, just becomes
+            # 'honor that new feature of Invoke')
+            # TODO: roles, other non-runtime host parameterizations, etc
+            # Pre-tasks get added only once, not once per host.
+            ret.extend(self.expand_calls(call.pre, apply_hosts=False))
+            # Determine final desired host list based on CLI and task values
+            # (with CLI, being closer to runtime, winning) and normalize to
+            # Connection-init kwargs.
+            call_hosts = getattr(call, "hosts", None)
+            cxn_params = self.normalize_hosts(cli_hosts or call_hosts)
+            # Main task, per host/connection
+            for init_kwargs in cxn_params:
+                ret.append(self.parameterize(call, init_kwargs))
+            # Deal with lack of hosts list (acts same as `inv` in that case)
+            # TODO: no tests for this branch?
+            if not cxn_params:
+                ret.append(call)
+            # Post-tasks added once, not once per host.
+            ret.extend(self.expand_calls(call.post, apply_hosts=False))
+        # Add remainder as anonymous task
+        if self.core.remainder:
+            # TODO: this will need to change once there are more options for
+            # setting host lists besides "-H or 100% within-task"
+            if not cli_hosts:
+                raise NothingToDo(
+                    "Was told to run a command, but not given any hosts to run it on!"  # noqa
+                )
+
+            def anonymous(c):
+                c.run(self.core.remainder)
+
+            anon = Call(Task(body=anonymous))
+            # TODO: see above TODOs about non-parameterized setups, roles etc
+            # TODO: will likely need to refactor that logic some more so it can
+            # be used both there and here.
+            for init_kwargs in self.normalize_hosts(cli_hosts):
+                ret.append(self.parameterize(anon, init_kwargs))
+        return ret
+
+    def parameterize(self, call, connection_init_kwargs):
+        """
+        Parameterize a Call with its Context set to a per-host Connection.
+
+        :param call:
+            The generic `.Call` being parameterized.
+        :param connection_init_kwargs:
+            The dict of `.Connection` init params/kwargs to attach to the
+            resulting `.ConnectionCall`.
+
+        :returns:
+            `.ConnectionCall`.
+        """
+        msg = "Parameterizing {!r} with Connection kwargs {!r}"
+        debug(msg.format(call, connection_init_kwargs))
+        # Generate a custom ConnectionCall that has init_kwargs (used for
+        # creating the Connection at runtime) set to the requested params.
+        new_call_kwargs = dict(init_kwargs=connection_init_kwargs)
+        clone = call.clone(into=ConnectionCall, with_=new_call_kwargs)
+        return clone
+
+    def dedupe(self, tasks):
+        # Don't perform deduping, we will often have "duplicate" tasks w/
+        # distinct host values/etc.
+        # TODO: might want some deduplication later on though - falls under
+        # "how to mesh parameterization with pre/post/etc deduping".
+        return tasks
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/group.py b/TP03/TP03/lib/python3.9/site-packages/fabric/group.py
new file mode 100644
index 0000000000000000000000000000000000000000..506f2353afa3cffb605e9ce15a3e013889c142c6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/group.py
@@ -0,0 +1,342 @@
+from queue import Queue
+
+from invoke.util import ExceptionHandlingThread
+
+from .connection import Connection
+from .exceptions import GroupException
+
+
+class Group(list):
+    """
+    A collection of `.Connection` objects whose API operates on its contents.
+
+    .. warning::
+        **This is a partially abstract class**; you need to use one of its
+        concrete subclasses (such as `.SerialGroup` or `.ThreadingGroup`) or
+        you'll get ``NotImplementedError`` on most of the methods.
+
+    Most methods in this class wrap those of `.Connection` and will accept the
+    same arguments; however their return values and exception-raising behavior
+    differ:
+
+    - Return values are dict-like objects (`.GroupResult`) mapping
+      `.Connection` objects to the return value for the respective connections:
+      `.Group.run` returns a map of `.Connection` to `.runners.Result`,
+      `.Group.get` returns a map of `.Connection` to `.transfer.Result`, etc.
+    - If any connections encountered exceptions, a `.GroupException` is raised,
+      which is a thin wrapper around what would otherwise have been the
+      `.GroupResult` returned; within that wrapped `.GroupResult`, the
+      excepting connections map to the exception that was raised, in place of a
+      ``Result`` (as no ``Result`` was obtained.) Any non-excepting connections
+      will have a ``Result`` value, as normal.
+
+    For example, when no exceptions occur, a session might look like this::
+
+        >>> group = SerialGroup('host1', 'host2')
+        >>> group.run("this is fine")
+        {
+            <Connection host='host1'>: <Result cmd='this is fine' exited=0>,
+            <Connection host='host2'>: <Result cmd='this is fine' exited=0>,
+        }
+
+    With exceptions (anywhere from 1 to "all of them"), it looks like so; note
+    the different exception classes, e.g. `~invoke.exceptions.UnexpectedExit`
+    for a completed session whose command exited poorly, versus
+    `socket.gaierror` for a host that had DNS problems::
+
+        >>> group = SerialGroup('host1', 'host2', 'notahost')
+        >>> group.run("will it blend?")
+        {
+            <Connection host='host1'>: <Result cmd='will it blend?' exited=0>,
+            <Connection host='host2'>: <UnexpectedExit: cmd='...' exited=1>,
+            <Connection host='notahost'>: gaierror(...),
+        }
+
+    As with `.Connection`, `.Group` objects may be used as context managers,
+    which will automatically `.close` the object on block exit.
+
+    .. versionadded:: 2.0
+    .. versionchanged:: 2.4
+        Added context manager behavior.
+    """
+
+    def __init__(self, *hosts, **kwargs):
+        """
+        Create a group of connections from one or more shorthand host strings.
+
+        See `.Connection` for details on the format of these strings - they
+        will be used as the first positional argument of `.Connection`
+        constructors.
+
+        Any keyword arguments given will be forwarded directly to those
+        `.Connection` constructors as well. For example, to get a serially
+        executing group object that connects to ``admin@host1``,
+        ``admin@host2`` and ``admin@host3``, and forwards your SSH agent too::
+
+            group = SerialGroup(
+                "host1", "host2", "host3", user="admin", forward_agent=True,
+            )
+
+        .. versionchanged:: 2.3
+            Added ``**kwargs`` (was previously only ``*hosts``).
+        """
+        # TODO: #563, #388 (could be here or higher up in Program area)
+        self.extend([Connection(host, **kwargs) for host in hosts])
+
+    @classmethod
+    def from_connections(cls, connections):
+        """
+        Alternate constructor accepting `.Connection` objects.
+
+        .. versionadded:: 2.0
+        """
+        # TODO: *args here too; or maybe just fold into __init__ and type
+        # check?
+        group = cls()
+        group.extend(connections)
+        return group
+
+    def _do(self, method, *args, **kwargs):
+        # TODO: rename this something public & commit to an API for user
+        # subclasses
+        raise NotImplementedError
+
+    def run(self, *args, **kwargs):
+        """
+        Executes `.Connection.run` on all member `Connections <.Connection>`.
+
+        :returns: a `.GroupResult`.
+
+        .. versionadded:: 2.0
+        """
+        # TODO: how to change method of execution across contents? subclass,
+        # kwargs, additional methods, inject an executor? Doing subclass for
+        # now, but not 100% sure it's the best route.
+        # TODO: also need way to deal with duplicate connections (see THOUGHTS)
+        return self._do("run", *args, **kwargs)
+
+    def sudo(self, *args, **kwargs):
+        """
+        Executes `.Connection.sudo` on all member `Connections <.Connection>`.
+
+        :returns: a `.GroupResult`.
+
+        .. versionadded:: 2.6
+        """
+        # TODO: see run() TODOs
+        return self._do("sudo", *args, **kwargs)
+
+    # TODO: this all needs to mesh well with similar strategies applied to
+    # entire tasks - so that may still end up factored out into Executors or
+    # something lower level than both those and these?
+
+    # TODO: local? Invoke wants ability to do that on its own though, which
+    # would be distinct from Group. (May want to switch Group to use that,
+    # though, whatever it ends up being? Eg many cases where you do want to do
+    # some local thing either N times identically, or parameterized by remote
+    # cxn values)
+
+    def put(self, *args, **kwargs):
+        """
+        Executes `.Connection.put` on all member `Connections <.Connection>`.
+
+        This is a straightforward application: aside from whatever the concrete
+        group subclass does for concurrency or lack thereof, the effective
+        result is like running a loop over the connections and calling their
+        ``put`` method.
+
+        :returns:
+            a `.GroupResult` whose values are `.transfer.Result` instances.
+
+        .. versionadded:: 2.6
+        """
+        return self._do("put", *args, **kwargs)
+
+    def get(self, *args, **kwargs):
+        """
+        Executes `.Connection.get` on all member `Connections <.Connection>`.
+
+        .. note::
+            This method changes some behaviors over e.g. directly calling
+            `.Connection.get` on a ``for`` loop of connections; the biggest is
+            that the implied default value for the ``local`` parameter is
+            ``"{host}/"``, which triggers use of local path parameterization
+            based on each connection's target hostname.
+
+            Thus, unless you override ``local`` yourself, a copy of the
+            downloaded file will be stored in (relative) directories named
+            after each host in the group.
+
+        .. warning::
+            Using file-like objects as the ``local`` argument is not currently
+            supported, as it would be equivalent to supplying that same object
+            to a series of individual ``get()`` calls.
+
+        :returns:
+            a `.GroupResult` whose values are `.transfer.Result` instances.
+
+        .. versionadded:: 2.6
+        """
+        # TODO 4.0: consider making many of these into kwarg-only methods? then
+        # below could become kwargs.setdefault() if desired.
+        # TODO: do we care enough to handle explicitly given, yet falsey,
+        # values? it's a lot more complexity for a corner case.
+        if len(args) < 2 and "local" not in kwargs:
+            kwargs["local"] = "{host}/"
+        return self._do("get", *args, **kwargs)
+
+    def close(self):
+        """
+        Executes `.Connection.close` on all member `Connections <.Connection>`.
+
+        .. versionadded:: 2.4
+        """
+        for cxn in self:
+            cxn.close()
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *exc):
+        self.close()
+
+
+class SerialGroup(Group):
+    """
+    Subclass of `.Group` which executes in simple, serial fashion.
+
+    .. versionadded:: 2.0
+    """
+
+    def _do(self, method, *args, **kwargs):
+        results = GroupResult()
+        excepted = False
+        for cxn in self:
+            try:
+                results[cxn] = getattr(cxn, method)(*args, **kwargs)
+            except Exception as e:
+                results[cxn] = e
+                excepted = True
+        if excepted:
+            raise GroupException(results)
+        return results
+
+
+def thread_worker(cxn, queue, method, args, kwargs):
+    result = getattr(cxn, method)(*args, **kwargs)
+    # TODO: namedtuple or attrs object?
+    queue.put((cxn, result))
+
+
+class ThreadingGroup(Group):
+    """
+    Subclass of `.Group` which uses threading to execute concurrently.
+
+    .. versionadded:: 2.0
+    """
+
+    def _do(self, method, *args, **kwargs):
+        results = GroupResult()
+        queue = Queue()
+        threads = []
+        for cxn in self:
+            thread = ExceptionHandlingThread(
+                target=thread_worker,
+                kwargs=dict(
+                    cxn=cxn,
+                    queue=queue,
+                    method=method,
+                    args=args,
+                    kwargs=kwargs,
+                ),
+            )
+            threads.append(thread)
+        for thread in threads:
+            thread.start()
+        for thread in threads:
+            # TODO: configurable join timeout
+            thread.join()
+        # Get non-exception results from queue
+        while not queue.empty():
+            # TODO: io-sleep? shouldn't matter if all threads are now joined
+            cxn, result = queue.get(block=False)
+            # TODO: outstanding musings about how exactly aggregate results
+            # ought to ideally operate...heterogenous obj like this, multiple
+            # objs, ??
+            results[cxn] = result
+        # Get exceptions from the threads themselves.
+        # TODO: in a non-thread setup, this would differ, e.g.:
+        # - a queue if using multiprocessing
+        # - some other state-passing mechanism if using e.g. coroutines
+        # - ???
+        excepted = False
+        for thread in threads:
+            wrapper = thread.exception()
+            if wrapper is not None:
+                # Outer kwargs is Thread instantiation kwargs, inner is kwargs
+                # passed to thread target/body.
+                cxn = wrapper.kwargs["kwargs"]["cxn"]
+                results[cxn] = wrapper.value
+                excepted = True
+        if excepted:
+            raise GroupException(results)
+        return results
+
+
+class GroupResult(dict):
+    """
+    Collection of results and/or exceptions arising from `.Group` methods.
+
+    Acts like a dict, but adds a couple convenience methods, to wit:
+
+    - Keys are the individual `.Connection` objects from within the `.Group`.
+    - Values are either return values / results from the called method (e.g.
+      `.runners.Result` objects), *or* an exception object, if one prevented
+      the method from returning.
+    - Subclasses `dict`, so has all dict methods.
+    - Has `.succeeded` and `.failed` attributes containing sub-dicts limited to
+      just those key/value pairs that succeeded or encountered exceptions,
+      respectively.
+
+      - Of note, these attributes allow high level logic, e.g. ``if
+        mygroup.run('command').failed`` and so forth.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self._successes = {}
+        self._failures = {}
+
+    def _bifurcate(self):
+        # Short-circuit to avoid reprocessing every access.
+        if self._successes or self._failures:
+            return
+        # TODO: if we ever expect .succeeded/.failed to be useful before a
+        # GroupResult is fully initialized, this needs to become smarter.
+        for key, value in self.items():
+            if isinstance(value, BaseException):
+                self._failures[key] = value
+            else:
+                self._successes[key] = value
+
+    @property
+    def succeeded(self):
+        """
+        A sub-dict containing only successful results.
+
+        .. versionadded:: 2.0
+        """
+        self._bifurcate()
+        return self._successes
+
+    @property
+    def failed(self):
+        """
+        A sub-dict containing only failed results.
+
+        .. versionadded:: 2.0
+        """
+        self._bifurcate()
+        return self._failures
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/main.py b/TP03/TP03/lib/python3.9/site-packages/fabric/main.py
new file mode 100644
index 0000000000000000000000000000000000000000..ce0f66e46229a0c80e7bcbda71b0659002332f30
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/main.py
@@ -0,0 +1,193 @@
+"""
+CLI entrypoint & parser configuration.
+
+Builds on top of Invoke's core functionality for same.
+"""
+
+import getpass
+from pathlib import Path
+
+from invoke import Argument, Collection, Exit, Program
+from invoke import __version__ as invoke
+from paramiko import __version__ as paramiko, Agent
+
+from . import __version__ as fabric
+from . import Config, Executor
+
+
+class Fab(Program):
+    def print_version(self):
+        super().print_version()
+        print("Paramiko {}".format(paramiko))
+        print("Invoke {}".format(invoke))
+
+    def core_args(self):
+        core_args = super().core_args()
+        my_args = [
+            Argument(
+                names=("H", "hosts"),
+                help="Comma-separated host name(s) to execute tasks against.",
+            ),
+            Argument(
+                names=("i", "identity"),
+                kind=list,  # Same as OpenSSH, can give >1 key
+                # TODO: automatically add hint about iterable-ness to Invoke
+                # help display machinery?
+                help="Path to runtime SSH identity (key) file. May be given multiple times.",  # noqa
+            ),
+            Argument(
+                names=("list-agent-keys",),
+                kind=bool,
+                help="Display ssh-agent key list, and exit.",
+            ),
+            # TODO: worth having short flags for these prompt args?
+            Argument(
+                names=("prompt-for-login-password",),
+                kind=bool,
+                help="Request an upfront SSH-auth password prompt.",
+            ),
+            Argument(
+                names=("prompt-for-passphrase",),
+                kind=bool,
+                help="Request an upfront SSH key passphrase prompt.",
+            ),
+            Argument(
+                names=("S", "ssh-config"),
+                help="Path to runtime SSH config file.",
+            ),
+            Argument(
+                names=("t", "connect-timeout"),
+                kind=int,
+                help="Specifies default connection timeout, in seconds.",
+            ),
+        ]
+        return core_args + my_args
+
+    @property
+    def _remainder_only(self):
+        # No 'unparsed' (i.e. tokens intended for task contexts), and remainder
+        # (text after a double-dash) implies a contextless/taskless remainder
+        # execution of the style 'fab -H host -- command'.
+        # NOTE: must ALSO check to ensure the double dash isn't being used for
+        # tab completion machinery...
+        return (
+            not self.core.unparsed
+            and self.core.remainder
+            and not self.args.complete.value
+        )
+
+    def load_collection(self):
+        # Stick in a dummy Collection if it looks like we were invoked w/o any
+        # tasks, and with a remainder.
+        # This isn't super ideal, but Invoke proper has no obvious "just run my
+        # remainder" use case, so having it be capable of running w/o any task
+        # module, makes no sense. But we want that capability for testing &
+        # things like 'fab -H x,y,z -- mycommand'.
+        if self._remainder_only:
+            # TODO: hm we're probably not honoring project-specific configs in
+            # this branch; is it worth having it assume CWD==project, since
+            # that's often what users expect? Even tho no task collection to
+            # honor the real "lives by task coll"?
+            self.collection = Collection()
+        else:
+            super().load_collection()
+
+    def no_tasks_given(self):
+        # As above, neuter the usual "hey you didn't give me any tasks, let me
+        # print help for you" behavior, if necessary.
+        if not self._remainder_only:
+            super().no_tasks_given()
+
+    def create_config(self):
+        # Create config, as parent does, but with lazy=True to avoid our own
+        # SSH config autoload. (Otherwise, we can't correctly load _just_ the
+        # runtime file if one's being given later.)
+        self.config = self.config_class(lazy=True)
+        # However, we don't really want the parent class' lazy behavior (which
+        # skips loading system/global invoke-type conf files) so we manually do
+        # that here to match upstream behavior.
+        self.config.load_base_conf_files()
+        # And merge again so that data is available.
+        # TODO: really need to either A) stop giving fucks about calling
+        # merge() "too many times", or B) make merge() itself determine whether
+        # it needs to run and/or just merge stuff that's changed, so log spam
+        # isn't as bad.
+        self.config.merge()
+
+    def update_config(self):
+        # Note runtime SSH path, if given, and load SSH configurations.
+        # NOTE: must do parent before our work, in case users want to disable
+        # SSH config loading within a runtime-level conf file/flag.
+        super().update_config(merge=False)
+        self.config.set_runtime_ssh_path(self.args["ssh-config"].value)
+        self.config.load_ssh_config()
+        # Load -i identity file, if given, into connect_kwargs, at overrides
+        # level.
+        connect_kwargs = {}
+        paths = self.args["identity"].value
+        if paths:
+            connect_kwargs["key_filename"] = paths
+            # New, non-sshclient based config location
+            # Also new: Path! (which we couldn't use above until paramiko knew
+            # about it)
+            self.config._overrides["authentication"] = dict(
+                identities=[Path(x) for x in paths]
+            )
+        # Ditto for connect timeout
+        timeout = self.args["connect-timeout"].value
+        if timeout:
+            connect_kwargs["timeout"] = timeout
+        # Secrets prompts that want to happen at handoff time instead of
+        # later/at user-time.
+        # TODO: should this become part of Invoke proper in case other
+        # downstreams have need of it? E.g. a prompt Argument 'type'? We're
+        # already doing a similar thing there for sudo password...
+        if self.args["prompt-for-login-password"].value:
+            prompt = "Enter login password for use with SSH auth: "
+            connect_kwargs["password"] = getpass.getpass(prompt)
+        if self.args["prompt-for-passphrase"].value:
+            prompt = "Enter passphrase for use unlocking SSH keys: "
+            connect_kwargs["passphrase"] = getpass.getpass(prompt)
+        # TODO: this (directly manipulating _overrides) feels a little gross,
+        # but since the parent has already called load_overrides, this is best
+        # we can do for now w/o losing data. Still feels correct; just might be
+        # cleaner to have even more Config API members around this sort of
+        # thing. Shrug.
+        self.config._overrides["connect_kwargs"] = connect_kwargs
+        # Since we gave merge=False above, we must do it ourselves here. (Also
+        # allows us to 'compile' our overrides manipulation.)
+        self.config.merge()
+
+    # TODO: make this an explicit hookpoint in Invoke, i.e. some default-noop
+    # method called at the end of parse_core() that we can override here
+    # instead of doing this.
+    def parse_core(self, *args, **kwargs):
+        super().parse_core(*args, **kwargs)
+        if self.args["list-agent-keys"].value:
+            keys = Agent().get_keys()
+            for key in keys:
+                tpl = "{} {} {} ({})"
+                # TODO: _could_ use new PKey.__repr__ but I like the mimicry of
+                # OpenSSH ssh-add -l for now...
+                print(
+                    tpl.format(
+                        key.get_bits(),
+                        key.fingerprint,
+                        key.comment,
+                        key.algorithm_name,
+                    )
+                )
+            raise Exit
+
+
+# Mostly a concession to testing.
+def make_program():
+    return Fab(
+        name="Fabric",
+        version=fabric,
+        executor_class=Executor,
+        config_class=Config,
+    )
+
+
+program = make_program()
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/runners.py b/TP03/TP03/lib/python3.9/site-packages/fabric/runners.py
new file mode 100644
index 0000000000000000000000000000000000000000..587e5f79fa15402c392e89ca2a9b89dea5f5287b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/runners.py
@@ -0,0 +1,189 @@
+import signal
+import threading
+
+from invoke import Runner, pty_size, Result as InvokeResult
+
+
+def cares_about_SIGWINCH():
+    return (
+        hasattr(signal, "SIGWINCH")
+        and threading.current_thread() is threading.main_thread()
+    )
+
+
+class Remote(Runner):
+    """
+    Run a shell command over an SSH connection.
+
+    This class subclasses `invoke.runners.Runner`; please see its documentation
+    for most public API details.
+
+    .. note::
+        `.Remote`'s ``__init__`` method expects a `.Connection` (or subclass)
+        instance for its ``context`` argument.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(self, *args, **kwargs):
+        """
+        Thin wrapper for superclass' ``__init__``; please see it for details.
+
+        Additional keyword arguments defined here are listed below.
+
+        :param bool inline_env:
+            Whether to 'inline' shell env vars as prefixed parameters, instead
+            of trying to submit them via `.Channel.update_environment`.
+            Default: ``True``.
+
+        .. versionchanged:: 2.3
+            Added the ``inline_env`` parameter.
+        .. versionchanged:: 3.0
+            Changed the default value of ``inline_env`` from ``False`` to
+            ``True``.
+        """
+        self.inline_env = kwargs.pop("inline_env", None)
+        super().__init__(*args, **kwargs)
+
+    def start(self, command, shell, env, timeout=None):
+        self.channel = self.context.create_session()
+        if self.using_pty:
+            # Set initial size to match local size
+            cols, rows = pty_size()
+            self.channel.get_pty(width=cols, height=rows)
+            # If platform supports, also respond to SIGWINCH (window change) by
+            # sending the sshd a window-change message to update
+            if cares_about_SIGWINCH():
+                signal.signal(signal.SIGWINCH, self.handle_window_change)
+        if env:
+            # TODO: honor SendEnv from ssh_config (but if we do, _should_ we
+            # honor it even when prefixing? That would depart from OpenSSH
+            # somewhat (albeit as a "what we can do that it cannot" feature...)
+            if self.inline_env:
+                # TODO: escaping, if we can find a FOOLPROOF THIRD PARTY METHOD
+                # for doing so!
+                # TODO: switch to using a higher-level generic command
+                # prefixing functionality, when implemented.
+                parameters = " ".join(
+                    ["{}={}".format(k, v) for k, v in sorted(env.items())]
+                )
+                # NOTE: we can assume 'export' and '&&' relatively safely, as
+                # sshd always brings some shell into play, even if it's just
+                # /bin/sh.
+                command = "export {} && {}".format(parameters, command)
+            else:
+                self.channel.update_environment(env)
+        self.send_start_message(command)
+
+    def send_start_message(self, command):
+        self.channel.exec_command(command)
+
+    def run(self, command, **kwargs):
+        kwargs.setdefault("replace_env", True)
+        return super().run(command, **kwargs)
+
+    def read_proc_stdout(self, num_bytes):
+        return self.channel.recv(num_bytes)
+
+    def read_proc_stderr(self, num_bytes):
+        return self.channel.recv_stderr(num_bytes)
+
+    def _write_proc_stdin(self, data):
+        return self.channel.sendall(data)
+
+    def close_proc_stdin(self):
+        return self.channel.shutdown_write()
+
+    @property
+    def process_is_finished(self):
+        return self.channel.exit_status_ready()
+
+    def send_interrupt(self, interrupt):
+        # NOTE: in v1, we just reraised the KeyboardInterrupt unless a PTY was
+        # present; this seems to have been because without a PTY, the
+        # below escape sequence is ignored, so all we can do is immediately
+        # terminate on our end.
+        # NOTE: also in v1, the raising of the KeyboardInterrupt completely
+        # skipped all thread joining & cleanup; presumably regular interpreter
+        # shutdown suffices to tie everything off well enough.
+        if self.using_pty:
+            # Submit hex ASCII character 3, aka ETX, which most Unix PTYs
+            # interpret as a foreground SIGINT.
+            # TODO: is there anything else we can do here to be more portable?
+            self.channel.send("\x03")
+        else:
+            raise interrupt
+
+    def returncode(self):
+        return self.channel.recv_exit_status()
+
+    def generate_result(self, **kwargs):
+        kwargs["connection"] = self.context
+        return Result(**kwargs)
+
+    def stop(self):
+        super().stop()
+        if hasattr(self, "channel"):
+            self.channel.close()
+        if cares_about_SIGWINCH():
+            signal.signal(signal.SIGWINCH, signal.SIG_DFL)
+
+    def kill(self):
+        # Just close the channel immediately, which is about as close as we can
+        # get to a local SIGKILL unfortunately.
+        # TODO: consider _also_ calling .send_interrupt() and only doing this
+        # after another few seconds; but A) kinda fragile/complex and B) would
+        # belong in invoke.Runner anyways?
+        self.channel.close()
+
+    def handle_window_change(self, signum, frame):
+        """
+        Respond to a `signal.SIGWINCH` (as a standard signal handler).
+
+        Sends a window resize command via Paramiko channel method.
+        """
+        self.channel.resize_pty(*pty_size())
+
+    # TODO: shit that is in fab 1 run() but could apply to invoke.Local too:
+    # * see rest of stuff in _run_command/_execute in operations.py...there is
+    # a bunch that applies generally like optional exit codes, etc
+
+    # TODO: general shit not done yet
+    # * stdin; Local relies on local process management to ensure stdin is
+    # hooked up; we cannot do that.
+    # * output prefixing
+    # * agent forwarding
+    # * reading at 4096 bytes/time instead of whatever inv defaults to (also,
+    # document why we are doing that, iirc it changed recentlyish via ticket)
+    # * TODO: oh god so much more, go look it up
+
+    # TODO: shit that has no Local equivalent that we probs need to backfill
+    # into Runner, probably just as a "finish()" or "stop()" (to mirror
+    # start()):
+    # * channel close()
+    # * agent-forward close()
+
+
+class RemoteShell(Remote):
+    def send_start_message(self, command):
+        self.channel.invoke_shell()
+
+
+class Result(InvokeResult):
+    """
+    An `invoke.runners.Result` exposing which `.Connection` was run against.
+
+    Exposes all attributes from its superclass, then adds a ``.connection``,
+    which is simply a reference to the `.Connection` whose method yielded this
+    result.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(self, **kwargs):
+        connection = kwargs.pop("connection")
+        super().__init__(**kwargs)
+        self.connection = connection
+
+    # TODO: have useful str/repr differentiation from invoke.Result,
+    # transfer.Result etc.
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/tasks.py b/TP03/TP03/lib/python3.9/site-packages/fabric/tasks.py
new file mode 100644
index 0000000000000000000000000000000000000000..acf89d0cb5e832e492b85ed1591e3c961513b45a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/tasks.py
@@ -0,0 +1,116 @@
+import invoke
+
+from .connection import Connection
+
+
+class Task(invoke.Task):
+    """
+    Extends `invoke.tasks.Task` with knowledge of target hosts and similar.
+
+    As `invoke.tasks.Task` relegates documentation responsibility to its `@task
+    <invoke.tasks.task>` expression, so we relegate most details to our version
+    of `@task <fabric.tasks.task>` - please see its docs for details.
+
+    .. versionadded:: 2.1
+    """
+
+    def __init__(self, *args, **kwargs):
+        # Pull out our own kwargs before hitting super, which will TypeError on
+        # anything it doesn't know about.
+        self.hosts = kwargs.pop("hosts", None)
+        super().__init__(*args, **kwargs)
+
+
+def task(*args, **kwargs):
+    """
+    Wraps/extends Invoke's `@task <invoke.tasks.task>` with extra kwargs.
+
+    See `the Invoke-level API docs <invoke.tasks.task>` for most details; this
+    Fabric-specific implementation adds the following additional keyword
+    arguments:
+
+    :param hosts:
+        An iterable of host-connection specifiers appropriate for eventually
+        instantiating a `.Connection`. The existence of this argument will
+        trigger automatic parameterization of the task when invoked from the
+        CLI, similar to the behavior of :option:`--hosts`.
+
+        .. note::
+            This parameterization is "lower-level" than that driven by
+            :option:`--hosts`: if a task decorated with this parameter is
+            executed in a session where :option:`--hosts` was given, the
+            CLI-driven value will win out.
+
+        List members may be one of:
+
+        - A string appropriate for being the first positional argument to
+          `.Connection` - see its docs for details, but these are typically
+          shorthand-only convenience strings like ``hostname.example.com`` or
+          ``user@host:port``.
+        - A dictionary appropriate for use as keyword arguments when
+          instantiating a `.Connection`. Useful for values that don't mesh well
+          with simple strings (e.g. statically defined IPv6 addresses) or to
+          bake in more complex info (eg ``connect_timeout``, ``connect_kwargs``
+          params like auth info, etc).
+
+        These two value types *may* be mixed together in the same list, though
+        we recommend that you keep things homogenous when possible, to avoid
+        confusion when debugging.
+
+        .. note::
+            No automatic deduplication of values is performed; if you pass in
+            multiple references to the same effective target host, the wrapped
+            task will execute on that host multiple times (including making
+            separate connections).
+
+    .. versionadded:: 2.1
+    """
+    # Override klass to be our own Task, not Invoke's, unless somebody gave it
+    # explicitly.
+    kwargs.setdefault("klass", Task)
+    return invoke.task(*args, **kwargs)
+
+
+class ConnectionCall(invoke.Call):
+    """
+    Subclass of `invoke.tasks.Call` that generates `Connections <.Connection>`.
+    """
+
+    def __init__(self, *args, **kwargs):
+        """
+        Creates a new `.ConnectionCall`.
+
+        Performs minor extensions to `~invoke.tasks.Call` -- see its docstring
+        for most details. Only specific-to-subclass params are documented here.
+
+        :param dict init_kwargs:
+            Keyword arguments used to create a new `.Connection` when the
+            wrapped task is executed. Default: ``None``.
+        """
+        init_kwargs = kwargs.pop("init_kwargs")  # , None)
+        super().__init__(*args, **kwargs)
+        self.init_kwargs = init_kwargs
+
+    def clone_kwargs(self):
+        # Extend superclass clone_kwargs to work in init_kwargs.
+        # TODO: this pattern comes up a lot; is there a better way to handle it
+        # without getting too crazy on the metaprogramming/over-engineering?
+        # Maybe something attrs library can help with (re: declaring "These are
+        # my bag-of-attributes attributes I want common stuff done to/with")
+        kwargs = super().clone_kwargs()
+        kwargs["init_kwargs"] = self.init_kwargs
+        return kwargs
+
+    def make_context(self, config):
+        kwargs = self.init_kwargs
+        # TODO: what about corner case of a decorator giving config in a hosts
+        # kwarg member?! For now let's stomp on it, and then if somebody runs
+        # into it, we can identify the use case & decide how best to deal.
+        kwargs["config"] = config
+        return Connection(**kwargs)
+
+    def __repr__(self):
+        ret = super().__repr__()
+        if self.init_kwargs:
+            ret = ret[:-1] + ", host='{}'>".format(self.init_kwargs["host"])
+        return ret
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__init__.py b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..de5b23abcc25889fa02a99b96ffc0231cf487d68
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..86d72a03d91721e3cdba32dc05079ba4c1a78925
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/fixtures.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/fixtures.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f5327ce3cfda48e1cf1c38da552db70c5fb23d09
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/__pycache__/fixtures.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/base.py b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..97a4b44178aecd0f0bddd5af80dc34e0ea1ed3ca
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/base.py
@@ -0,0 +1,543 @@
+"""
+This module contains helpers/fixtures to assist in testing Fabric-driven code.
+
+It is not intended for production use, and pulls in some test-oriented
+dependencies as needed. You can install an 'extra' variant of Fabric to get
+these dependencies if you aren't already using them for your own testing
+purposes: ``pip install fabric[testing]``.
+
+.. note::
+    If you're using pytest for your test suite, you may be interested in
+    grabbing ``fabric[pytest]`` instead, which encompasses the dependencies of
+    both this module and the `fabric.testing.fixtures` module, which contains
+    pytest fixtures.
+
+.. versionadded:: 2.1
+"""
+
+import os
+from itertools import chain, repeat
+from io import BytesIO
+from unittest.mock import Mock, PropertyMock, call, patch, ANY
+
+from deprecated.sphinx import deprecated
+from deprecated.classic import deprecated as deprecated_no_docstring
+
+
+# TODO 4.0: reorganize harder (eg building blocks in one module, central
+# classes in another?)
+
+
+class Command:
+    """
+    Data record specifying params of a command execution to mock/expect.
+
+    :param str cmd:
+        Command string to expect. If not given, no expectations about the
+        command executed will be set up. Default: ``None``.
+
+    :param bytes out: Data yielded as remote stdout. Default: ``b""``.
+
+    :param bytes err: Data yielded as remote stderr. Default: ``b""``.
+
+    :param int exit: Remote exit code. Default: ``0``.
+
+    :param int waits:
+        Number of calls to the channel's ``exit_status_ready`` that should
+        return ``False`` before it then returns ``True``. Default: ``0``
+        (``exit_status_ready`` will return ``True`` immediately).
+
+    .. versionadded:: 2.1
+    """
+
+    def __init__(self, cmd=None, out=b"", err=b"", in_=None, exit=0, waits=0):
+        self.cmd = cmd
+        self.out = out
+        self.err = err
+        self.in_ = in_
+        self.exit = exit
+        self.waits = waits
+
+    def __repr__(self):
+        # TODO: just leverage attrs, maybe vendored into Invoke so we don't
+        # grow more dependencies? Ehhh
+        return "<{} cmd={!r}>".format(self.__class__.__name__, self.cmd)
+
+    def expect_execution(self, channel):
+        """
+        Assert that the ``channel`` was used to run this command.
+
+        .. versionadded:: 2.7
+        """
+        channel.exec_command.assert_called_with(self.cmd or ANY)
+
+
+class ShellCommand(Command):
+    """
+    A pseudo-command that expects an interactive shell to be executed.
+
+    .. versionadded:: 2.7
+    """
+
+    def expect_execution(self, channel):
+        channel.invoke_shell.assert_called_once_with()
+
+
+class MockChannel(Mock):
+    """
+    Mock subclass that tracks state for its ``recv(_stderr)?`` methods.
+
+    Turns out abusing function closures inside MockRemote to track this state
+    only worked for 1 command per session!
+
+    .. versionadded:: 2.1
+    """
+
+    def __init__(self, *args, **kwargs):
+        # TODO: worth accepting strings and doing the BytesIO setup ourselves?
+        # Stored privately to avoid any possible collisions ever. shrug.
+        object.__setattr__(self, "__stdout", kwargs.pop("stdout"))
+        object.__setattr__(self, "__stderr", kwargs.pop("stderr"))
+        # Stdin less private so it can be asserted about
+        object.__setattr__(self, "_stdin", BytesIO())
+        super().__init__(*args, **kwargs)
+
+    def _get_child_mock(self, **kwargs):
+        # Don't return our own class on sub-mocks.
+        return Mock(**kwargs)
+
+    def recv(self, count):
+        return object.__getattribute__(self, "__stdout").read(count)
+
+    def recv_stderr(self, count):
+        return object.__getattribute__(self, "__stderr").read(count)
+
+    def sendall(self, data):
+        return object.__getattribute__(self, "_stdin").write(data)
+
+
+class Session:
+    """
+    A mock remote session of a single connection and 1 or more command execs.
+
+    Allows quick configuration of expected remote state, and also helps
+    generate the necessary test mocks used by `MockRemote` itself. Only useful
+    when handed into `MockRemote`.
+
+    The parameters ``cmd``, ``out``, ``err``, ``exit`` and ``waits`` are all
+    shorthand for the same constructor arguments for a single anonymous
+    `.Command`; see `.Command` for details.
+
+    To give fully explicit `.Command` objects, use the ``commands`` parameter.
+
+    :param str user:
+    :param str host:
+    :param int port:
+        Sets up expectations that a connection will be generated to the given
+        user, host and/or port. If ``None`` (default), no expectations are
+        generated / any value is accepted.
+
+    :param commands:
+        Iterable of `.Command` objects, used when mocking nontrivial sessions
+        involving >1 command execution per host. Default: ``None``.
+
+        .. note::
+            Giving ``cmd``, ``out`` etc alongside explicit ``commands`` is not
+            allowed and will result in an error.
+
+    :param bool enable_sftp: Whether to enable basic SFTP mocking support.
+
+    :param transfers:
+        None if no transfers to expect; otherwise, should be a list of dicts of
+        the form ``{"method": "get|put", **kwargs}`` where ``**kwargs`` are the
+        kwargs expected in the relevant `~paramiko.sftp_client.SFTPClient`
+        method. (eg: ``{"method": "put", "localpath": "/some/path"}``)
+
+    .. versionadded:: 2.1
+    .. versionchanged:: 3.2
+        Added the ``enable_sftp`` and ``transfers`` parameters.
+    """
+
+    def __init__(
+        self,
+        host=None,
+        user=None,
+        port=None,
+        commands=None,
+        cmd=None,
+        out=None,
+        in_=None,
+        err=None,
+        exit=None,
+        waits=None,
+        enable_sftp=False,
+        transfers=None,
+    ):
+        # Safety check
+        params = cmd or out or err or exit or waits
+        if commands and params:
+            raise ValueError(
+                "You can't give both 'commands' and individual "
+                "Command parameters!"
+            )  # noqa
+        # Early test for "did user actually request expectations?"
+        self.guard_only = not (commands or cmd or transfers)
+        # Fill in values
+        self.host = host
+        self.user = user
+        self.port = port
+        self.commands = commands
+        if params:
+            # Honestly dunno which is dumber, this or duplicating Command's
+            # default kwarg values in this method's signature...sigh
+            kwargs = {}
+            if cmd is not None:
+                kwargs["cmd"] = cmd
+            if out is not None:
+                kwargs["out"] = out
+            if err is not None:
+                kwargs["err"] = err
+            if in_ is not None:
+                kwargs["in_"] = in_
+            if exit is not None:
+                kwargs["exit"] = exit
+            if waits is not None:
+                kwargs["waits"] = waits
+            self.commands = [Command(**kwargs)]
+        if not self.commands:
+            self.commands = [Command()]
+        self._enable_sftp = enable_sftp
+        self.transfers = transfers
+
+    def generate_mocks(self):
+        """
+        Mocks `~paramiko.client.SSHClient` and `~paramiko.channel.Channel`.
+
+        Specifically, the client will expect itself to be connected to
+        ``self.host`` (if given), the channels will be associated with the
+        client's `~paramiko.transport.Transport`, and the channels will
+        expect/provide command-execution behavior as specified on the
+        `.Command` objects supplied to this `.Session`.
+
+        The client is then attached as ``self.client`` and the channels as
+        ``self.channels``.
+
+        :returns:
+            ``None`` - this is mostly a "deferred setup" method and callers
+            will just reference the above attributes (and call more methods) as
+            needed.
+
+        .. versionadded:: 2.1
+        """
+        client = Mock()
+        transport = client.get_transport.return_value  # another Mock
+
+        # NOTE: this originally did chain([False], repeat(True)) so that
+        # get_transport().active was False initially, then True. However,
+        # because we also have to consider when get_transport() comes back None
+        # (which it does initially), the case where we get back a non-None
+        # transport _and_ it's not active yet, isn't useful to test, and
+        # complicates text expectations. So we don't, for now.
+        actives = repeat(True)
+        # NOTE: setting PropertyMocks on a mock's type() is apparently
+        # How It Must Be Done, otherwise it sets the real attr value.
+        type(transport).active = PropertyMock(side_effect=actives)
+
+        channels = []
+        for command in self.commands:
+            # Mock of a Channel instance, not e.g. Channel-the-class.
+            # Specifically, one that can track individual state for recv*().
+            channel = MockChannel(
+                stdout=BytesIO(command.out), stderr=BytesIO(command.err)
+            )
+            channel.recv_exit_status.return_value = command.exit
+
+            # If requested, make exit_status_ready return False the first N
+            # times it is called in the wait() loop.
+            readies = chain(repeat(False, command.waits), repeat(True))
+            channel.exit_status_ready.side_effect = readies
+
+            channels.append(channel)
+
+        # Have our transport yield those channel mocks in order when
+        # open_session() is called.
+        transport.open_session.side_effect = channels
+
+        # SFTP, if enabled
+        if self._enable_sftp:
+            self._start_sftp(client)
+
+        self.client = client
+        self.channels = channels
+
+    def _start_sftp(self, client):
+        # Patch os module for local stat and similar
+        self.os_patcher = patch("fabric.transfer.os")
+        mock_os = self.os_patcher.start()
+        # Patch Path class inside transfer.py to prevent real fs touchery
+        self.path_patcher = patch("fabric.transfer.Path")
+        self.path_patcher.start()
+        self.sftp = sftp = client.open_sftp.return_value
+
+        # Handle common filepath massage actions; tests will assume these.
+        def fake_abspath(path):
+            # Run normpath to avoid tests not seeing abspath wrinkles (like
+            # trailing slash chomping)
+            return "/local/{}".format(os.path.normpath(path))
+
+        mock_os.path.abspath.side_effect = fake_abspath
+        sftp.getcwd.return_value = "/remote"
+        # Ensure stat st_mode is a real number; Python 3's stat.S_IMODE doesn't
+        # like just being handed a MagicMock?
+        fake_mode = 0o644  # arbitrary real-ish mode
+        sftp.stat.return_value.st_mode = fake_mode
+        mock_os.stat.return_value.st_mode = fake_mode
+        # Not super clear to me why the 'wraps' functionality in mock isn't
+        # working for this :( reinstate a bunch of os(.path) so it still works
+        mock_os.sep = os.sep
+        for name in ("basename", "split", "join", "normpath"):
+            getattr(mock_os.path, name).side_effect = getattr(os.path, name)
+
+    @deprecated_no_docstring(
+        version="3.2",
+        reason="This method has been renamed to `safety_check` & will be removed in 4.0",  # noqa
+    )
+    def sanity_check(self):
+        return self.safety_check()
+
+    def safety_check(self):
+        # Short-circuit if user didn't give any expectations; otherwise our
+        # assumptions below will be inaccurately violated and explode.
+        if self.guard_only:
+            return
+
+        # Per-session we expect a single transport get
+        transport = self.client.get_transport
+        transport.assert_called_once_with()
+        # And a single connect to our target host.
+        self.client.connect.assert_called_once_with(
+            username=self.user or ANY,
+            hostname=self.host or ANY,
+            port=self.port or ANY,
+        )
+
+        # Calls to open_session will be 1-per-command but are on transport, not
+        # channel, so we can only really inspect how many happened in
+        # aggregate. Save a list for later comparison to call_args.
+        session_opens = []
+
+        for channel, command in zip(self.channels, self.commands):
+            # Expect an open_session for each command exec
+            session_opens.append(call())
+            # Expect that the channel gets an exec_command or etc
+            command.expect_execution(channel=channel)
+            # Expect written stdin, if given
+            if command.in_:
+                assert channel._stdin.getvalue() == command.in_
+
+        # Make sure open_session was called expected number of times.
+        calls = transport.return_value.open_session.call_args_list
+        assert calls == session_opens
+
+        # SFTP transfers
+        for transfer in self.transfers or []:
+            method_name = transfer.pop("method")
+            method = getattr(self.sftp, method_name)
+            method.assert_any_call(**transfer)
+
+    def stop(self):
+        """
+        Stop any internal per-session mocks.
+
+        .. versionadded:: 3.2
+        """
+        if hasattr(self, "os_patcher"):
+            self.os_patcher.stop()
+        if hasattr(self, "path_patcher"):
+            self.path_patcher.stop()
+
+
+class MockRemote:
+    """
+    Class representing mocked remote SSH/SFTP state.
+
+    It supports stop/start style patching (useful for doctests) but then wraps
+    that in a more convenient/common contextmanager pattern (useful in most
+    other situations). The latter is also leveraged by the
+    `fabric.testing.fixtures` module, recommended if you're using pytest.
+
+    Note that the `expect` and `expect_sessions` methods automatically call
+    `start`, so you won't normally need to do so by hand.
+
+    By default, a single anonymous/internal `Session` is created, for
+    convenience (eg mocking out SSH functionality as a safety measure). Users
+    requiring detailed remote session expectations can call methods like
+    `expect` or `expect_sessions`, which wipe that anonymous Session & set up a
+    new one instead.
+
+    .. versionadded:: 2.1
+    .. versionchanged:: 3.2
+        Added the ``enable_sftp`` init kwarg to enable mocking both SSH and
+        SFTP at the same time.
+    .. versionchanged:: 3.2
+        Added contextmanager semantics to the class, so you don't have to
+        remember to call `safety`/`stop`.
+    """
+
+    # TODO 4.0: delete enable_sftp and make its behavior default
+    def __init__(self, enable_sftp=False):
+        self._enable_sftp = enable_sftp
+        self.expect_sessions(Session(enable_sftp=enable_sftp))
+
+    def expect(self, *args, **kwargs):
+        """
+        Convenience method for creating & 'expect'ing a single `Session`.
+
+        Returns the single `MockChannel` yielded by that Session.
+
+        .. versionadded:: 2.1
+        """
+        kwargs.setdefault("enable_sftp", self._enable_sftp)
+        return self.expect_sessions(Session(*args, **kwargs))[0]
+
+    def expect_sessions(self, *sessions):
+        """
+        Sets the mocked remote environment to expect the given ``sessions``.
+
+        Returns a list of `MockChannel` objects, one per input `Session`.
+
+        .. versionadded:: 2.1
+        """
+        # First, stop the default session to clean up its state, if it seems to
+        # be running.
+        self.stop()
+        # Update sessions list with new session(s)
+        self.sessions = sessions
+        # And start patching again, returning mocked channels
+        return self.start()
+
+    # TODO 4.0: definitely clean this up once the SFTP bit isn't opt-in, doing
+    # that backwards compatibly was real gross
+    def start(self):
+        """
+        Start patching SSHClient with the stored sessions, returning channels.
+
+        .. versionadded:: 2.1
+        """
+        # Patch SSHClient so the sessions' generated mocks can be set as its
+        # return values
+        self.patcher = patcher = patch("fabric.connection.SSHClient")
+        SSHClient = patcher.start()
+        # Mock clients, to be inspected afterwards during safety-checks
+        clients = []
+        for session in self.sessions:
+            session.generate_mocks()
+            clients.append(session.client)
+        # Each time the mocked SSHClient class is instantiated, it will
+        # yield one of our mocked clients (w/ mocked transport & channel, and
+        # optionally SFTP subclient) generated above.
+        SSHClient.side_effect = clients
+        sessions = list(chain.from_iterable(x.channels for x in self.sessions))
+        # TODO: in future we _may_ want to change this so it returns SFTP file
+        # data as well?
+        return sessions
+
+    def stop(self):
+        """
+        Stop patching SSHClient.
+
+        .. versionadded:: 2.1
+        """
+        # Short circuit if we don't seem to have start()ed yet.
+        if not hasattr(self, "patcher"):
+            return
+        # Stop patching SSHClient
+        self.patcher.stop()
+        # Also ask all sessions to stop any of their self-owned mocks
+        for session in self.sessions:
+            session.stop()
+
+    @deprecated(
+        version="3.2",
+        reason="This method has been renamed to `safety` & will be removed in 4.0",  # noqa
+    )
+    def sanity(self):
+        """
+        Run post-execution sanity checks (usually 'was X called' tests.)
+
+        .. versionadded:: 2.1
+        """
+        return self.safety()
+
+    def safety(self):
+        """
+        Run post-execution safety checks (eg ensuring expected calls happened).
+
+        .. versionadded:: 3.2
+        """
+        for session in self.sessions:
+            session.safety_check()
+
+    def __enter__(self):
+        return self
+
+    def __exit__(self, *exc):
+        try:
+            self.safety()
+        finally:
+            self.stop()
+
+
+@deprecated(
+    version="3.2",
+    reason="This class has been merged with `MockRemote` which can now handle SFTP mocking too. Please switch to it!",  # noqa
+)
+class MockSFTP:
+    """
+    Class managing mocked SFTP remote state.
+
+    Used in start/stop fashion in eg doctests; wrapped in the SFTP fixtures in
+    conftest.py for main use.
+
+    .. versionadded:: 2.1
+    """
+
+    def __init__(self, autostart=True):
+        if autostart:
+            self.start()
+
+    def start(self):
+        # Set up mocks
+        self.os_patcher = patch("fabric.transfer.os")
+        self.client_patcher = patch("fabric.connection.SSHClient")
+        self.path_patcher = patch("fabric.transfer.Path")
+        mock_os = self.os_patcher.start()
+        Client = self.client_patcher.start()
+        self.path_patcher.start()
+        sftp = Client.return_value.open_sftp.return_value
+
+        # Handle common filepath massage actions; tests will assume these.
+        def fake_abspath(path):
+            # Run normpath to avoid tests not seeing abspath wrinkles (like
+            # trailing slash chomping)
+            return "/local/{}".format(os.path.normpath(path))
+
+        mock_os.path.abspath.side_effect = fake_abspath
+        sftp.getcwd.return_value = "/remote"
+        # Ensure stat st_mode is a real number; Python 3's stat.S_IMODE doesn't
+        # like just being handed a MagicMock?
+        fake_mode = 0o644  # arbitrary real-ish mode
+        sftp.stat.return_value.st_mode = fake_mode
+        mock_os.stat.return_value.st_mode = fake_mode
+        # Not super clear to me why the 'wraps' functionality in mock isn't
+        # working for this :( reinstate a bunch of os(.path) so it still works
+        mock_os.sep = os.sep
+        for name in ("basename", "split", "join", "normpath"):
+            getattr(mock_os.path, name).side_effect = getattr(os.path, name)
+        # Return the sftp and OS mocks for use by decorator use case.
+        return sftp, mock_os
+
+    def stop(self):
+        self.os_patcher.stop()
+        self.client_patcher.stop()
+        self.path_patcher.stop()
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/testing/fixtures.py b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/fixtures.py
new file mode 100644
index 0000000000000000000000000000000000000000..29c1b2435f401406fcc48b8d30843782e015a768
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/testing/fixtures.py
@@ -0,0 +1,190 @@
+"""
+`pytest <https://pytest.org>`_ fixtures for easy use of Fabric test helpers.
+
+To get Fabric plus this module's dependencies (as well as those of the main
+`fabric.testing.base` module which these fixtures wrap), ``pip install
+fabric[pytest]``.
+
+The simplest way to get these fixtures loaded into your test suite so Pytest
+notices them is to import them into a ``conftest.py`` (`docs
+<http://pytest.readthedocs.io/en/latest/fixture.html#conftest-py-sharing-fixture-functions>`_).
+For example, if you intend to use the `remote` and `client` fixtures::
+
+    from fabric.testing.fixtures import client, remote
+
+.. versionadded:: 2.1
+"""
+
+from unittest.mock import patch, Mock
+
+try:
+    from pytest import fixture
+except ImportError:
+    import warnings
+
+    warning = (
+        "You appear to be missing some optional test-related dependencies;"
+        "please 'pip install fabric[pytest]'."
+    )
+    warnings.warn(warning, ImportWarning)
+    raise
+
+from .. import Connection
+from ..transfer import Transfer
+
+from .base import MockRemote, MockSFTP
+
+
+@fixture
+def connection():
+    """
+    Yields a `.Connection` object with mocked methods.
+
+    Specifically:
+
+    - the hostname is set to ``"host"`` and the username to ``"user"``;
+    - the primary API members (`.Connection.run`, `.Connection.local`, etc) are
+      replaced with ``mock.Mock`` instances;
+    - the ``run.in_stream`` config option is set to ``False`` to avoid attempts
+      to read from stdin (which typically plays poorly with pytest and other
+      capturing test runners);
+
+    .. versionadded:: 2.1
+    """
+    c = Connection(host="host", user="user")
+    c.config.run.in_stream = False
+    c.run = Mock()
+    c.local = Mock()
+    # TODO: rest of API should get mocked too
+    # TODO: is there a nice way to mesh with MockRemote et al? Is that ever
+    # really that useful for code that just wants to assert about how run() and
+    # friends were called?
+    yield c
+
+
+#: A convenience rebinding of `connection`.
+#:
+#: .. versionadded:: 2.1
+cxn = connection
+
+
+# TODO 4.0: remove old remote() and make this the new remote()
+@fixture
+def remote_with_sftp():
+    """
+    Like `remote`, but with ``enable_sftp=True``.
+
+    To access the internal mocked SFTP client (eg for asserting SFTP
+    functionality was called), note that the returned `MockRemote` object has a
+    ``.sftp`` attribute when created in this mode.
+    """
+    # NOTE: recall that by default an instantiated MockRemote has a single
+    # internal anonymous session; so these fixtures are useful for autouse
+    # guardrails.
+    with MockRemote(enable_sftp=True) as remote:
+        yield remote
+
+
+@fixture
+def remote():
+    """
+    Fixture allowing setup of a mocked remote session & access to sub-mocks.
+
+    Yields a `.MockRemote` object (which may need to be updated via
+    `.MockRemote.expect`, `.MockRemote.expect_sessions`, etc; otherwise a
+    default session will be used) & calls `.MockRemote.safety` and
+    `.MockRemote.stop` on teardown.
+
+    .. versionadded:: 2.1
+    """
+    remote = MockRemote()
+    yield remote
+    remote.safety()
+    remote.stop()
+
+
+@fixture
+def sftp():
+    """
+    Fixture allowing setup of a mocked remote SFTP session.
+
+    Yields a 3-tuple of: Transfer() object, SFTPClient object, and mocked OS
+    module.
+
+    For many/most tests which only want the Transfer and/or SFTPClient objects,
+    see `sftp_objs` and `transfer` which wrap this fixture.
+
+    .. versionadded:: 2.1
+    """
+    mock = MockSFTP(autostart=False)
+    client, mock_os = mock.start()
+    # Regular ol transfer to save some time
+    transfer = Transfer(Connection("host"))
+    yield transfer, client, mock_os
+    # TODO: old mock_sftp() lacked any 'stop'...why? feels bad man
+
+
+@fixture
+def sftp_objs(sftp):
+    """
+    Wrapper for `sftp` which only yields the Transfer and SFTPClient.
+
+    .. versionadded:: 2.1
+    """
+    yield sftp[:2]
+
+
+@fixture
+def transfer(sftp):
+    """
+    Wrapper for `sftp` which only yields the Transfer object.
+
+    .. versionadded:: 2.1
+    """
+    yield sftp[0]
+
+
+@fixture
+def client():
+    """
+    Mocks `~paramiko.client.SSHClient` for testing calls to ``connect()``.
+
+    Yields a mocked ``SSHClient`` instance.
+
+    This fixture updates `~paramiko.client.SSHClient.get_transport` to return a
+    mock that appears active on first check, then inactive after, matching most
+    tests' needs by default:
+
+    - `.Connection` instantiates, with a None ``.transport``.
+    - Calls to ``.open()`` test ``.is_connected``, which returns ``False`` when
+      ``.transport`` is falsey, and so the first open will call
+      ``SSHClient.connect`` regardless.
+    - ``.open()`` then sets ``.transport`` to ``SSHClient.get_transport()``, so
+      ``Connection.transport`` is effectively
+      ``client.get_transport.return_value``.
+    - Subsequent activity will want to think the mocked SSHClient is
+      "connected", meaning we want the mocked transport's ``.active`` to be
+      ``True``.
+    - This includes `.Connection.close`, which short-circuits if
+      ``.is_connected``; having a statically ``True`` active flag means a full
+      open -> close cycle will run without error. (Only tests that double-close
+      or double-open should have issues here.)
+
+    End result is that:
+
+    - ``.is_connected`` behaves False after instantiation and before ``.open``,
+      then True after ``.open``
+    - ``.close`` will work normally on 1st call
+    - ``.close`` will behave "incorrectly" on subsequent calls (since it'll
+      think connection is still live.) Tests that check the idempotency of
+      ``.close`` will need to tweak their mock mid-test.
+
+    For 'full' fake remote session interaction (i.e. stdout/err
+    reading/writing, channel opens, etc) see `remote`.
+
+    .. versionadded:: 2.1
+    """
+    with patch("fabric.connection.SSHClient") as SSHClient:
+        client = SSHClient.return_value
+        client.get_transport.return_value = Mock(active=True)
+        yield client
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/transfer.py b/TP03/TP03/lib/python3.9/site-packages/fabric/transfer.py
new file mode 100644
index 0000000000000000000000000000000000000000..337513e9f132ff8ea922f206ecd8f417d236e5bc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/transfer.py
@@ -0,0 +1,364 @@
+"""
+File transfer via SFTP and/or SCP.
+"""
+
+import os
+import posixpath
+import stat
+
+from pathlib import Path
+
+from .util import debug  # TODO: actual logging! LOL
+
+# TODO: figure out best way to direct folks seeking rsync, to patchwork's rsync
+# call (which needs updating to use invoke.run() & fab 2 connection methods,
+# but is otherwise suitable).
+# UNLESS we want to try and shoehorn it into this module after all? Delegate
+# any recursive get/put to it? Requires users to have rsync available of
+# course.
+
+
+class Transfer:
+    """
+    `.Connection`-wrapping class responsible for managing file upload/download.
+
+    .. versionadded:: 2.0
+    """
+
+    # TODO: SFTP clear default, but how to do SCP? subclass? init kwarg?
+
+    def __init__(self, connection):
+        self.connection = connection
+
+    @property
+    def sftp(self):
+        return self.connection.sftp()
+
+    def is_remote_dir(self, path):
+        try:
+            return stat.S_ISDIR(self.sftp.stat(path).st_mode)
+        except IOError:
+            return False
+
+    def get(self, remote, local=None, preserve_mode=True):
+        """
+        Copy a file from wrapped connection's host to the local filesystem.
+
+        :param str remote:
+            Remote file to download.
+
+            May be absolute, or relative to the remote working directory.
+
+            .. note::
+                Most SFTP servers set the remote working directory to the
+                connecting user's home directory, and (unlike most shells) do
+                *not* expand tildes (``~``).
+
+                For example, instead of saying ``get("~/tmp/archive.tgz")``,
+                say ``get("tmp/archive.tgz")``.
+
+        :param local:
+            Local path to store downloaded file in, or a file-like object.
+
+            **If None or another 'falsey'/empty value is given** (the default),
+            the remote file is downloaded to the current working directory (as
+            seen by `os.getcwd`) using its remote filename. (This is equivalent
+            to giving ``"{basename}"``; see the below subsection on
+            interpolation.)
+
+            **If a string is given**, it should be a path to a local directory
+            or file and is subject to similar behavior as that seen by common
+            Unix utilities or OpenSSH's ``sftp`` or ``scp`` tools.
+
+            For example, if the local path is a directory, the remote path's
+            base filename will be added onto it (so ``get('foo/bar/file.txt',
+            '/tmp/')`` would result in creation or overwriting of
+            ``/tmp/file.txt``).
+
+            This path will be **interpolated** with some useful parameters,
+            using `str.format`:
+
+            - The `.Connection` object's ``host``, ``user`` and ``port``
+              attributes.
+            - The ``basename`` and ``dirname`` of the ``remote`` path, as
+              derived by `os.path` (specifically, its ``posixpath`` flavor, so
+              that the resulting values are useful on remote POSIX-compatible
+              SFTP servers even if the local client is Windows).
+            - Thus, for example, ``"/some/path/{user}@{host}/{basename}"`` will
+              yield different local paths depending on the properties of both
+              the connection and the remote path.
+
+            .. note::
+                If nonexistent directories are present in this path (including
+                the final path component, if it ends in `os.sep`) they will be
+                created automatically using `os.makedirs`.
+
+            **If a file-like object is given**, the contents of the remote file
+            are simply written into it.
+
+        :param bool preserve_mode:
+            Whether to `os.chmod` the local file so it matches the remote
+            file's mode (default: ``True``).
+
+        :returns: A `.Result` object.
+
+        .. versionadded:: 2.0
+        .. versionchanged:: 2.6
+            Added ``local`` path interpolation of connection & remote file
+            attributes.
+        .. versionchanged:: 2.6
+            Create missing ``local`` directories automatically.
+        """
+        # TODO: how does this API change if we want to implement
+        # remote-to-remote file transfer? (Is that even realistic?)
+        # TODO: callback support
+        # TODO: how best to allow changing the behavior/semantics of
+        # remote/local (e.g. users might want 'safer' behavior that complains
+        # instead of overwriting existing files) - this likely ties into the
+        # "how to handle recursive/rsync" and "how to handle scp" questions
+
+        # Massage remote path
+        if not remote:
+            raise ValueError("Remote path must not be empty!")
+        orig_remote = remote
+        remote = posixpath.join(
+            self.sftp.getcwd() or self.sftp.normalize("."), remote
+        )
+
+        # Massage local path
+        orig_local = local
+        is_file_like = hasattr(local, "write") and callable(local.write)
+        remote_filename = posixpath.basename(remote)
+        if not local:
+            local = remote_filename
+        # Path-driven local downloads need interpolation, abspath'ing &
+        # directory creation
+        if not is_file_like:
+            local = local.format(
+                host=self.connection.host,
+                user=self.connection.user,
+                port=self.connection.port,
+                dirname=posixpath.dirname(remote),
+                basename=remote_filename,
+            )
+            # Must treat dir vs file paths differently, lest we erroneously
+            # mkdir what was intended as a filename, and so that non-empty
+            # dir-like paths still get remote filename tacked on.
+            if local.endswith(os.sep):
+                dir_path = local
+                local = os.path.join(local, remote_filename)
+            else:
+                dir_path, _ = os.path.split(local)
+            local = os.path.abspath(local)
+            Path(dir_path).mkdir(parents=True, exist_ok=True)
+            # TODO: reimplement mkdir (or otherwise write a testing function)
+            # allowing us to track what was created so we can revert if
+            # transfer fails.
+            # TODO: Alternately, transfer to temp location and then move, but
+            # that's basically inverse of v1's sudo-put which gets messy
+
+        # Run Paramiko-level .get() (side-effects only. womp.)
+        # TODO: push some of the path handling into Paramiko; it should be
+        # responsible for dealing with path cleaning etc.
+        # TODO: probably preserve warning message from v1 when overwriting
+        # existing files. Use logging for that obviously.
+        #
+        # If local appears to be a file-like object, use sftp.getfo, not get
+        if is_file_like:
+            self.sftp.getfo(remotepath=remote, fl=local)
+        else:
+            self.sftp.get(remotepath=remote, localpath=local)
+            # Set mode to same as remote end
+            # TODO: Push this down into SFTPClient sometime (requires backwards
+            # incompat release.)
+            if preserve_mode:
+                remote_mode = self.sftp.stat(remote).st_mode
+                mode = stat.S_IMODE(remote_mode)
+                os.chmod(local, mode)
+        # Return something useful
+        return Result(
+            orig_remote=orig_remote,
+            remote=remote,
+            orig_local=orig_local,
+            local=local,
+            connection=self.connection,
+        )
+
+    def put(self, local, remote=None, preserve_mode=True):
+        """
+        Upload a file from the local filesystem to the current connection.
+
+        :param local:
+            Local path of file to upload, or a file-like object.
+
+            **If a string is given**, it should be a path to a local (regular)
+            file (not a directory).
+
+            .. note::
+                When dealing with nonexistent file paths, normal Python file
+                handling concerns come into play - for example, trying to
+                upload a nonexistent ``local`` path will typically result in an
+                `OSError`.
+
+            **If a file-like object is given**, its contents are written to the
+            remote file path.
+
+        :param str remote:
+            Remote path to which the local file will be written.
+
+            .. note::
+                Most SFTP servers set the remote working directory to the
+                connecting user's home directory, and (unlike most shells) do
+                *not* expand tildes (``~``).
+
+                For example, instead of saying ``put("archive.tgz",
+                "~/tmp/")``, say ``put("archive.tgz", "tmp/")``.
+
+                In addition, this means that 'falsey'/empty values (such as the
+                default value, ``None``) are allowed and result in uploading to
+                the remote home directory.
+
+            .. note::
+                When ``local`` is a file-like object, ``remote`` is required
+                and must refer to a valid file path (not a directory).
+
+        :param bool preserve_mode:
+            Whether to ``chmod`` the remote file so it matches the local file's
+            mode (default: ``True``).
+
+        :returns: A `.Result` object.
+
+        .. versionadded:: 2.0
+        """
+        if not local:
+            raise ValueError("Local path must not be empty!")
+
+        is_file_like = hasattr(local, "write") and callable(local.write)
+
+        # Massage remote path
+        orig_remote = remote
+        if is_file_like:
+            local_base = getattr(local, "name", None)
+        else:
+            local_base = os.path.basename(local)
+        if not remote:
+            if is_file_like:
+                raise ValueError(
+                    "Must give non-empty remote path when local is a file-like object!"  # noqa
+                )
+            else:
+                remote = local_base
+                debug("Massaged empty remote path into {!r}".format(remote))
+        elif self.is_remote_dir(remote):
+            # non-empty local_base implies a) text file path or b) FLO which
+            # had a non-empty .name attribute. huzzah!
+            if local_base:
+                remote = posixpath.join(remote, local_base)
+            else:
+                if is_file_like:
+                    raise ValueError(
+                        "Can't put a file-like-object into a directory unless it has a non-empty .name attribute!"  # noqa
+                    )
+                else:
+                    # TODO: can we ever really end up here? implies we want to
+                    # reorganize all this logic so it has fewer potential holes
+                    raise ValueError(
+                        "Somehow got an empty local file basename ({!r}) when uploading to a directory ({!r})!".format(  # noqa
+                            local_base, remote
+                        )
+                    )
+
+        prejoined_remote = remote
+        remote = posixpath.join(
+            self.sftp.getcwd() or self.sftp.normalize("."), remote
+        )
+        if remote != prejoined_remote:
+            msg = "Massaged relative remote path {!r} into {!r}"
+            debug(msg.format(prejoined_remote, remote))
+
+        # Massage local path
+        orig_local = local
+        if not is_file_like:
+            local = os.path.abspath(local)
+            if local != orig_local:
+                debug(
+                    "Massaged relative local path {!r} into {!r}".format(
+                        orig_local, local
+                    )
+                )  # noqa
+
+        # Run Paramiko-level .put() (side-effects only. womp.)
+        # TODO: push some of the path handling into Paramiko; it should be
+        # responsible for dealing with path cleaning etc.
+        # TODO: probably preserve warning message from v1 when overwriting
+        # existing files. Use logging for that obviously.
+        #
+        # If local appears to be a file-like object, use sftp.putfo, not put
+        if is_file_like:
+            msg = "Uploading file-like object {!r} to {!r}"
+            debug(msg.format(local, remote))
+            pointer = local.tell()
+            try:
+                local.seek(0)
+                self.sftp.putfo(fl=local, remotepath=remote)
+            finally:
+                local.seek(pointer)
+        else:
+            debug("Uploading {!r} to {!r}".format(local, remote))
+            self.sftp.put(localpath=local, remotepath=remote)
+            # Set mode to same as local end
+            # TODO: Push this down into SFTPClient sometime (requires backwards
+            # incompat release.)
+            if preserve_mode:
+                local_mode = os.stat(local).st_mode
+                mode = stat.S_IMODE(local_mode)
+                self.sftp.chmod(remote, mode)
+        # Return something useful
+        return Result(
+            orig_remote=orig_remote,
+            remote=remote,
+            orig_local=orig_local,
+            local=local,
+            connection=self.connection,
+        )
+
+
+class Result:
+    """
+    A container for information about the result of a file transfer.
+
+    See individual attribute/method documentation below for details.
+
+    .. note::
+        Unlike similar classes such as `invoke.runners.Result` or
+        `fabric.runners.Result` (which have a concept of "warn and return
+        anyways on failure") this class has no useful truthiness behavior. If a
+        file transfer fails, some exception will be raised, either an `OSError`
+        or an error from within Paramiko.
+
+    .. versionadded:: 2.0
+    """
+
+    # TODO: how does this differ from put vs get? field stating which? (feels
+    # meh) distinct classes differing, for now, solely by name? (also meh)
+    def __init__(self, local, orig_local, remote, orig_remote, connection):
+        #: The local path the file was saved as, or the object it was saved
+        #: into if a file-like object was given instead.
+        #:
+        #: If a string path, this value is massaged to be absolute; see
+        #: `.orig_local` for the original argument value.
+        self.local = local
+        #: The original value given as the returning method's ``local``
+        #: argument.
+        self.orig_local = orig_local
+        #: The remote path downloaded from. Massaged to be absolute; see
+        #: `.orig_remote` for the original argument value.
+        self.remote = remote
+        #: The original argument value given as the returning method's
+        #: ``remote`` argument.
+        self.orig_remote = orig_remote
+        #: The `.Connection` object this result was obtained from.
+        self.connection = connection
+
+    # TODO: ensure str/repr makes it easily differentiable from run() or
+    # local() result objects (and vice versa).
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/tunnels.py b/TP03/TP03/lib/python3.9/site-packages/fabric/tunnels.py
new file mode 100644
index 0000000000000000000000000000000000000000..bec69b51f9a356b0999f0d93487286334da9f750
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/tunnels.py
@@ -0,0 +1,154 @@
+"""
+Tunnel and connection forwarding internals.
+
+If you're looking for simple, end-user-focused connection forwarding, please
+see `.Connection`, e.g. `.Connection.forward_local`.
+"""
+
+import select
+import socket
+import time
+from threading import Event
+
+from invoke.exceptions import ThreadException
+from invoke.util import ExceptionHandlingThread
+
+
+class TunnelManager(ExceptionHandlingThread):
+    """
+    Thread subclass for tunnelling connections over SSH between two endpoints.
+
+    Specifically, one instance of this class is sufficient to sit around
+    forwarding any number of individual connections made to one end of the
+    tunnel or the other. If you need to forward connections between more than
+    one set of ports, you'll end up instantiating multiple TunnelManagers.
+
+    Wraps a `~paramiko.transport.Transport`, which should already be connected
+    to the remote server.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(
+        self,
+        local_host,
+        local_port,
+        remote_host,
+        remote_port,
+        transport,
+        finished,
+    ):
+        super().__init__()
+        self.local_address = (local_host, local_port)
+        self.remote_address = (remote_host, remote_port)
+        self.transport = transport
+        self.finished = finished
+
+    def _run(self):
+        # Track each tunnel that gets opened during our lifetime
+        tunnels = []
+
+        # Set up OS-level listener socket on forwarded port
+        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        # TODO: why do we want REUSEADDR exactly? and is it portable?
+        sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
+        # NOTE: choosing to deal with nonblocking semantics and a fast loop,
+        # versus an older approach which blocks & expects outer scope to cause
+        # a socket exception by close()ing the socket.
+        sock.setblocking(0)
+        sock.bind(self.local_address)
+        sock.listen(1)
+
+        while not self.finished.is_set():
+            # Main loop-wait: accept connections on the local listener
+            # NOTE: EAGAIN means "you're nonblocking and nobody happened to
+            # connect at this point in time"
+            try:
+                tun_sock, local_addr = sock.accept()
+                # Set TCP_NODELAY to match OpenSSH's forwarding socket behavior
+                tun_sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
+            except BlockingIOError:  # ie errno.EAGAIN
+                # TODO: make configurable
+                time.sleep(0.01)
+                continue
+
+            # Set up direct-tcpip channel on server end
+            # TODO: refactor w/ what's used for gateways
+            channel = self.transport.open_channel(
+                "direct-tcpip", self.remote_address, local_addr
+            )
+
+            # Set up 'worker' thread for this specific connection to our
+            # tunnel, plus its dedicated signal event (which will appear as a
+            # public attr, no need to track both independently).
+            finished = Event()
+            tunnel = Tunnel(channel=channel, sock=tun_sock, finished=finished)
+            tunnel.start()
+            tunnels.append(tunnel)
+
+        exceptions = []
+        # Propogate shutdown signal to all tunnels & wait for closure
+        # TODO: would be nice to have some output or at least logging here,
+        # especially for "sets up a handful of tunnels" use cases like
+        # forwarding nontrivial HTTP traffic.
+        for tunnel in tunnels:
+            tunnel.finished.set()
+            tunnel.join()
+            wrapper = tunnel.exception()
+            if wrapper:
+                exceptions.append(wrapper)
+        # Handle exceptions
+        if exceptions:
+            raise ThreadException(exceptions)
+
+        # All we have left to close is our own sock.
+        # TODO: use try/finally?
+        sock.close()
+
+
+class Tunnel(ExceptionHandlingThread):
+    """
+    Bidirectionally forward data between an SSH channel and local socket.
+
+    .. versionadded:: 2.0
+    """
+
+    def __init__(self, channel, sock, finished):
+        self.channel = channel
+        self.sock = sock
+        self.finished = finished
+        self.socket_chunk_size = 1024
+        self.channel_chunk_size = 1024
+        super().__init__()
+
+    def _run(self):
+        try:
+            empty_sock, empty_chan = None, None
+            while not self.finished.is_set():
+                r, w, x = select.select([self.sock, self.channel], [], [], 1)
+                if self.sock in r:
+                    empty_sock = self.read_and_write(
+                        self.sock, self.channel, self.socket_chunk_size
+                    )
+                if self.channel in r:
+                    empty_chan = self.read_and_write(
+                        self.channel, self.sock, self.channel_chunk_size
+                    )
+                if empty_sock or empty_chan:
+                    break
+        finally:
+            self.channel.close()
+            self.sock.close()
+
+    def read_and_write(self, reader, writer, chunk_size):
+        """
+        Read ``chunk_size`` from ``reader``, writing result to ``writer``.
+
+        Returns ``None`` if successful, or ``True`` if the read was empty.
+
+        .. versionadded:: 2.0
+        """
+        data = reader.recv(chunk_size)
+        if len(data) == 0:
+            return True
+        writer.sendall(data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/fabric/util.py b/TP03/TP03/lib/python3.9/site-packages/fabric/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..c47c422b39ab87007b32753d317ecb05338ee7a9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/fabric/util.py
@@ -0,0 +1,45 @@
+import logging
+import sys
+
+
+# Ape the half-assed logging junk from Invoke, but ensuring the logger reflects
+# our name, not theirs. (Assume most contexts will rely on Invoke itself to
+# literally enable/disable logging, for now.)
+log = logging.getLogger("fabric")
+for x in ("debug",):
+    globals()[x] = getattr(log, x)
+
+
+win32 = sys.platform == "win32"
+
+
+def get_local_user():
+    """
+    Return the local executing username, or ``None`` if one can't be found.
+
+    .. versionadded:: 2.0
+    """
+    # TODO: I don't understand why these lines were added outside the
+    # try/except, since presumably it means the attempt at catching ImportError
+    # wouldn't work. However, that's how the contributing user committed it.
+    # Need an older Windows box to test it out, most likely.
+    import getpass
+
+    username = None
+    # All Unix and most Windows systems support the getpass module.
+    try:
+        username = getpass.getuser()
+    # Some SaaS platforms raise KeyError, implying there is no real user
+    # involved. They get the default value of None.
+    except KeyError:
+        pass
+    # Older (?) Windows systems don't support getpass well; they should
+    # have the `win32` module instead.
+    except ImportError:  # pragma: nocover
+        if win32:
+            import win32api
+            import win32security  # noqa
+            import win32profile  # noqa
+
+            username = win32api.GetUserName()
+    return username
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/LICENSE.txt b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..96ece318ed5a5fa072e231c98495d746bacaeef9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2021 Peter Odding
+
+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/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..c36fa4cafe53d55ba15ddc3c4045db067a165282
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/METADATA
@@ -0,0 +1,216 @@
+Metadata-Version: 2.1
+Name: humanfriendly
+Version: 10.0
+Summary: Human friendly output for text interfaces using Python
+Home-page: https://humanfriendly.readthedocs.io
+Author: Peter Odding
+Author-email: peter@peterodding.com
+License: MIT
+Platform: UNKNOWN
+Classifier: Development Status :: 6 - Mature
+Classifier: Environment :: Console
+Classifier: Framework :: Sphinx :: Extension
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: MIT License
+Classifier: Natural Language :: English
+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 :: 3.9
+Classifier: Programming Language :: Python :: Implementation :: CPython
+Classifier: Programming Language :: Python :: Implementation :: PyPy
+Classifier: Topic :: Communications
+Classifier: Topic :: Scientific/Engineering :: Human Machine Interfaces
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: Software Development :: User Interfaces
+Classifier: Topic :: System :: Shells
+Classifier: Topic :: System :: System Shells
+Classifier: Topic :: System :: Systems Administration
+Classifier: Topic :: Terminals
+Classifier: Topic :: Text Processing :: General
+Classifier: Topic :: Text Processing :: Linguistic
+Classifier: Topic :: Utilities
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
+Requires-Dist: monotonic ; python_version == "2.7"
+Requires-Dist: pyreadline ; sys_platform == "win32" and python_version<"3.8"
+Requires-Dist: pyreadline3 ; sys_platform == "win32" and python_version>="3.8"
+
+humanfriendly: Human friendly input/output in Python
+====================================================
+
+.. image:: https://github.com/xolox/python-humanfriendly/actions/workflows/test.yml/badge.svg?branch=master
+   :target: https://github.com/xolox/python-humanfriendly/actions
+
+.. image:: https://codecov.io/gh/xolox/python-humanfriendly/branch/master/graph/badge.svg?token=jYaj4T74TU
+   :target: https://codecov.io/gh/xolox/python-humanfriendly
+
+The functions and classes in the `humanfriendly` package can be used to make
+text interfaces more user friendly. Some example features:
+
+- Parsing and formatting numbers, file sizes, pathnames and timespans in
+  simple, human friendly formats.
+
+- Easy to use timers for long running operations, with human friendly
+  formatting of the resulting timespans.
+
+- Prompting the user to select a choice from a list of options by typing the
+  option's number or a unique substring of the option.
+
+- Terminal interaction including text styling (`ANSI escape sequences`_), user
+  friendly rendering of usage messages and querying the terminal for its
+  size.
+
+The `humanfriendly` package is currently tested on Python 2.7, 3.5+ and PyPy
+(2.7) on Linux and macOS. While the intention is to support Windows as well,
+you may encounter some rough edges.
+
+.. contents::
+   :local:
+
+Getting started
+---------------
+
+It's very simple to start using the `humanfriendly` package::
+
+   >>> from humanfriendly import format_size, parse_size
+   >>> from humanfriendly.prompts import prompt_for_input
+   >>> user_input = prompt_for_input("Enter a readable file size: ")
+
+     Enter a readable file size: 16G
+
+   >>> num_bytes = parse_size(user_input)
+   >>> print(num_bytes)
+   16000000000
+   >>> print("You entered:", format_size(num_bytes))
+   You entered: 16 GB
+   >>> print("You entered:", format_size(num_bytes, binary=True))
+   You entered: 14.9 GiB
+
+To get a demonstration of supported terminal text styles (based on
+`ANSI escape sequences`_) you can run the following command::
+
+   $ humanfriendly --demo
+
+Command line
+------------
+
+.. A DRY solution to avoid duplication of the `humanfriendly --help' text:
+..
+.. [[[cog
+.. from humanfriendly.usage import inject_usage
+.. inject_usage('humanfriendly.cli')
+.. ]]]
+
+**Usage:** `humanfriendly [OPTIONS]`
+
+Human friendly input/output (text formatting) on the command
+line based on the Python package with the same name.
+
+**Supported options:**
+
+.. csv-table::
+   :header: Option, Description
+   :widths: 30, 70
+
+
+   "``-c``, ``--run-command``","Execute an external command (given as the positional arguments) and render
+   a spinner and timer while the command is running. The exit status of the
+   command is propagated."
+   ``--format-table``,"Read tabular data from standard input (each line is a row and each
+   whitespace separated field is a column), format the data as a table and
+   print the resulting table to standard output. See also the ``--delimiter``
+   option."
+   "``-d``, ``--delimiter=VALUE``","Change the delimiter used by ``--format-table`` to ``VALUE`` (a string). By default
+   all whitespace is treated as a delimiter."
+   "``-l``, ``--format-length=LENGTH``","Convert a length count (given as the integer or float ``LENGTH``) into a human
+   readable string and print that string to standard output."
+   "``-n``, ``--format-number=VALUE``","Format a number (given as the integer or floating point number ``VALUE``) with
+   thousands separators and two decimal places (if needed) and print the
+   formatted number to standard output."
+   "``-s``, ``--format-size=BYTES``","Convert a byte count (given as the integer ``BYTES``) into a human readable
+   string and print that string to standard output."
+   "``-b``, ``--binary``","Change the output of ``-s``, ``--format-size`` to use binary multiples of bytes
+   (base-2) instead of the default decimal multiples of bytes (base-10)."
+   "``-t``, ``--format-timespan=SECONDS``","Convert a number of seconds (given as the floating point number ``SECONDS``)
+   into a human readable timespan and print that string to standard output."
+   ``--parse-length=VALUE``,"Parse a human readable length (given as the string ``VALUE``) and print the
+   number of metres to standard output."
+   ``--parse-size=VALUE``,"Parse a human readable data size (given as the string ``VALUE``) and print the
+   number of bytes to standard output."
+   ``--demo``,"Demonstrate changing the style and color of the terminal font using ANSI
+   escape sequences."
+   "``-h``, ``--help``",Show this message and exit.
+
+.. [[[end]]]
+
+A note about size units
+-----------------------
+
+When I originally published the `humanfriendly` package I went with binary
+multiples of bytes (powers of two). It was pointed out several times that this
+was a poor choice (see issue `#4`_ and pull requests `#8`_ and `#9`_) and thus
+the new default became decimal multiples of bytes (powers of ten):
+
++------+---------------+---------------+
+| Unit | Binary value  | Decimal value |
++------+---------------+---------------+
+| KB   |          1024 |          1000 +
++------+---------------+---------------+
+| MB   |       1048576 |       1000000 |
++------+---------------+---------------+
+| GB   |    1073741824 |    1000000000 |
++------+---------------+---------------+
+| TB   | 1099511627776 | 1000000000000 |
++------+---------------+---------------+
+| etc  |               |               |
++------+---------------+---------------+
+
+The option to use binary multiples of bytes remains by passing the keyword
+argument `binary=True` to the `format_size()`_ and `parse_size()`_ functions.
+
+Windows support
+---------------
+
+Windows 10 gained native support for ANSI escape sequences which means commands
+like ``humanfriendly --demo`` should work out of the box (if your system is
+up-to-date enough). If this doesn't work then you can install the colorama_
+package, it will be used automatically once installed.
+
+Contact
+-------
+
+The latest version of `humanfriendly` is available on PyPI_ and GitHub_. The
+documentation is hosted on `Read the Docs`_ and includes a changelog_. For bug
+reports please create an issue on GitHub_. If you have questions, suggestions,
+etc. feel free to send me an e-mail at `peter@peterodding.com`_.
+
+License
+-------
+
+This software is licensed under the `MIT license`_.
+
+© 2021 Peter Odding.
+
+.. External references:
+.. _#4: https://github.com/xolox/python-humanfriendly/issues/4
+.. _#8: https://github.com/xolox/python-humanfriendly/pull/8
+.. _#9: https://github.com/xolox/python-humanfriendly/pull/9
+.. _ANSI escape sequences: https://en.wikipedia.org/wiki/ANSI_escape_code
+.. _changelog: https://humanfriendly.readthedocs.io/en/latest/changelog.html
+.. _colorama: https://pypi.org/project/colorama
+.. _format_size(): https://humanfriendly.readthedocs.io/en/latest/#humanfriendly.format_size
+.. _GitHub: https://github.com/xolox/python-humanfriendly
+.. _MIT license: https://en.wikipedia.org/wiki/MIT_License
+.. _parse_size(): https://humanfriendly.readthedocs.io/en/latest/#humanfriendly.parse_size
+.. _peter@peterodding.com: peter@peterodding.com
+.. _PyPI: https://pypi.org/project/humanfriendly
+.. _Read the Docs: https://humanfriendly.readthedocs.io
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..6f6953b4dfc92be10aace046b34629612da7a159
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/RECORD
@@ -0,0 +1,41 @@
+../../../bin/humanfriendly,sha256=H3QzN2ZQ5FUbNGG9nOMKBrnczEYSt9iifPzVy_avmq8,272
+humanfriendly-10.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+humanfriendly-10.0.dist-info/LICENSE.txt,sha256=SsSPQReAnyc0BmFQRQ8SCzuxEKwdOzIXB5XgVg27wfU,1056
+humanfriendly-10.0.dist-info/METADATA,sha256=aLs0k4jN_spgKsw0Vbg6ey_jy-hAJeJ0k7y-dvOrbII,9201
+humanfriendly-10.0.dist-info/RECORD,,
+humanfriendly-10.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+humanfriendly-10.0.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
+humanfriendly-10.0.dist-info/entry_points.txt,sha256=hU-ADsGls3mgf3plBt9B-oYLCtBDQiUJZ00khuAoqXc,58
+humanfriendly-10.0.dist-info/top_level.txt,sha256=7eKAKhckmlD4ZoWJkWmhnTs1pnP_bzF-56VTq0D7WIo,14
+humanfriendly/__init__.py,sha256=sPCMQv16m3p8xYwd3N3kUs1rewVJB3ZGDBkF0_8v6vo,31725
+humanfriendly/__pycache__/__init__.cpython-39.pyc,,
+humanfriendly/__pycache__/case.cpython-39.pyc,,
+humanfriendly/__pycache__/cli.cpython-39.pyc,,
+humanfriendly/__pycache__/compat.cpython-39.pyc,,
+humanfriendly/__pycache__/decorators.cpython-39.pyc,,
+humanfriendly/__pycache__/deprecation.cpython-39.pyc,,
+humanfriendly/__pycache__/prompts.cpython-39.pyc,,
+humanfriendly/__pycache__/sphinx.cpython-39.pyc,,
+humanfriendly/__pycache__/tables.cpython-39.pyc,,
+humanfriendly/__pycache__/testing.cpython-39.pyc,,
+humanfriendly/__pycache__/tests.cpython-39.pyc,,
+humanfriendly/__pycache__/text.cpython-39.pyc,,
+humanfriendly/__pycache__/usage.cpython-39.pyc,,
+humanfriendly/case.py,sha256=fkIinj4V1S8Xl3OCSYSgqKoGzCCbVJOjI5ZznViCT1Q,6008
+humanfriendly/cli.py,sha256=ZpGqTHLwfLjFACsQacYkN9DiBZkGecPzIHysliWN1i8,9822
+humanfriendly/compat.py,sha256=7qoFGMNFizGhs5BIyiMKTDUq29DxzuXGX4MRoZLo4ms,3984
+humanfriendly/decorators.py,sha256=ivxB-U9dfXUjCl4GZ8g_gKFC4a3uyxDVi-3rlxPjvJo,1501
+humanfriendly/deprecation.py,sha256=bdx1_T8L1gF635E41E6bYTqie9P3o7rY6n4wohjkLLk,9499
+humanfriendly/prompts.py,sha256=8PSJ1Hpr3ld6YkCaXQsTHAep9BtTKYlKmQi1RiaHIEc,16335
+humanfriendly/sphinx.py,sha256=BrFxK-rX3LN4iMqgNFuOTweYfppYp--O3HqWBlu05M0,11452
+humanfriendly/tables.py,sha256=lCDnEKyyZRmrIHrDlUzzVpg9z6lKOO8ldP4fh1gzMBI,13968
+humanfriendly/terminal/__init__.py,sha256=5BzxVHKriznclRjrWwYEk2l1ct0q0WdupJIrkuI9glc,30759
+humanfriendly/terminal/__pycache__/__init__.cpython-39.pyc,,
+humanfriendly/terminal/__pycache__/html.cpython-39.pyc,,
+humanfriendly/terminal/__pycache__/spinners.cpython-39.pyc,,
+humanfriendly/terminal/html.py,sha256=_csUZ4hID0ATwTvPXU8KrAe6ZzD_gUS7_tN3FmCHA4Q,16747
+humanfriendly/terminal/spinners.py,sha256=o7nkn8rBdTqr-XHIT972sIgIuxiDymQ5kPVkBzR7utE,11323
+humanfriendly/testing.py,sha256=hErsmBN5Crej5k1P_I0dhQK8IAwFr1IOZ9kQPIrZUys,24359
+humanfriendly/tests.py,sha256=3bkasrRgw0cAdZFHgmTo4DUHgXEnlHtRoq_t2MEafbc,68919
+humanfriendly/text.py,sha256=_WBG4SZ4bT5SH94zLUdfmB6NXbvc4gBYECEmQYXJ1sE,16212
+humanfriendly/usage.py,sha256=AhPo6DcvaBRIFGWNctU22McMzN3Ryc6ZCC83kt2Zbk4,13768
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/REQUESTED b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ef99c6cf3283b50a273ac4c6d009a0aa85597070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/WHEEL
@@ -0,0 +1,6 @@
+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/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..2ce8fb835327993d3f6319a10b722b908601de30
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/entry_points.txt
@@ -0,0 +1,3 @@
+[console_scripts]
+humanfriendly = humanfriendly.cli:main
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..f5368c4974de83a9507c8c10676150fc0f3e2b69
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly-10.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+humanfriendly
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__init__.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..4c0a333861df55f5676e6dfd69c5e5ac1ece0213
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__init__.py
@@ -0,0 +1,838 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: September 17, 2021
+# URL: https://humanfriendly.readthedocs.io
+
+"""The main module of the `humanfriendly` package."""
+
+# Standard library modules.
+import collections
+import datetime
+import decimal
+import numbers
+import os
+import os.path
+import re
+import time
+
+# Modules included in our package.
+from humanfriendly.compat import is_string, monotonic
+from humanfriendly.deprecation import define_aliases
+from humanfriendly.text import concatenate, format, pluralize, tokenize
+
+# Public identifiers that require documentation.
+__all__ = (
+    'CombinedUnit',
+    'InvalidDate',
+    'InvalidLength',
+    'InvalidSize',
+    'InvalidTimespan',
+    'SizeUnit',
+    'Timer',
+    '__version__',
+    'coerce_boolean',
+    'coerce_pattern',
+    'coerce_seconds',
+    'disk_size_units',
+    'format_length',
+    'format_number',
+    'format_path',
+    'format_size',
+    'format_timespan',
+    'length_size_units',
+    'parse_date',
+    'parse_length',
+    'parse_path',
+    'parse_size',
+    'parse_timespan',
+    'round_number',
+    'time_units',
+)
+
+# Semi-standard module versioning.
+__version__ = '10.0'
+
+# Named tuples to define units of size.
+SizeUnit = collections.namedtuple('SizeUnit', 'divider, symbol, name')
+CombinedUnit = collections.namedtuple('CombinedUnit', 'decimal, binary')
+
+# Common disk size units in binary (base-2) and decimal (base-10) multiples.
+disk_size_units = (
+    CombinedUnit(SizeUnit(1000**1, 'KB', 'kilobyte'), SizeUnit(1024**1, 'KiB', 'kibibyte')),
+    CombinedUnit(SizeUnit(1000**2, 'MB', 'megabyte'), SizeUnit(1024**2, 'MiB', 'mebibyte')),
+    CombinedUnit(SizeUnit(1000**3, 'GB', 'gigabyte'), SizeUnit(1024**3, 'GiB', 'gibibyte')),
+    CombinedUnit(SizeUnit(1000**4, 'TB', 'terabyte'), SizeUnit(1024**4, 'TiB', 'tebibyte')),
+    CombinedUnit(SizeUnit(1000**5, 'PB', 'petabyte'), SizeUnit(1024**5, 'PiB', 'pebibyte')),
+    CombinedUnit(SizeUnit(1000**6, 'EB', 'exabyte'), SizeUnit(1024**6, 'EiB', 'exbibyte')),
+    CombinedUnit(SizeUnit(1000**7, 'ZB', 'zettabyte'), SizeUnit(1024**7, 'ZiB', 'zebibyte')),
+    CombinedUnit(SizeUnit(1000**8, 'YB', 'yottabyte'), SizeUnit(1024**8, 'YiB', 'yobibyte')),
+)
+
+# Common length size units, used for formatting and parsing.
+length_size_units = (dict(prefix='nm', divider=1e-09, singular='nm', plural='nm'),
+                     dict(prefix='mm', divider=1e-03, singular='mm', plural='mm'),
+                     dict(prefix='cm', divider=1e-02, singular='cm', plural='cm'),
+                     dict(prefix='m', divider=1, singular='metre', plural='metres'),
+                     dict(prefix='km', divider=1000, singular='km', plural='km'))
+
+# Common time units, used for formatting of time spans.
+time_units = (dict(divider=1e-9, singular='nanosecond', plural='nanoseconds', abbreviations=['ns']),
+              dict(divider=1e-6, singular='microsecond', plural='microseconds', abbreviations=['us']),
+              dict(divider=1e-3, singular='millisecond', plural='milliseconds', abbreviations=['ms']),
+              dict(divider=1, singular='second', plural='seconds', abbreviations=['s', 'sec', 'secs']),
+              dict(divider=60, singular='minute', plural='minutes', abbreviations=['m', 'min', 'mins']),
+              dict(divider=60 * 60, singular='hour', plural='hours', abbreviations=['h']),
+              dict(divider=60 * 60 * 24, singular='day', plural='days', abbreviations=['d']),
+              dict(divider=60 * 60 * 24 * 7, singular='week', plural='weeks', abbreviations=['w']),
+              dict(divider=60 * 60 * 24 * 7 * 52, singular='year', plural='years', abbreviations=['y']))
+
+
+def coerce_boolean(value):
+    """
+    Coerce any value to a boolean.
+
+    :param value: Any Python value. If the value is a string:
+
+                  - The strings '1', 'yes', 'true' and 'on' are coerced to :data:`True`.
+                  - The strings '0', 'no', 'false' and 'off' are coerced to :data:`False`.
+                  - Other strings raise an exception.
+
+                  Other Python values are coerced using :class:`bool`.
+    :returns: A proper boolean value.
+    :raises: :exc:`exceptions.ValueError` when the value is a string but
+             cannot be coerced with certainty.
+    """
+    if is_string(value):
+        normalized = value.strip().lower()
+        if normalized in ('1', 'yes', 'true', 'on'):
+            return True
+        elif normalized in ('0', 'no', 'false', 'off', ''):
+            return False
+        else:
+            msg = "Failed to coerce string to boolean! (%r)"
+            raise ValueError(format(msg, value))
+    else:
+        return bool(value)
+
+
+def coerce_pattern(value, flags=0):
+    """
+    Coerce strings to compiled regular expressions.
+
+    :param value: A string containing a regular expression pattern
+                  or a compiled regular expression.
+    :param flags: The flags used to compile the pattern (an integer).
+    :returns: A compiled regular expression.
+    :raises: :exc:`~exceptions.ValueError` when `value` isn't a string
+             and also isn't a compiled regular expression.
+    """
+    if is_string(value):
+        value = re.compile(value, flags)
+    else:
+        empty_pattern = re.compile('')
+        pattern_type = type(empty_pattern)
+        if not isinstance(value, pattern_type):
+            msg = "Failed to coerce value to compiled regular expression! (%r)"
+            raise ValueError(format(msg, value))
+    return value
+
+
+def coerce_seconds(value):
+    """
+    Coerce a value to the number of seconds.
+
+    :param value: An :class:`int`, :class:`float` or
+                  :class:`datetime.timedelta` object.
+    :returns: An :class:`int` or :class:`float` value.
+
+    When `value` is a :class:`datetime.timedelta` object the
+    :meth:`~datetime.timedelta.total_seconds()` method is called.
+    """
+    if isinstance(value, datetime.timedelta):
+        return value.total_seconds()
+    if not isinstance(value, numbers.Number):
+        msg = "Failed to coerce value to number of seconds! (%r)"
+        raise ValueError(format(msg, value))
+    return value
+
+
+def format_size(num_bytes, keep_width=False, binary=False):
+    """
+    Format a byte count as a human readable file size.
+
+    :param num_bytes: The size to format in bytes (an integer).
+    :param keep_width: :data:`True` if trailing zeros should not be stripped,
+                       :data:`False` if they can be stripped.
+    :param binary: :data:`True` to use binary multiples of bytes (base-2),
+                   :data:`False` to use decimal multiples of bytes (base-10).
+    :returns: The corresponding human readable file size (a string).
+
+    This function knows how to format sizes in bytes, kilobytes, megabytes,
+    gigabytes, terabytes and petabytes. Some examples:
+
+    >>> from humanfriendly import format_size
+    >>> format_size(0)
+    '0 bytes'
+    >>> format_size(1)
+    '1 byte'
+    >>> format_size(5)
+    '5 bytes'
+    > format_size(1000)
+    '1 KB'
+    > format_size(1024, binary=True)
+    '1 KiB'
+    >>> format_size(1000 ** 3 * 4)
+    '4 GB'
+    """
+    for unit in reversed(disk_size_units):
+        if num_bytes >= unit.binary.divider and binary:
+            number = round_number(float(num_bytes) / unit.binary.divider, keep_width=keep_width)
+            return pluralize(number, unit.binary.symbol, unit.binary.symbol)
+        elif num_bytes >= unit.decimal.divider and not binary:
+            number = round_number(float(num_bytes) / unit.decimal.divider, keep_width=keep_width)
+            return pluralize(number, unit.decimal.symbol, unit.decimal.symbol)
+    return pluralize(num_bytes, 'byte')
+
+
+def parse_size(size, binary=False):
+    """
+    Parse a human readable data size and return the number of bytes.
+
+    :param size: The human readable file size to parse (a string).
+    :param binary: :data:`True` to use binary multiples of bytes (base-2) for
+                   ambiguous unit symbols and names, :data:`False` to use
+                   decimal multiples of bytes (base-10).
+    :returns: The corresponding size in bytes (an integer).
+    :raises: :exc:`InvalidSize` when the input can't be parsed.
+
+    This function knows how to parse sizes in bytes, kilobytes, megabytes,
+    gigabytes, terabytes and petabytes. Some examples:
+
+    >>> from humanfriendly import parse_size
+    >>> parse_size('42')
+    42
+    >>> parse_size('13b')
+    13
+    >>> parse_size('5 bytes')
+    5
+    >>> parse_size('1 KB')
+    1000
+    >>> parse_size('1 kilobyte')
+    1000
+    >>> parse_size('1 KiB')
+    1024
+    >>> parse_size('1 KB', binary=True)
+    1024
+    >>> parse_size('1.5 GB')
+    1500000000
+    >>> parse_size('1.5 GB', binary=True)
+    1610612736
+    """
+    tokens = tokenize(size)
+    if tokens and isinstance(tokens[0], numbers.Number):
+        # Get the normalized unit (if any) from the tokenized input.
+        normalized_unit = tokens[1].lower() if len(tokens) == 2 and is_string(tokens[1]) else ''
+        # If the input contains only a number, it's assumed to be the number of
+        # bytes. The second token can also explicitly reference the unit bytes.
+        if len(tokens) == 1 or normalized_unit.startswith('b'):
+            return int(tokens[0])
+        # Otherwise we expect two tokens: A number and a unit.
+        if normalized_unit:
+            # Convert plural units to singular units, for details:
+            # https://github.com/xolox/python-humanfriendly/issues/26
+            normalized_unit = normalized_unit.rstrip('s')
+            for unit in disk_size_units:
+                # First we check for unambiguous symbols (KiB, MiB, GiB, etc)
+                # and names (kibibyte, mebibyte, gibibyte, etc) because their
+                # handling is always the same.
+                if normalized_unit in (unit.binary.symbol.lower(), unit.binary.name.lower()):
+                    return int(tokens[0] * unit.binary.divider)
+                # Now we will deal with ambiguous prefixes (K, M, G, etc),
+                # symbols (KB, MB, GB, etc) and names (kilobyte, megabyte,
+                # gigabyte, etc) according to the caller's preference.
+                if (normalized_unit in (unit.decimal.symbol.lower(), unit.decimal.name.lower()) or
+                        normalized_unit.startswith(unit.decimal.symbol[0].lower())):
+                    return int(tokens[0] * (unit.binary.divider if binary else unit.decimal.divider))
+    # We failed to parse the size specification.
+    msg = "Failed to parse size! (input %r was tokenized as %r)"
+    raise InvalidSize(format(msg, size, tokens))
+
+
+def format_length(num_metres, keep_width=False):
+    """
+    Format a metre count as a human readable length.
+
+    :param num_metres: The length to format in metres (float / integer).
+    :param keep_width: :data:`True` if trailing zeros should not be stripped,
+                       :data:`False` if they can be stripped.
+    :returns: The corresponding human readable length (a string).
+
+    This function supports ranges from nanometres to kilometres.
+
+    Some examples:
+
+    >>> from humanfriendly import format_length
+    >>> format_length(0)
+    '0 metres'
+    >>> format_length(1)
+    '1 metre'
+    >>> format_length(5)
+    '5 metres'
+    >>> format_length(1000)
+    '1 km'
+    >>> format_length(0.004)
+    '4 mm'
+    """
+    for unit in reversed(length_size_units):
+        if num_metres >= unit['divider']:
+            number = round_number(float(num_metres) / unit['divider'], keep_width=keep_width)
+            return pluralize(number, unit['singular'], unit['plural'])
+    return pluralize(num_metres, 'metre')
+
+
+def parse_length(length):
+    """
+    Parse a human readable length and return the number of metres.
+
+    :param length: The human readable length to parse (a string).
+    :returns: The corresponding length in metres (a float).
+    :raises: :exc:`InvalidLength` when the input can't be parsed.
+
+    Some examples:
+
+    >>> from humanfriendly import parse_length
+    >>> parse_length('42')
+    42
+    >>> parse_length('1 km')
+    1000
+    >>> parse_length('5mm')
+    0.005
+    >>> parse_length('15.3cm')
+    0.153
+    """
+    tokens = tokenize(length)
+    if tokens and isinstance(tokens[0], numbers.Number):
+        # If the input contains only a number, it's assumed to be the number of metres.
+        if len(tokens) == 1:
+            return tokens[0]
+        # Otherwise we expect to find two tokens: A number and a unit.
+        if len(tokens) == 2 and is_string(tokens[1]):
+            normalized_unit = tokens[1].lower()
+            # Try to match the first letter of the unit.
+            for unit in length_size_units:
+                if normalized_unit.startswith(unit['prefix']):
+                    return tokens[0] * unit['divider']
+    # We failed to parse the length specification.
+    msg = "Failed to parse length! (input %r was tokenized as %r)"
+    raise InvalidLength(format(msg, length, tokens))
+
+
+def format_number(number, num_decimals=2):
+    """
+    Format a number as a string including thousands separators.
+
+    :param number: The number to format (a number like an :class:`int`,
+                   :class:`long` or :class:`float`).
+    :param num_decimals: The number of decimals to render (2 by default). If no
+                         decimal places are required to represent the number
+                         they will be omitted regardless of this argument.
+    :returns: The formatted number (a string).
+
+    This function is intended to make it easier to recognize the order of size
+    of the number being formatted.
+
+    Here's an example:
+
+    >>> from humanfriendly import format_number
+    >>> print(format_number(6000000))
+    6,000,000
+    > print(format_number(6000000000.42))
+    6,000,000,000.42
+    > print(format_number(6000000000.42, num_decimals=0))
+    6,000,000,000
+    """
+    integer_part, _, decimal_part = str(float(number)).partition('.')
+    negative_sign = integer_part.startswith('-')
+    reversed_digits = ''.join(reversed(integer_part.lstrip('-')))
+    parts = []
+    while reversed_digits:
+        parts.append(reversed_digits[:3])
+        reversed_digits = reversed_digits[3:]
+    formatted_number = ''.join(reversed(','.join(parts)))
+    decimals_to_add = decimal_part[:num_decimals].rstrip('0')
+    if decimals_to_add:
+        formatted_number += '.' + decimals_to_add
+    if negative_sign:
+        formatted_number = '-' + formatted_number
+    return formatted_number
+
+
+def round_number(count, keep_width=False):
+    """
+    Round a floating point number to two decimal places in a human friendly format.
+
+    :param count: The number to format.
+    :param keep_width: :data:`True` if trailing zeros should not be stripped,
+                       :data:`False` if they can be stripped.
+    :returns: The formatted number as a string. If no decimal places are
+              required to represent the number, they will be omitted.
+
+    The main purpose of this function is to be used by functions like
+    :func:`format_length()`, :func:`format_size()` and
+    :func:`format_timespan()`.
+
+    Here are some examples:
+
+    >>> from humanfriendly import round_number
+    >>> round_number(1)
+    '1'
+    >>> round_number(math.pi)
+    '3.14'
+    >>> round_number(5.001)
+    '5'
+    """
+    text = '%.2f' % float(count)
+    if not keep_width:
+        text = re.sub('0+$', '', text)
+        text = re.sub(r'\.$', '', text)
+    return text
+
+
+def format_timespan(num_seconds, detailed=False, max_units=3):
+    """
+    Format a timespan in seconds as a human readable string.
+
+    :param num_seconds: Any value accepted by :func:`coerce_seconds()`.
+    :param detailed: If :data:`True` milliseconds are represented separately
+                     instead of being represented as fractional seconds
+                     (defaults to :data:`False`).
+    :param max_units: The maximum number of units to show in the formatted time
+                      span (an integer, defaults to three).
+    :returns: The formatted timespan as a string.
+    :raise: See :func:`coerce_seconds()`.
+
+    Some examples:
+
+    >>> from humanfriendly import format_timespan
+    >>> format_timespan(0)
+    '0 seconds'
+    >>> format_timespan(1)
+    '1 second'
+    >>> import math
+    >>> format_timespan(math.pi)
+    '3.14 seconds'
+    >>> hour = 60 * 60
+    >>> day = hour * 24
+    >>> week = day * 7
+    >>> format_timespan(week * 52 + day * 2 + hour * 3)
+    '1 year, 2 days and 3 hours'
+    """
+    num_seconds = coerce_seconds(num_seconds)
+    if num_seconds < 60 and not detailed:
+        # Fast path.
+        return pluralize(round_number(num_seconds), 'second')
+    else:
+        # Slow path.
+        result = []
+        num_seconds = decimal.Decimal(str(num_seconds))
+        relevant_units = list(reversed(time_units[0 if detailed else 3:]))
+        for unit in relevant_units:
+            # Extract the unit count from the remaining time.
+            divider = decimal.Decimal(str(unit['divider']))
+            count = num_seconds / divider
+            num_seconds %= divider
+            # Round the unit count appropriately.
+            if unit != relevant_units[-1]:
+                # Integer rounding for all but the smallest unit.
+                count = int(count)
+            else:
+                # Floating point rounding for the smallest unit.
+                count = round_number(count)
+            # Only include relevant units in the result.
+            if count not in (0, '0'):
+                result.append(pluralize(count, unit['singular'], unit['plural']))
+        if len(result) == 1:
+            # A single count/unit combination.
+            return result[0]
+        else:
+            if not detailed:
+                # Remove `insignificant' data from the formatted timespan.
+                result = result[:max_units]
+            # Format the timespan in a readable way.
+            return concatenate(result)
+
+
+def parse_timespan(timespan):
+    """
+    Parse a "human friendly" timespan into the number of seconds.
+
+    :param value: A string like ``5h`` (5 hours), ``10m`` (10 minutes) or
+                  ``42s`` (42 seconds).
+    :returns: The number of seconds as a floating point number.
+    :raises: :exc:`InvalidTimespan` when the input can't be parsed.
+
+    Note that the :func:`parse_timespan()` function is not meant to be the
+    "mirror image" of the :func:`format_timespan()` function. Instead it's
+    meant to allow humans to easily and succinctly specify a timespan with a
+    minimal amount of typing. It's very useful to accept easy to write time
+    spans as e.g. command line arguments to programs.
+
+    The time units (and abbreviations) supported by this function are:
+
+    - ms, millisecond, milliseconds
+    - s, sec, secs, second, seconds
+    - m, min, mins, minute, minutes
+    - h, hour, hours
+    - d, day, days
+    - w, week, weeks
+    - y, year, years
+
+    Some examples:
+
+    >>> from humanfriendly import parse_timespan
+    >>> parse_timespan('42')
+    42.0
+    >>> parse_timespan('42s')
+    42.0
+    >>> parse_timespan('1m')
+    60.0
+    >>> parse_timespan('1h')
+    3600.0
+    >>> parse_timespan('1d')
+    86400.0
+    """
+    tokens = tokenize(timespan)
+    if tokens and isinstance(tokens[0], numbers.Number):
+        # If the input contains only a number, it's assumed to be the number of seconds.
+        if len(tokens) == 1:
+            return float(tokens[0])
+        # Otherwise we expect to find two tokens: A number and a unit.
+        if len(tokens) == 2 and is_string(tokens[1]):
+            normalized_unit = tokens[1].lower()
+            for unit in time_units:
+                if (normalized_unit == unit['singular'] or
+                        normalized_unit == unit['plural'] or
+                        normalized_unit in unit['abbreviations']):
+                    return float(tokens[0]) * unit['divider']
+    # We failed to parse the timespan specification.
+    msg = "Failed to parse timespan! (input %r was tokenized as %r)"
+    raise InvalidTimespan(format(msg, timespan, tokens))
+
+
+def parse_date(datestring):
+    """
+    Parse a date/time string into a tuple of integers.
+
+    :param datestring: The date/time string to parse.
+    :returns: A tuple with the numbers ``(year, month, day, hour, minute,
+              second)`` (all numbers are integers).
+    :raises: :exc:`InvalidDate` when the date cannot be parsed.
+
+    Supported date/time formats:
+
+    - ``YYYY-MM-DD``
+    - ``YYYY-MM-DD HH:MM:SS``
+
+    .. note:: If you want to parse date/time strings with a fixed, known
+              format and :func:`parse_date()` isn't useful to you, consider
+              :func:`time.strptime()` or :meth:`datetime.datetime.strptime()`,
+              both of which are included in the Python standard library.
+              Alternatively for more complex tasks consider using the date/time
+              parsing module in the dateutil_ package.
+
+    Examples:
+
+    >>> from humanfriendly import parse_date
+    >>> parse_date('2013-06-17')
+    (2013, 6, 17, 0, 0, 0)
+    >>> parse_date('2013-06-17 02:47:42')
+    (2013, 6, 17, 2, 47, 42)
+
+    Here's how you convert the result to a number (`Unix time`_):
+
+    >>> from humanfriendly import parse_date
+    >>> from time import mktime
+    >>> mktime(parse_date('2013-06-17 02:47:42') + (-1, -1, -1))
+    1371430062.0
+
+    And here's how you convert it to a :class:`datetime.datetime` object:
+
+    >>> from humanfriendly import parse_date
+    >>> from datetime import datetime
+    >>> datetime(*parse_date('2013-06-17 02:47:42'))
+    datetime.datetime(2013, 6, 17, 2, 47, 42)
+
+    Here's an example that combines :func:`format_timespan()` and
+    :func:`parse_date()` to calculate a human friendly timespan since a
+    given date:
+
+    >>> from humanfriendly import format_timespan, parse_date
+    >>> from time import mktime, time
+    >>> unix_time = mktime(parse_date('2013-06-17 02:47:42') + (-1, -1, -1))
+    >>> seconds_since_then = time() - unix_time
+    >>> print(format_timespan(seconds_since_then))
+    1 year, 43 weeks and 1 day
+
+    .. _dateutil: https://dateutil.readthedocs.io/en/latest/parser.html
+    .. _Unix time: http://en.wikipedia.org/wiki/Unix_time
+    """
+    try:
+        tokens = [t.strip() for t in datestring.split()]
+        if len(tokens) >= 2:
+            date_parts = list(map(int, tokens[0].split('-'))) + [1, 1]
+            time_parts = list(map(int, tokens[1].split(':'))) + [0, 0, 0]
+            return tuple(date_parts[0:3] + time_parts[0:3])
+        else:
+            year, month, day = (list(map(int, datestring.split('-'))) + [1, 1])[0:3]
+            return (year, month, day, 0, 0, 0)
+    except Exception:
+        msg = "Invalid date! (expected 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' but got: %r)"
+        raise InvalidDate(format(msg, datestring))
+
+
+def format_path(pathname):
+    """
+    Shorten a pathname to make it more human friendly.
+
+    :param pathname: An absolute pathname (a string).
+    :returns: The pathname with the user's home directory abbreviated.
+
+    Given an absolute pathname, this function abbreviates the user's home
+    directory to ``~/`` in order to shorten the pathname without losing
+    information. It is not an error if the pathname is not relative to the
+    current user's home directory.
+
+    Here's an example of its usage:
+
+    >>> from os import environ
+    >>> from os.path import join
+    >>> vimrc = join(environ['HOME'], '.vimrc')
+    >>> vimrc
+    '/home/peter/.vimrc'
+    >>> from humanfriendly import format_path
+    >>> format_path(vimrc)
+    '~/.vimrc'
+    """
+    pathname = os.path.abspath(pathname)
+    home = os.environ.get('HOME')
+    if home:
+        home = os.path.abspath(home)
+        if pathname.startswith(home):
+            pathname = os.path.join('~', os.path.relpath(pathname, home))
+    return pathname
+
+
+def parse_path(pathname):
+    """
+    Convert a human friendly pathname to an absolute pathname.
+
+    Expands leading tildes using :func:`os.path.expanduser()` and
+    environment variables using :func:`os.path.expandvars()` and makes the
+    resulting pathname absolute using :func:`os.path.abspath()`.
+
+    :param pathname: A human friendly pathname (a string).
+    :returns: An absolute pathname (a string).
+    """
+    return os.path.abspath(os.path.expanduser(os.path.expandvars(pathname)))
+
+
+class Timer(object):
+
+    """
+    Easy to use timer to keep track of long during operations.
+    """
+
+    def __init__(self, start_time=None, resumable=False):
+        """
+        Remember the time when the :class:`Timer` was created.
+
+        :param start_time: The start time (a float, defaults to the current time).
+        :param resumable: Create a resumable timer (defaults to :data:`False`).
+
+        When `start_time` is given :class:`Timer` uses :func:`time.time()` as a
+        clock source, otherwise it uses :func:`humanfriendly.compat.monotonic()`.
+        """
+        if resumable:
+            self.monotonic = True
+            self.resumable = True
+            self.start_time = 0.0
+            self.total_time = 0.0
+        elif start_time:
+            self.monotonic = False
+            self.resumable = False
+            self.start_time = start_time
+        else:
+            self.monotonic = True
+            self.resumable = False
+            self.start_time = monotonic()
+
+    def __enter__(self):
+        """
+        Start or resume counting elapsed time.
+
+        :returns: The :class:`Timer` object.
+        :raises: :exc:`~exceptions.ValueError` when the timer isn't resumable.
+        """
+        if not self.resumable:
+            raise ValueError("Timer is not resumable!")
+        self.start_time = monotonic()
+        return self
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """
+        Stop counting elapsed time.
+
+        :raises: :exc:`~exceptions.ValueError` when the timer isn't resumable.
+        """
+        if not self.resumable:
+            raise ValueError("Timer is not resumable!")
+        if self.start_time:
+            self.total_time += monotonic() - self.start_time
+            self.start_time = 0.0
+
+    def sleep(self, seconds):
+        """
+        Easy to use rate limiting of repeating actions.
+
+        :param seconds: The number of seconds to sleep (an
+                        integer or floating point number).
+
+        This method sleeps for the given number of seconds minus the
+        :attr:`elapsed_time`. If the resulting duration is negative
+        :func:`time.sleep()` will still be called, but the argument
+        given to it will be the number 0 (negative numbers cause
+        :func:`time.sleep()` to raise an exception).
+
+        The use case for this is to initialize a :class:`Timer` inside
+        the body of a :keyword:`for` or :keyword:`while` loop and call
+        :func:`Timer.sleep()` at the end of the loop body to rate limit
+        whatever it is that is being done inside the loop body.
+
+        For posterity: Although the implementation of :func:`sleep()` only
+        requires a single line of code I've added it to :mod:`humanfriendly`
+        anyway because now that I've thought about how to tackle this once I
+        never want to have to think about it again :-P (unless I find ways to
+        improve this).
+        """
+        time.sleep(max(0, seconds - self.elapsed_time))
+
+    @property
+    def elapsed_time(self):
+        """
+        Get the number of seconds counted so far.
+        """
+        elapsed_time = 0
+        if self.resumable:
+            elapsed_time += self.total_time
+        if self.start_time:
+            current_time = monotonic() if self.monotonic else time.time()
+            elapsed_time += current_time - self.start_time
+        return elapsed_time
+
+    @property
+    def rounded(self):
+        """Human readable timespan rounded to seconds (a string)."""
+        return format_timespan(round(self.elapsed_time))
+
+    def __str__(self):
+        """Show the elapsed time since the :class:`Timer` was created."""
+        return format_timespan(self.elapsed_time)
+
+
+class InvalidDate(Exception):
+
+    """
+    Raised when a string cannot be parsed into a date.
+
+    For example:
+
+    >>> from humanfriendly import parse_date
+    >>> parse_date('2013-06-XY')
+    Traceback (most recent call last):
+      File "humanfriendly.py", line 206, in parse_date
+        raise InvalidDate(format(msg, datestring))
+    humanfriendly.InvalidDate: Invalid date! (expected 'YYYY-MM-DD' or 'YYYY-MM-DD HH:MM:SS' but got: '2013-06-XY')
+    """
+
+
+class InvalidSize(Exception):
+
+    """
+    Raised when a string cannot be parsed into a file size.
+
+    For example:
+
+    >>> from humanfriendly import parse_size
+    >>> parse_size('5 Z')
+    Traceback (most recent call last):
+      File "humanfriendly/__init__.py", line 267, in parse_size
+        raise InvalidSize(format(msg, size, tokens))
+    humanfriendly.InvalidSize: Failed to parse size! (input '5 Z' was tokenized as [5, 'Z'])
+    """
+
+
+class InvalidLength(Exception):
+
+    """
+    Raised when a string cannot be parsed into a length.
+
+    For example:
+
+    >>> from humanfriendly import parse_length
+    >>> parse_length('5 Z')
+    Traceback (most recent call last):
+      File "humanfriendly/__init__.py", line 267, in parse_length
+        raise InvalidLength(format(msg, length, tokens))
+    humanfriendly.InvalidLength: Failed to parse length! (input '5 Z' was tokenized as [5, 'Z'])
+    """
+
+
+class InvalidTimespan(Exception):
+
+    """
+    Raised when a string cannot be parsed into a timespan.
+
+    For example:
+
+    >>> from humanfriendly import parse_timespan
+    >>> parse_timespan('1 age')
+    Traceback (most recent call last):
+      File "humanfriendly/__init__.py", line 419, in parse_timespan
+        raise InvalidTimespan(format(msg, timespan, tokens))
+    humanfriendly.InvalidTimespan: Failed to parse timespan! (input '1 age' was tokenized as [1, 'age'])
+    """
+
+
+# Define aliases for backwards compatibility.
+define_aliases(
+    module_name=__name__,
+    # In humanfriendly 1.23 the format_table() function was added to render a
+    # table using characters like dashes and vertical bars to emulate borders.
+    # Since then support for other tables has been added and the name of
+    # format_table() has changed.
+    format_table='humanfriendly.tables.format_pretty_table',
+    # In humanfriendly 1.30 the following text manipulation functions were
+    # moved out into a separate module to enable their usage in other modules
+    # of the humanfriendly package (without causing circular imports).
+    compact='humanfriendly.text.compact',
+    concatenate='humanfriendly.text.concatenate',
+    dedent='humanfriendly.text.dedent',
+    format='humanfriendly.text.format',
+    is_empty_line='humanfriendly.text.is_empty_line',
+    pluralize='humanfriendly.text.pluralize',
+    tokenize='humanfriendly.text.tokenize',
+    trim_empty_lines='humanfriendly.text.trim_empty_lines',
+    # In humanfriendly 1.38 the prompt_for_choice() function was moved out into a
+    # separate module because several variants of interactive prompts were added.
+    prompt_for_choice='humanfriendly.prompts.prompt_for_choice',
+    # In humanfriendly 8.0 the Spinner class and minimum_spinner_interval
+    # variable were extracted to a new module and the erase_line_code,
+    # hide_cursor_code and show_cursor_code variables were moved.
+    AutomaticSpinner='humanfriendly.terminal.spinners.AutomaticSpinner',
+    Spinner='humanfriendly.terminal.spinners.Spinner',
+    erase_line_code='humanfriendly.terminal.ANSI_ERASE_LINE',
+    hide_cursor_code='humanfriendly.terminal.ANSI_SHOW_CURSOR',
+    minimum_spinner_interval='humanfriendly.terminal.spinners.MINIMUM_INTERVAL',
+    show_cursor_code='humanfriendly.terminal.ANSI_HIDE_CURSOR',
+)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..67049406237bb56cd8ca5312b0c5866befa399e9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/case.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/case.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4bad0718acecbca688255deea164612fb2efc770
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/case.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/cli.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/cli.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..94f8f4645910db0a9963440e64bf961676348d73
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/cli.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7290a0371f7fa31f03283ac1ecdb945607f52676
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/decorators.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/decorators.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c796fe8a639269d67d20553b3b0532722b6d766f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/decorators.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/deprecation.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/deprecation.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1e7e9e9068349ff4c3325ea2b10fcc75a26f6d1f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/deprecation.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/prompts.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/prompts.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1e0a202b35d8f499b3c9cb724ed0516cebc4cebb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/prompts.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/sphinx.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/sphinx.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6a6fb5ecc9f0d0970449a873885be7e40abd7918
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/sphinx.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tables.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tables.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..650859483efa406eb91fac54a9f98e846d780dc4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tables.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/testing.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/testing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b1eb118bc799f5dff7762c6cc26329f3a6591d74
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/testing.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tests.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tests.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8ca584c13ce91d5588f5f53058423f8b083f0b99
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/tests.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/text.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/text.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3b6f3100a3341941ce1c24f5bf0b47fdcc440a11
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/text.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/usage.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/usage.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..452e81bd85d9395edc1b3a8c598eccb496075169
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/__pycache__/usage.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/case.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/case.py
new file mode 100644
index 0000000000000000000000000000000000000000..4c71857e40c4d1f517c0069b0b83ababcdfc0ae8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/case.py
@@ -0,0 +1,157 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: April 19, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Simple case insensitive dictionaries.
+
+The :class:`CaseInsensitiveDict` class is a dictionary whose string keys
+are case insensitive. It works by automatically coercing string keys to
+:class:`CaseInsensitiveKey` objects. Keys that are not strings are
+supported as well, just without case insensitivity.
+
+At its core this module works by normalizing strings to lowercase before
+comparing or hashing them. It doesn't support proper case folding nor
+does it support Unicode normalization, hence the word "simple".
+"""
+
+# Standard library modules.
+import collections
+
+try:
+    # Python >= 3.3.
+    from collections.abc import Iterable, Mapping
+except ImportError:
+    # Python 2.7.
+    from collections import Iterable, Mapping
+
+# Modules included in our package.
+from humanfriendly.compat import basestring, unicode
+
+# Public identifiers that require documentation.
+__all__ = ("CaseInsensitiveDict", "CaseInsensitiveKey")
+
+
+class CaseInsensitiveDict(collections.OrderedDict):
+
+    """
+    Simple case insensitive dictionary implementation (that remembers insertion order).
+
+    This class works by overriding methods that deal with dictionary keys to
+    coerce string keys to :class:`CaseInsensitiveKey` objects before calling
+    down to the regular dictionary handling methods. While intended to be
+    complete this class has not been extensively tested yet.
+    """
+
+    def __init__(self, other=None, **kw):
+        """Initialize a :class:`CaseInsensitiveDict` object."""
+        # Initialize our superclass.
+        super(CaseInsensitiveDict, self).__init__()
+        # Handle the initializer arguments.
+        self.update(other, **kw)
+
+    def coerce_key(self, key):
+        """
+        Coerce string keys to :class:`CaseInsensitiveKey` objects.
+
+        :param key: The value to coerce (any type).
+        :returns: If `key` is a string then a :class:`CaseInsensitiveKey`
+                  object is returned, otherwise the value of `key` is
+                  returned unmodified.
+        """
+        if isinstance(key, basestring):
+            key = CaseInsensitiveKey(key)
+        return key
+
+    @classmethod
+    def fromkeys(cls, iterable, value=None):
+        """Create a case insensitive dictionary with keys from `iterable` and values set to `value`."""
+        return cls((k, value) for k in iterable)
+
+    def get(self, key, default=None):
+        """Get the value of an existing item."""
+        return super(CaseInsensitiveDict, self).get(self.coerce_key(key), default)
+
+    def pop(self, key, default=None):
+        """Remove an item from a case insensitive dictionary."""
+        return super(CaseInsensitiveDict, self).pop(self.coerce_key(key), default)
+
+    def setdefault(self, key, default=None):
+        """Get the value of an existing item or add a new item."""
+        return super(CaseInsensitiveDict, self).setdefault(self.coerce_key(key), default)
+
+    def update(self, other=None, **kw):
+        """Update a case insensitive dictionary with new items."""
+        if isinstance(other, Mapping):
+            # Copy the items from the given mapping.
+            for key, value in other.items():
+                self[key] = value
+        elif isinstance(other, Iterable):
+            # Copy the items from the given iterable.
+            for key, value in other:
+                self[key] = value
+        elif other is not None:
+            # Complain about unsupported values.
+            msg = "'%s' object is not iterable"
+            type_name = type(value).__name__
+            raise TypeError(msg % type_name)
+        # Copy the keyword arguments (if any).
+        for key, value in kw.items():
+            self[key] = value
+
+    def __contains__(self, key):
+        """Check if a case insensitive dictionary contains the given key."""
+        return super(CaseInsensitiveDict, self).__contains__(self.coerce_key(key))
+
+    def __delitem__(self, key):
+        """Delete an item in a case insensitive dictionary."""
+        return super(CaseInsensitiveDict, self).__delitem__(self.coerce_key(key))
+
+    def __getitem__(self, key):
+        """Get the value of an item in a case insensitive dictionary."""
+        return super(CaseInsensitiveDict, self).__getitem__(self.coerce_key(key))
+
+    def __setitem__(self, key, value):
+        """Set the value of an item in a case insensitive dictionary."""
+        return super(CaseInsensitiveDict, self).__setitem__(self.coerce_key(key), value)
+
+
+class CaseInsensitiveKey(unicode):
+
+    """
+    Simple case insensitive dictionary key implementation.
+
+    The :class:`CaseInsensitiveKey` class provides an intentionally simple
+    implementation of case insensitive strings to be used as dictionary keys.
+
+    If you need features like Unicode normalization or proper case folding
+    please consider using a more advanced implementation like the :pypi:`istr`
+    package instead.
+    """
+
+    def __new__(cls, value):
+        """Create a :class:`CaseInsensitiveKey` object."""
+        # Delegate string object creation to our superclass.
+        obj = unicode.__new__(cls, value)
+        # Store the lowercased string and its hash value.
+        normalized = obj.lower()
+        obj._normalized = normalized
+        obj._hash_value = hash(normalized)
+        return obj
+
+    def __hash__(self):
+        """Get the hash value of the lowercased string."""
+        return self._hash_value
+
+    def __eq__(self, other):
+        """Compare two strings as lowercase."""
+        if isinstance(other, CaseInsensitiveKey):
+            # Fast path (and the most common case): Comparison with same type.
+            return self._normalized == other._normalized
+        elif isinstance(other, unicode):
+            # Slow path: Comparison with strings that need lowercasing.
+            return self._normalized == other.lower()
+        else:
+            return NotImplemented
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/cli.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/cli.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb81db172bcdc45fb0d0cea32a63df07a3abde4a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/cli.py
@@ -0,0 +1,291 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 1, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Usage: humanfriendly [OPTIONS]
+
+Human friendly input/output (text formatting) on the command
+line based on the Python package with the same name.
+
+Supported options:
+
+  -c, --run-command
+
+    Execute an external command (given as the positional arguments) and render
+    a spinner and timer while the command is running. The exit status of the
+    command is propagated.
+
+  --format-table
+
+    Read tabular data from standard input (each line is a row and each
+    whitespace separated field is a column), format the data as a table and
+    print the resulting table to standard output. See also the --delimiter
+    option.
+
+  -d, --delimiter=VALUE
+
+    Change the delimiter used by --format-table to VALUE (a string). By default
+    all whitespace is treated as a delimiter.
+
+  -l, --format-length=LENGTH
+
+    Convert a length count (given as the integer or float LENGTH) into a human
+    readable string and print that string to standard output.
+
+  -n, --format-number=VALUE
+
+    Format a number (given as the integer or floating point number VALUE) with
+    thousands separators and two decimal places (if needed) and print the
+    formatted number to standard output.
+
+  -s, --format-size=BYTES
+
+    Convert a byte count (given as the integer BYTES) into a human readable
+    string and print that string to standard output.
+
+  -b, --binary
+
+    Change the output of -s, --format-size to use binary multiples of bytes
+    (base-2) instead of the default decimal multiples of bytes (base-10).
+
+  -t, --format-timespan=SECONDS
+
+    Convert a number of seconds (given as the floating point number SECONDS)
+    into a human readable timespan and print that string to standard output.
+
+  --parse-length=VALUE
+
+    Parse a human readable length (given as the string VALUE) and print the
+    number of metres to standard output.
+
+  --parse-size=VALUE
+
+    Parse a human readable data size (given as the string VALUE) and print the
+    number of bytes to standard output.
+
+  --demo
+
+    Demonstrate changing the style and color of the terminal font using ANSI
+    escape sequences.
+
+  -h, --help
+
+    Show this message and exit.
+"""
+
+# Standard library modules.
+import functools
+import getopt
+import pipes
+import subprocess
+import sys
+
+# Modules included in our package.
+from humanfriendly import (
+    Timer,
+    format_length,
+    format_number,
+    format_size,
+    format_timespan,
+    parse_length,
+    parse_size,
+)
+from humanfriendly.tables import format_pretty_table, format_smart_table
+from humanfriendly.terminal import (
+    ANSI_COLOR_CODES,
+    ANSI_TEXT_STYLES,
+    HIGHLIGHT_COLOR,
+    ansi_strip,
+    ansi_wrap,
+    enable_ansi_support,
+    find_terminal_size,
+    output,
+    usage,
+    warning,
+)
+from humanfriendly.terminal.spinners import Spinner
+
+# Public identifiers that require documentation.
+__all__ = (
+    'demonstrate_256_colors',
+    'demonstrate_ansi_formatting',
+    'main',
+    'print_formatted_length',
+    'print_formatted_number',
+    'print_formatted_size',
+    'print_formatted_table',
+    'print_formatted_timespan',
+    'print_parsed_length',
+    'print_parsed_size',
+    'run_command',
+)
+
+
+def main():
+    """Command line interface for the ``humanfriendly`` program."""
+    enable_ansi_support()
+    try:
+        options, arguments = getopt.getopt(sys.argv[1:], 'cd:l:n:s:bt:h', [
+            'run-command', 'format-table', 'delimiter=', 'format-length=',
+            'format-number=', 'format-size=', 'binary', 'format-timespan=',
+            'parse-length=', 'parse-size=', 'demo', 'help',
+        ])
+    except Exception as e:
+        warning("Error: %s", e)
+        sys.exit(1)
+    actions = []
+    delimiter = None
+    should_format_table = False
+    binary = any(o in ('-b', '--binary') for o, v in options)
+    for option, value in options:
+        if option in ('-d', '--delimiter'):
+            delimiter = value
+        elif option == '--parse-size':
+            actions.append(functools.partial(print_parsed_size, value))
+        elif option == '--parse-length':
+            actions.append(functools.partial(print_parsed_length, value))
+        elif option in ('-c', '--run-command'):
+            actions.append(functools.partial(run_command, arguments))
+        elif option in ('-l', '--format-length'):
+            actions.append(functools.partial(print_formatted_length, value))
+        elif option in ('-n', '--format-number'):
+            actions.append(functools.partial(print_formatted_number, value))
+        elif option in ('-s', '--format-size'):
+            actions.append(functools.partial(print_formatted_size, value, binary))
+        elif option == '--format-table':
+            should_format_table = True
+        elif option in ('-t', '--format-timespan'):
+            actions.append(functools.partial(print_formatted_timespan, value))
+        elif option == '--demo':
+            actions.append(demonstrate_ansi_formatting)
+        elif option in ('-h', '--help'):
+            usage(__doc__)
+            return
+    if should_format_table:
+        actions.append(functools.partial(print_formatted_table, delimiter))
+    if not actions:
+        usage(__doc__)
+        return
+    for partial in actions:
+        partial()
+
+
+def run_command(command_line):
+    """Run an external command and show a spinner while the command is running."""
+    timer = Timer()
+    spinner_label = "Waiting for command: %s" % " ".join(map(pipes.quote, command_line))
+    with Spinner(label=spinner_label, timer=timer) as spinner:
+        process = subprocess.Popen(command_line)
+        while True:
+            spinner.step()
+            spinner.sleep()
+            if process.poll() is not None:
+                break
+    sys.exit(process.returncode)
+
+
+def print_formatted_length(value):
+    """Print a human readable length."""
+    if '.' in value:
+        output(format_length(float(value)))
+    else:
+        output(format_length(int(value)))
+
+
+def print_formatted_number(value):
+    """Print large numbers in a human readable format."""
+    output(format_number(float(value)))
+
+
+def print_formatted_size(value, binary):
+    """Print a human readable size."""
+    output(format_size(int(value), binary=binary))
+
+
+def print_formatted_table(delimiter):
+    """Read tabular data from standard input and print a table."""
+    data = []
+    for line in sys.stdin:
+        line = line.rstrip()
+        data.append(line.split(delimiter))
+    output(format_pretty_table(data))
+
+
+def print_formatted_timespan(value):
+    """Print a human readable timespan."""
+    output(format_timespan(float(value)))
+
+
+def print_parsed_length(value):
+    """Parse a human readable length and print the number of metres."""
+    output(parse_length(value))
+
+
+def print_parsed_size(value):
+    """Parse a human readable data size and print the number of bytes."""
+    output(parse_size(value))
+
+
+def demonstrate_ansi_formatting():
+    """Demonstrate the use of ANSI escape sequences."""
+    # First we demonstrate the supported text styles.
+    output('%s', ansi_wrap('Text styles:', bold=True))
+    styles = ['normal', 'bright']
+    styles.extend(ANSI_TEXT_STYLES.keys())
+    for style_name in sorted(styles):
+        options = dict(color=HIGHLIGHT_COLOR)
+        if style_name != 'normal':
+            options[style_name] = True
+        style_label = style_name.replace('_', ' ').capitalize()
+        output(' - %s', ansi_wrap(style_label, **options))
+    # Now we demonstrate named foreground and background colors.
+    for color_type, color_label in (('color', 'Foreground colors'),
+                                    ('background', 'Background colors')):
+        intensities = [
+            ('normal', dict()),
+            ('bright', dict(bright=True)),
+        ]
+        if color_type != 'background':
+            intensities.insert(0, ('faint', dict(faint=True)))
+        output('\n%s' % ansi_wrap('%s:' % color_label, bold=True))
+        output(format_smart_table([
+            [color_name] + [
+                ansi_wrap(
+                    'XXXXXX' if color_type != 'background' else (' ' * 6),
+                    **dict(list(kw.items()) + [(color_type, color_name)])
+                ) for label, kw in intensities
+            ] for color_name in sorted(ANSI_COLOR_CODES.keys())
+        ], column_names=['Color'] + [
+            label.capitalize() for label, kw in intensities
+        ]))
+    # Demonstrate support for 256 colors as well.
+    demonstrate_256_colors(0, 7, 'standard colors')
+    demonstrate_256_colors(8, 15, 'high-intensity colors')
+    demonstrate_256_colors(16, 231, '216 colors')
+    demonstrate_256_colors(232, 255, 'gray scale colors')
+
+
+def demonstrate_256_colors(i, j, group=None):
+    """Demonstrate 256 color mode support."""
+    # Generate the label.
+    label = '256 color mode'
+    if group:
+        label += ' (%s)' % group
+    output('\n' + ansi_wrap('%s:' % label, bold=True))
+    # Generate a simple rendering of the colors in the requested range and
+    # check if it will fit on a single line (given the terminal's width).
+    single_line = ''.join(' ' + ansi_wrap(str(n), color=n) for n in range(i, j + 1))
+    lines, columns = find_terminal_size()
+    if columns >= len(ansi_strip(single_line)):
+        output(single_line)
+    else:
+        # Generate a more complex rendering of the colors that will nicely wrap
+        # over multiple lines without using too many lines.
+        width = len(str(j)) + 1
+        colors_per_line = int(columns / width)
+        colors = [ansi_wrap(str(n).rjust(width), color=n) for n in range(i, j + 1)]
+        blocks = [colors[n:n + colors_per_line] for n in range(0, len(colors), colors_per_line)]
+        output('\n'.join(''.join(b) for b in blocks))
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/compat.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..24c9d1833adbcc8a0f7ad736b63e37e8e88ec9d4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/compat.py
@@ -0,0 +1,146 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: September 17, 2021
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Compatibility with Python 2 and 3.
+
+This module exposes aliases and functions that make it easier to write Python
+code that is compatible with Python 2 and Python 3.
+
+.. data:: basestring
+
+   Alias for :func:`python2:basestring` (in Python 2) or :class:`python3:str`
+   (in Python 3). See also :func:`is_string()`.
+
+.. data:: HTMLParser
+
+   Alias for :class:`python2:HTMLParser.HTMLParser` (in Python 2) or
+   :class:`python3:html.parser.HTMLParser` (in Python 3).
+
+.. data:: interactive_prompt
+
+   Alias for :func:`python2:raw_input()` (in Python 2) or
+   :func:`python3:input()` (in Python 3).
+
+.. data:: StringIO
+
+   Alias for :class:`python2:StringIO.StringIO` (in Python 2) or
+   :class:`python3:io.StringIO` (in Python 3).
+
+.. data:: unicode
+
+   Alias for :func:`python2:unicode` (in Python 2) or :class:`python3:str` (in
+   Python 3). See also :func:`coerce_string()`.
+
+.. data:: monotonic
+
+   Alias for :func:`python3:time.monotonic()` (in Python 3.3 and higher) or
+   `monotonic.monotonic()` (a `conditional dependency
+   <https://pypi.org/project/monotonic/>`_ on older Python versions).
+"""
+
+__all__ = (
+    'HTMLParser',
+    'StringIO',
+    'basestring',
+    'coerce_string',
+    'interactive_prompt',
+    'is_string',
+    'is_unicode',
+    'monotonic',
+    'name2codepoint',
+    'on_macos',
+    'on_windows',
+    'unichr',
+    'unicode',
+    'which',
+)
+
+# Standard library modules.
+import sys
+
+# Differences between Python 2 and 3.
+try:
+    # Python 2.
+    unicode = unicode
+    unichr = unichr
+    basestring = basestring
+    interactive_prompt = raw_input
+    from distutils.spawn import find_executable as which
+    from HTMLParser import HTMLParser
+    from StringIO import StringIO
+    from htmlentitydefs import name2codepoint
+except (ImportError, NameError):
+    # Python 3.
+    unicode = str
+    unichr = chr
+    basestring = str
+    interactive_prompt = input
+    from shutil import which
+    from html.parser import HTMLParser
+    from io import StringIO
+    from html.entities import name2codepoint
+
+try:
+    # Python 3.3 and higher.
+    from time import monotonic
+except ImportError:
+    # A replacement for older Python versions:
+    # https://pypi.org/project/monotonic/
+    try:
+        from monotonic import monotonic
+    except (ImportError, RuntimeError):
+        # We fall back to the old behavior of using time.time() instead of
+        # failing when {time,monotonic}.monotonic() are both missing.
+        from time import time as monotonic
+
+
+def coerce_string(value):
+    """
+    Coerce any value to a Unicode string (:func:`python2:unicode` in Python 2 and :class:`python3:str` in Python 3).
+
+    :param value: The value to coerce.
+    :returns: The value coerced to a Unicode string.
+    """
+    return value if is_string(value) else unicode(value)
+
+
+def is_string(value):
+    """
+    Check if a value is a :func:`python2:basestring` (in Python 2) or :class:`python3:str` (in Python 3) object.
+
+    :param value: The value to check.
+    :returns: :data:`True` if the value is a string, :data:`False` otherwise.
+    """
+    return isinstance(value, basestring)
+
+
+def is_unicode(value):
+    """
+    Check if a value is a :func:`python2:unicode` (in Python 2) or :class:`python2:str` (in Python 3) object.
+
+    :param value: The value to check.
+    :returns: :data:`True` if the value is a Unicode string, :data:`False` otherwise.
+    """
+    return isinstance(value, unicode)
+
+
+def on_macos():
+    """
+    Check if we're running on Apple MacOS.
+
+    :returns: :data:`True` if running MacOS, :data:`False` otherwise.
+    """
+    return sys.platform.startswith('darwin')
+
+
+def on_windows():
+    """
+    Check if we're running on the Microsoft Windows OS.
+
+    :returns: :data:`True` if running Windows, :data:`False` otherwise.
+    """
+    return sys.platform.startswith('win')
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/decorators.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/decorators.py
new file mode 100644
index 0000000000000000000000000000000000000000..c90a59ea2868daa3cf754400d8b348cc80c965da
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/decorators.py
@@ -0,0 +1,43 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 2, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""Simple function decorators to make Python programming easier."""
+
+# Standard library modules.
+import functools
+
+# Public identifiers that require documentation.
+__all__ = ('RESULTS_ATTRIBUTE', 'cached')
+
+RESULTS_ATTRIBUTE = 'cached_results'
+"""The name of the property used to cache the return values of functions (a string)."""
+
+
+def cached(function):
+    """
+    Rudimentary caching decorator for functions.
+
+    :param function: The function whose return value should be cached.
+    :returns: The decorated function.
+
+    The given function will only be called once, the first time the wrapper
+    function is called. The return value is cached by the wrapper function as
+    an attribute of the given function and returned on each subsequent call.
+
+    .. note:: Currently no function arguments are supported because only a
+              single return value can be cached. Accepting any function
+              arguments at all would imply that the cache is parametrized on
+              function arguments, which is not currently the case.
+    """
+    @functools.wraps(function)
+    def wrapper():
+        try:
+            return getattr(wrapper, RESULTS_ATTRIBUTE)
+        except AttributeError:
+            result = function()
+            setattr(wrapper, RESULTS_ATTRIBUTE, result)
+            return result
+    return wrapper
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/deprecation.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/deprecation.py
new file mode 100644
index 0000000000000000000000000000000000000000..f2012bbd6f3ddd9b955f7a25010cd78ece431c6a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/deprecation.py
@@ -0,0 +1,251 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 2, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Support for deprecation warnings when importing names from old locations.
+
+When software evolves, things tend to move around. This is usually detrimental
+to backwards compatibility (in Python this primarily manifests itself as
+:exc:`~exceptions.ImportError` exceptions).
+
+While backwards compatibility is very important, it should not get in the way
+of progress. It would be great to have the agility to move things around
+without breaking backwards compatibility.
+
+This is where the :mod:`humanfriendly.deprecation` module comes in: It enables
+the definition of backwards compatible aliases that emit a deprecation warning
+when they are accessed.
+
+The way it works is that it wraps the original module in an :class:`DeprecationProxy`
+object that defines a :func:`~DeprecationProxy.__getattr__()` special method to
+override attribute access of the module.
+"""
+
+# Standard library modules.
+import collections
+import functools
+import importlib
+import inspect
+import sys
+import types
+import warnings
+
+# Modules included in our package.
+from humanfriendly.text import format
+
+# Registry of known aliases (used by humanfriendly.sphinx).
+REGISTRY = collections.defaultdict(dict)
+
+# Public identifiers that require documentation.
+__all__ = ("DeprecationProxy", "define_aliases", "deprecated_args", "get_aliases", "is_method")
+
+
+def define_aliases(module_name, **aliases):
+    """
+    Update a module with backwards compatible aliases.
+
+    :param module_name: The ``__name__`` of the module (a string).
+    :param aliases: Each keyword argument defines an alias. The values
+                    are expected to be "dotted paths" (strings).
+
+    The behavior of this function depends on whether the Sphinx documentation
+    generator is active, because the use of :class:`DeprecationProxy` to shadow the
+    real module in :data:`sys.modules` has the unintended side effect of
+    breaking autodoc support for ``:data:`` members (module variables).
+
+    To avoid breaking Sphinx the proxy object is omitted and instead the
+    aliased names are injected into the original module namespace, to make sure
+    that imports can be satisfied when the documentation is being rendered.
+
+    If you run into cyclic dependencies caused by :func:`define_aliases()` when
+    running Sphinx, you can try moving the call to :func:`define_aliases()` to
+    the bottom of the Python module you're working on.
+    """
+    module = sys.modules[module_name]
+    proxy = DeprecationProxy(module, aliases)
+    # Populate the registry of aliases.
+    for name, target in aliases.items():
+        REGISTRY[module.__name__][name] = target
+    # Avoid confusing Sphinx.
+    if "sphinx" in sys.modules:
+        for name, target in aliases.items():
+            setattr(module, name, proxy.resolve(target))
+    else:
+        # Install a proxy object to raise DeprecationWarning.
+        sys.modules[module_name] = proxy
+
+
+def get_aliases(module_name):
+    """
+    Get the aliases defined by a module.
+
+    :param module_name: The ``__name__`` of the module (a string).
+    :returns: A dictionary with string keys and values:
+
+              1. Each key gives the name of an alias
+                 created for backwards compatibility.
+
+              2. Each value gives the dotted path of
+                 the proper location of the identifier.
+
+              An empty dictionary is returned for modules that
+              don't define any backwards compatible aliases.
+    """
+    return REGISTRY.get(module_name, {})
+
+
+def deprecated_args(*names):
+    """
+    Deprecate positional arguments without dropping backwards compatibility.
+
+    :param names:
+
+      The positional arguments to :func:`deprecated_args()` give the names of
+      the positional arguments that the to-be-decorated function should warn
+      about being deprecated and translate to keyword arguments.
+
+    :returns: A decorator function specialized to `names`.
+
+    The :func:`deprecated_args()` decorator function was created to make it
+    easy to switch from positional arguments to keyword arguments [#]_ while
+    preserving backwards compatibility [#]_ and informing call sites
+    about the change.
+
+    .. [#] Increased flexibility is the main reason why I find myself switching
+           from positional arguments to (optional) keyword arguments as my code
+           evolves to support more use cases.
+
+    .. [#] In my experience positional argument order implicitly becomes part
+           of API compatibility whether intended or not. While this makes sense
+           for functions that over time adopt more and more optional arguments,
+           at a certain point it becomes an inconvenience to code maintenance.
+
+    Here's an example of how to use the decorator::
+
+      @deprecated_args('text')
+      def report_choice(**options):
+          print(options['text'])
+
+    When the decorated function is called with positional arguments
+    a deprecation warning is given::
+
+      >>> report_choice('this will give a deprecation warning')
+      DeprecationWarning: report_choice has deprecated positional arguments, please switch to keyword arguments
+      this will give a deprecation warning
+
+    But when the function is called with keyword arguments no deprecation
+    warning is emitted::
+
+      >>> report_choice(text='this will not give a deprecation warning')
+      this will not give a deprecation warning
+    """
+    def decorator(function):
+        def translate(args, kw):
+            # Raise TypeError when too many positional arguments are passed to the decorated function.
+            if len(args) > len(names):
+                raise TypeError(
+                    format(
+                        "{name} expected at most {limit} arguments, got {count}",
+                        name=function.__name__,
+                        limit=len(names),
+                        count=len(args),
+                    )
+                )
+            # Emit a deprecation warning when positional arguments are used.
+            if args:
+                warnings.warn(
+                    format(
+                        "{name} has deprecated positional arguments, please switch to keyword arguments",
+                        name=function.__name__,
+                    ),
+                    category=DeprecationWarning,
+                    stacklevel=3,
+                )
+            # Translate positional arguments to keyword arguments.
+            for name, value in zip(names, args):
+                kw[name] = value
+        if is_method(function):
+            @functools.wraps(function)
+            def wrapper(*args, **kw):
+                """Wrapper for instance methods."""
+                args = list(args)
+                self = args.pop(0)
+                translate(args, kw)
+                return function(self, **kw)
+        else:
+            @functools.wraps(function)
+            def wrapper(*args, **kw):
+                """Wrapper for module level functions."""
+                translate(args, kw)
+                return function(**kw)
+        return wrapper
+    return decorator
+
+
+def is_method(function):
+    """Check if the expected usage of the given function is as an instance method."""
+    try:
+        # Python 3.3 and newer.
+        signature = inspect.signature(function)
+        return "self" in signature.parameters
+    except AttributeError:
+        # Python 3.2 and older.
+        metadata = inspect.getargspec(function)
+        return "self" in metadata.args
+
+
+class DeprecationProxy(types.ModuleType):
+
+    """Emit deprecation warnings for imports that should be updated."""
+
+    def __init__(self, module, aliases):
+        """
+        Initialize an :class:`DeprecationProxy` object.
+
+        :param module: The original module object.
+        :param aliases: A dictionary of aliases.
+        """
+        # Initialize our superclass.
+        super(DeprecationProxy, self).__init__(name=module.__name__)
+        # Store initializer arguments.
+        self.module = module
+        self.aliases = aliases
+
+    def __getattr__(self, name):
+        """
+        Override module attribute lookup.
+
+        :param name: The name to look up (a string).
+        :returns: The attribute value.
+        """
+        # Check if the given name is an alias.
+        target = self.aliases.get(name)
+        if target is not None:
+            # Emit the deprecation warning.
+            warnings.warn(
+                format("%s.%s was moved to %s, please update your imports", self.module.__name__, name, target),
+                category=DeprecationWarning,
+                stacklevel=2,
+            )
+            # Resolve the dotted path.
+            return self.resolve(target)
+        # Look up the name in the original module namespace.
+        value = getattr(self.module, name, None)
+        if value is not None:
+            return value
+        # Fall back to the default behavior.
+        raise AttributeError(format("module '%s' has no attribute '%s'", self.module.__name__, name))
+
+    def resolve(self, target):
+        """
+        Look up the target of an alias.
+
+        :param target: The fully qualified dotted path (a string).
+        :returns: The value of the given target.
+        """
+        module_name, _, member = target.rpartition(".")
+        module = importlib.import_module(module_name)
+        return getattr(module, member)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/prompts.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/prompts.py
new file mode 100644
index 0000000000000000000000000000000000000000..07166b67091c38f9954bc8e69816364747832ef2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/prompts.py
@@ -0,0 +1,376 @@
+# vim: fileencoding=utf-8
+
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: February 9, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Interactive terminal prompts.
+
+The :mod:`~humanfriendly.prompts` module enables interaction with the user
+(operator) by asking for confirmation (:func:`prompt_for_confirmation()`) and
+asking to choose from a list of options (:func:`prompt_for_choice()`). It works
+by rendering interactive prompts on the terminal.
+"""
+
+# Standard library modules.
+import logging
+import sys
+
+# Modules included in our package.
+from humanfriendly.compat import interactive_prompt
+from humanfriendly.terminal import (
+    HIGHLIGHT_COLOR,
+    ansi_strip,
+    ansi_wrap,
+    connected_to_terminal,
+    terminal_supports_colors,
+    warning,
+)
+from humanfriendly.text import format, concatenate
+
+# Public identifiers that require documentation.
+__all__ = (
+    'MAX_ATTEMPTS',
+    'TooManyInvalidReplies',
+    'logger',
+    'prepare_friendly_prompts',
+    'prepare_prompt_text',
+    'prompt_for_choice',
+    'prompt_for_confirmation',
+    'prompt_for_input',
+    'retry_limit',
+)
+
+MAX_ATTEMPTS = 10
+"""The number of times an interactive prompt is shown on invalid input (an integer)."""
+
+# Initialize a logger for this module.
+logger = logging.getLogger(__name__)
+
+
+def prompt_for_confirmation(question, default=None, padding=True):
+    """
+    Prompt the user for confirmation.
+
+    :param question: The text that explains what the user is confirming (a string).
+    :param default: The default value (a boolean) or :data:`None`.
+    :param padding: Refer to the documentation of :func:`prompt_for_input()`.
+    :returns: - If the user enters 'yes' or 'y' then :data:`True` is returned.
+              - If the user enters 'no' or 'n' then :data:`False`  is returned.
+              - If the user doesn't enter any text or standard input is not
+                connected to a terminal (which makes it impossible to prompt
+                the user) the value of the keyword argument ``default`` is
+                returned (if that value is not :data:`None`).
+    :raises: - Any exceptions raised by :func:`retry_limit()`.
+             - Any exceptions raised by :func:`prompt_for_input()`.
+
+    When `default` is :data:`False` and the user doesn't enter any text an
+    error message is printed and the prompt is repeated:
+
+    >>> prompt_for_confirmation("Are you sure?")
+     <BLANKLINE>
+     Are you sure? [y/n]
+     <BLANKLINE>
+     Error: Please enter 'yes' or 'no' (there's no default choice).
+     <BLANKLINE>
+     Are you sure? [y/n]
+
+    The same thing happens when the user enters text that isn't recognized:
+
+    >>> prompt_for_confirmation("Are you sure?")
+     <BLANKLINE>
+     Are you sure? [y/n] about what?
+     <BLANKLINE>
+     Error: Please enter 'yes' or 'no' (the text 'about what?' is not recognized).
+     <BLANKLINE>
+     Are you sure? [y/n]
+    """
+    # Generate the text for the prompt.
+    prompt_text = prepare_prompt_text(question, bold=True)
+    # Append the valid replies (and default reply) to the prompt text.
+    hint = "[Y/n]" if default else "[y/N]" if default is not None else "[y/n]"
+    prompt_text += " %s " % prepare_prompt_text(hint, color=HIGHLIGHT_COLOR)
+    # Loop until a valid response is given.
+    logger.debug("Requesting interactive confirmation from terminal: %r", ansi_strip(prompt_text).rstrip())
+    for attempt in retry_limit():
+        reply = prompt_for_input(prompt_text, '', padding=padding, strip=True)
+        if reply.lower() in ('y', 'yes'):
+            logger.debug("Confirmation granted by reply (%r).", reply)
+            return True
+        elif reply.lower() in ('n', 'no'):
+            logger.debug("Confirmation denied by reply (%r).", reply)
+            return False
+        elif (not reply) and default is not None:
+            logger.debug("Default choice selected by empty reply (%r).",
+                         "granted" if default else "denied")
+            return default
+        else:
+            details = ("the text '%s' is not recognized" % reply
+                       if reply else "there's no default choice")
+            logger.debug("Got %s reply (%s), retrying (%i/%i) ..",
+                         "invalid" if reply else "empty", details,
+                         attempt, MAX_ATTEMPTS)
+            warning("{indent}Error: Please enter 'yes' or 'no' ({details}).",
+                    indent=' ' if padding else '', details=details)
+
+
+def prompt_for_choice(choices, default=None, padding=True):
+    """
+    Prompt the user to select a choice from a group of options.
+
+    :param choices: A sequence of strings with available options.
+    :param default: The default choice if the user simply presses Enter
+                    (expected to be a string, defaults to :data:`None`).
+    :param padding: Refer to the documentation of
+                    :func:`~humanfriendly.prompts.prompt_for_input()`.
+    :returns: The string corresponding to the user's choice.
+    :raises: - :exc:`~exceptions.ValueError` if `choices` is an empty sequence.
+             - Any exceptions raised by
+               :func:`~humanfriendly.prompts.retry_limit()`.
+             - Any exceptions raised by
+               :func:`~humanfriendly.prompts.prompt_for_input()`.
+
+    When no options are given an exception is raised:
+
+    >>> prompt_for_choice([])
+    Traceback (most recent call last):
+      File "humanfriendly/prompts.py", line 148, in prompt_for_choice
+        raise ValueError("Can't prompt for choice without any options!")
+    ValueError: Can't prompt for choice without any options!
+
+    If a single option is given the user isn't prompted:
+
+    >>> prompt_for_choice(['only one choice'])
+    'only one choice'
+
+    Here's what the actual prompt looks like by default:
+
+    >>> prompt_for_choice(['first option', 'second option'])
+    <BLANKLINE>
+      1. first option
+      2. second option
+    <BLANKLINE>
+     Enter your choice as a number or unique substring (Control-C aborts): second
+    <BLANKLINE>
+    'second option'
+
+    If you don't like the whitespace (empty lines and indentation):
+
+    >>> prompt_for_choice(['first option', 'second option'], padding=False)
+     1. first option
+     2. second option
+    Enter your choice as a number or unique substring (Control-C aborts): first
+    'first option'
+    """
+    indent = ' ' if padding else ''
+    # Make sure we can use 'choices' more than once (i.e. not a generator).
+    choices = list(choices)
+    if len(choices) == 1:
+        # If there's only one option there's no point in prompting the user.
+        logger.debug("Skipping interactive prompt because there's only option (%r).", choices[0])
+        return choices[0]
+    elif not choices:
+        # We can't render a choice prompt without any options.
+        raise ValueError("Can't prompt for choice without any options!")
+    # Generate the prompt text.
+    prompt_text = ('\n\n' if padding else '\n').join([
+        # Present the available choices in a user friendly way.
+        "\n".join([
+            (u" %i. %s" % (i, choice)) + (" (default choice)" if choice == default else "")
+            for i, choice in enumerate(choices, start=1)
+        ]),
+        # Instructions for the user.
+        "Enter your choice as a number or unique substring (Control-C aborts): ",
+    ])
+    prompt_text = prepare_prompt_text(prompt_text, bold=True)
+    # Loop until a valid choice is made.
+    logger.debug("Requesting interactive choice on terminal (options are %s) ..",
+                 concatenate(map(repr, choices)))
+    for attempt in retry_limit():
+        reply = prompt_for_input(prompt_text, '', padding=padding, strip=True)
+        if not reply and default is not None:
+            logger.debug("Default choice selected by empty reply (%r).", default)
+            return default
+        elif reply.isdigit():
+            index = int(reply) - 1
+            if 0 <= index < len(choices):
+                logger.debug("Option (%r) selected by numeric reply (%s).", choices[index], reply)
+                return choices[index]
+        # Check for substring matches.
+        matches = []
+        for choice in choices:
+            lower_reply = reply.lower()
+            lower_choice = choice.lower()
+            if lower_reply == lower_choice:
+                # If we have an 'exact' match we return it immediately.
+                logger.debug("Option (%r) selected by reply (exact match).", choice)
+                return choice
+            elif lower_reply in lower_choice and len(lower_reply) > 0:
+                # Otherwise we gather substring matches.
+                matches.append(choice)
+        if len(matches) == 1:
+            # If a single choice was matched we return it.
+            logger.debug("Option (%r) selected by reply (substring match on %r).", matches[0], reply)
+            return matches[0]
+        else:
+            # Give the user a hint about what went wrong.
+            if matches:
+                details = format("text '%s' matches more than one choice: %s", reply, concatenate(matches))
+            elif reply.isdigit():
+                details = format("number %i is not a valid choice", int(reply))
+            elif reply and not reply.isspace():
+                details = format("text '%s' doesn't match any choices", reply)
+            else:
+                details = "there's no default choice"
+            logger.debug("Got %s reply (%s), retrying (%i/%i) ..",
+                         "invalid" if reply else "empty", details,
+                         attempt, MAX_ATTEMPTS)
+            warning("%sError: Invalid input (%s).", indent, details)
+
+
+def prompt_for_input(question, default=None, padding=True, strip=True):
+    """
+    Prompt the user for input (free form text).
+
+    :param question: An explanation of what is expected from the user (a string).
+    :param default: The return value if the user doesn't enter any text or
+                    standard input is not connected to a terminal (which
+                    makes it impossible to prompt the user).
+    :param padding: Render empty lines before and after the prompt to make it
+                    stand out from the surrounding text? (a boolean, defaults
+                    to :data:`True`)
+    :param strip: Strip leading/trailing whitespace from the user's reply?
+    :returns: The text entered by the user (a string) or the value of the
+              `default` argument.
+    :raises: - :exc:`~exceptions.KeyboardInterrupt` when the program is
+               interrupted_ while the prompt is active, for example
+               because the user presses Control-C_.
+             - :exc:`~exceptions.EOFError` when reading from `standard input`_
+               fails, for example because the user presses Control-D_ or
+               because the standard input stream is redirected (only if
+               `default` is :data:`None`).
+
+    .. _Control-C: https://en.wikipedia.org/wiki/Control-C#In_command-line_environments
+    .. _Control-D: https://en.wikipedia.org/wiki/End-of-transmission_character#Meaning_in_Unix
+    .. _interrupted: https://en.wikipedia.org/wiki/Unix_signal#SIGINT
+    .. _standard input: https://en.wikipedia.org/wiki/Standard_streams#Standard_input_.28stdin.29
+    """
+    prepare_friendly_prompts()
+    reply = None
+    try:
+        # Prefix an empty line to the text and indent by one space?
+        if padding:
+            question = '\n' + question
+            question = question.replace('\n', '\n ')
+        # Render the prompt and wait for the user's reply.
+        try:
+            reply = interactive_prompt(question)
+        finally:
+            if reply is None:
+                # If the user terminated the prompt using Control-C or
+                # Control-D instead of pressing Enter no newline will be
+                # rendered after the prompt's text. The result looks kind of
+                # weird:
+                #
+                #   $ python -c 'print(raw_input("Are you sure? "))'
+                #   Are you sure? ^CTraceback (most recent call last):
+                #     File "<string>", line 1, in <module>
+                #   KeyboardInterrupt
+                #
+                # We can avoid this by emitting a newline ourselves if an
+                # exception was raised (signaled by `reply' being None).
+                sys.stderr.write('\n')
+            if padding:
+                # If the caller requested (didn't opt out of) `padding' then we'll
+                # emit a newline regardless of whether an exception is being
+                # handled. This helps to make interactive prompts `stand out' from
+                # a surrounding `wall of text' on the terminal.
+                sys.stderr.write('\n')
+    except BaseException as e:
+        if isinstance(e, EOFError) and default is not None:
+            # If standard input isn't connected to an interactive terminal
+            # but the caller provided a default we'll return that.
+            logger.debug("Got EOF from terminal, returning default value (%r) ..", default)
+            return default
+        else:
+            # Otherwise we log that the prompt was interrupted but propagate
+            # the exception to the caller.
+            logger.warning("Interactive prompt was interrupted by exception!", exc_info=True)
+            raise
+    if default is not None and not reply:
+        # If the reply is empty and `default' is None we don't want to return
+        # None because it's nicer for callers to be able to assume that the
+        # return value is always a string.
+        return default
+    else:
+        return reply.strip()
+
+
+def prepare_prompt_text(prompt_text, **options):
+    """
+    Wrap a text to be rendered as an interactive prompt in ANSI escape sequences.
+
+    :param prompt_text: The text to render on the prompt (a string).
+    :param options: Any keyword arguments are passed on to :func:`.ansi_wrap()`.
+    :returns: The resulting prompt text (a string).
+
+    ANSI escape sequences are only used when the standard output stream is
+    connected to a terminal. When the standard input stream is connected to a
+    terminal any escape sequences are wrapped in "readline hints".
+    """
+    return (ansi_wrap(prompt_text, readline_hints=connected_to_terminal(sys.stdin), **options)
+            if terminal_supports_colors(sys.stdout)
+            else prompt_text)
+
+
+def prepare_friendly_prompts():
+    u"""
+    Make interactive prompts more user friendly.
+
+    The prompts presented by :func:`python2:raw_input()` (in Python 2) and
+    :func:`python3:input()` (in Python 3) are not very user friendly by
+    default, for example the cursor keys (:kbd:`←`, :kbd:`↑`, :kbd:`→` and
+    :kbd:`↓`) and the :kbd:`Home` and :kbd:`End` keys enter characters instead
+    of performing the action you would expect them to. By simply importing the
+    :mod:`readline` module these prompts become much friendlier (as mentioned
+    in the Python standard library documentation).
+
+    This function is called by the other functions in this module to enable
+    user friendly prompts.
+    """
+    try:
+        import readline  # NOQA
+    except ImportError:
+        # might not be available on Windows if pyreadline isn't installed
+        pass
+
+
+def retry_limit(limit=MAX_ATTEMPTS):
+    """
+    Allow the user to provide valid input up to `limit` times.
+
+    :param limit: The maximum number of attempts (a number,
+                  defaults to :data:`MAX_ATTEMPTS`).
+    :returns: A generator of numbers starting from one.
+    :raises: :exc:`TooManyInvalidReplies` when an interactive prompt
+             receives repeated invalid input (:data:`MAX_ATTEMPTS`).
+
+    This function returns a generator for interactive prompts that want to
+    repeat on invalid input without getting stuck in infinite loops.
+    """
+    for i in range(limit):
+        yield i + 1
+    msg = "Received too many invalid replies on interactive prompt, giving up! (tried %i times)"
+    formatted_msg = msg % limit
+    # Make sure the event is logged.
+    logger.warning(formatted_msg)
+    # Force the caller to decide what to do now.
+    raise TooManyInvalidReplies(formatted_msg)
+
+
+class TooManyInvalidReplies(Exception):
+
+    """Raised by interactive prompts when they've received too many invalid inputs."""
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/sphinx.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/sphinx.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf5d1b393567ed58457c490186d908c529449df3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/sphinx.py
@@ -0,0 +1,315 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: June 11, 2021
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Customizations for and integration with the Sphinx_ documentation generator.
+
+The :mod:`humanfriendly.sphinx` module uses the `Sphinx extension API`_ to
+customize the process of generating Sphinx based Python documentation. To
+explore the functionality this module offers its best to start reading
+from the :func:`setup()` function.
+
+.. _Sphinx: http://www.sphinx-doc.org/
+.. _Sphinx extension API: http://sphinx-doc.org/extdev/appapi.html
+"""
+
+# Standard library modules.
+import logging
+import types
+
+# External dependencies (if Sphinx is installed docutils will be installed).
+import docutils.nodes
+import docutils.utils
+
+# Modules included in our package.
+from humanfriendly.deprecation import get_aliases
+from humanfriendly.text import compact, dedent, format
+from humanfriendly.usage import USAGE_MARKER, render_usage
+
+# Public identifiers that require documentation.
+__all__ = (
+    "deprecation_note_callback",
+    "enable_deprecation_notes",
+    "enable_man_role",
+    "enable_pypi_role",
+    "enable_special_methods",
+    "enable_usage_formatting",
+    "logger",
+    "man_role",
+    "pypi_role",
+    "setup",
+    "special_methods_callback",
+    "usage_message_callback",
+)
+
+# Initialize a logger for this module.
+logger = logging.getLogger(__name__)
+
+
+def deprecation_note_callback(app, what, name, obj, options, lines):
+    """
+    Automatically document aliases defined using :func:`~humanfriendly.deprecation.define_aliases()`.
+
+    Refer to :func:`enable_deprecation_notes()` to enable the use of this
+    function (you probably don't want to call :func:`deprecation_note_callback()`
+    directly).
+
+    This function implements a callback for ``autodoc-process-docstring`` that
+    reformats module docstrings to append an overview of aliases defined by the
+    module.
+
+    The parameters expected by this function are those defined for Sphinx event
+    callback functions (i.e. I'm not going to document them here :-).
+    """
+    if isinstance(obj, types.ModuleType) and lines:
+        aliases = get_aliases(obj.__name__)
+        if aliases:
+            # Convert the existing docstring to a string and remove leading
+            # indentation from that string, otherwise our generated content
+            # would have to match the existing indentation in order not to
+            # break docstring parsing (because indentation is significant
+            # in the reStructuredText format).
+            blocks = [dedent("\n".join(lines))]
+            # Use an admonition to group the deprecated aliases together and
+            # to distinguish them from the autodoc entries that follow.
+            blocks.append(".. note:: Deprecated names")
+            indent = " " * 3
+            if len(aliases) == 1:
+                explanation = """
+                    The following alias exists to preserve backwards compatibility,
+                    however a :exc:`~exceptions.DeprecationWarning` is triggered
+                    when it is accessed, because this alias will be removed
+                    in a future release.
+                """
+            else:
+                explanation = """
+                    The following aliases exist to preserve backwards compatibility,
+                    however a :exc:`~exceptions.DeprecationWarning` is triggered
+                    when they are accessed, because these aliases will be
+                    removed in a future release.
+                """
+            blocks.append(indent + compact(explanation))
+            for name, target in aliases.items():
+                blocks.append(format("%s.. data:: %s", indent, name))
+                blocks.append(format("%sAlias for :obj:`%s`.", indent * 2, target))
+            update_lines(lines, "\n\n".join(blocks))
+
+
+def enable_deprecation_notes(app):
+    """
+    Enable documenting backwards compatibility aliases using the autodoc_ extension.
+
+    :param app: The Sphinx application object.
+
+    This function connects the :func:`deprecation_note_callback()` function to
+    ``autodoc-process-docstring`` events.
+
+    .. _autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
+    """
+    app.connect("autodoc-process-docstring", deprecation_note_callback)
+
+
+def enable_man_role(app):
+    """
+    Enable the ``:man:`` role for linking to Debian Linux manual pages.
+
+    :param app: The Sphinx application object.
+
+    This function registers the :func:`man_role()` function to handle the
+    ``:man:`` role.
+    """
+    app.add_role("man", man_role)
+
+
+def enable_pypi_role(app):
+    """
+    Enable the ``:pypi:`` role for linking to the Python Package Index.
+
+    :param app: The Sphinx application object.
+
+    This function registers the :func:`pypi_role()` function to handle the
+    ``:pypi:`` role.
+    """
+    app.add_role("pypi", pypi_role)
+
+
+def enable_special_methods(app):
+    """
+    Enable documenting "special methods" using the autodoc_ extension.
+
+    :param app: The Sphinx application object.
+
+    This function connects the :func:`special_methods_callback()` function to
+    ``autodoc-skip-member`` events.
+
+    .. _autodoc: http://www.sphinx-doc.org/en/stable/ext/autodoc.html
+    """
+    app.connect("autodoc-skip-member", special_methods_callback)
+
+
+def enable_usage_formatting(app):
+    """
+    Reformat human friendly usage messages to reStructuredText_.
+
+    :param app: The Sphinx application object (as given to ``setup()``).
+
+    This function connects the :func:`usage_message_callback()` function to
+    ``autodoc-process-docstring`` events.
+
+    .. _reStructuredText: https://en.wikipedia.org/wiki/ReStructuredText
+    """
+    app.connect("autodoc-process-docstring", usage_message_callback)
+
+
+def man_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
+    """
+    Convert a Linux manual topic to a hyperlink.
+
+    Using the ``:man:`` role is very simple, here's an example:
+
+    .. code-block:: rst
+
+        See the :man:`python` documentation.
+
+    This results in the following:
+
+      See the :man:`python` documentation.
+
+    As the example shows you can use the role inline, embedded in sentences of
+    text. In the generated documentation the ``:man:`` text is omitted and a
+    hyperlink pointing to the Debian Linux manual pages is emitted.
+    """
+    man_url = "https://manpages.debian.org/%s" % text
+    reference = docutils.nodes.reference(rawtext, docutils.utils.unescape(text), refuri=man_url, **options)
+    return [reference], []
+
+
+def pypi_role(role, rawtext, text, lineno, inliner, options={}, content=[]):
+    """
+    Generate hyperlinks to the Python Package Index.
+
+    Using the ``:pypi:`` role is very simple, here's an example:
+
+    .. code-block:: rst
+
+        See the :pypi:`humanfriendly` package.
+
+    This results in the following:
+
+      See the :pypi:`humanfriendly` package.
+
+    As the example shows you can use the role inline, embedded in sentences of
+    text. In the generated documentation the ``:pypi:`` text is omitted and a
+    hyperlink pointing to the Python Package Index is emitted.
+    """
+    pypi_url = "https://pypi.org/project/%s/" % text
+    reference = docutils.nodes.reference(rawtext, docutils.utils.unescape(text), refuri=pypi_url, **options)
+    return [reference], []
+
+
+def setup(app):
+    """
+    Enable all of the provided Sphinx_ customizations.
+
+    :param app: The Sphinx application object.
+
+    The :func:`setup()` function makes it easy to enable all of the Sphinx
+    customizations provided by the :mod:`humanfriendly.sphinx` module with the
+    least amount of code. All you need to do is to add the module name to the
+    ``extensions`` variable in your ``conf.py`` file:
+
+    .. code-block:: python
+
+       # Sphinx extension module names.
+       extensions = [
+           'sphinx.ext.autodoc',
+           'sphinx.ext.doctest',
+           'sphinx.ext.intersphinx',
+           'humanfriendly.sphinx',
+       ]
+
+    When Sphinx sees the :mod:`humanfriendly.sphinx` name it will import the
+    module and call its :func:`setup()` function. This function will then call
+    the following:
+
+    - :func:`enable_deprecation_notes()`
+    - :func:`enable_man_role()`
+    - :func:`enable_pypi_role()`
+    - :func:`enable_special_methods()`
+    - :func:`enable_usage_formatting()`
+
+    Of course more functionality may be added at a later stage. If you don't
+    like that idea you may be better of calling the individual functions from
+    your own ``setup()`` function.
+    """
+    from humanfriendly import __version__
+
+    enable_deprecation_notes(app)
+    enable_man_role(app)
+    enable_pypi_role(app)
+    enable_special_methods(app)
+    enable_usage_formatting(app)
+
+    return dict(parallel_read_safe=True, parallel_write_safe=True, version=__version__)
+
+
+def special_methods_callback(app, what, name, obj, skip, options):
+    """
+    Enable documenting "special methods" using the autodoc_ extension.
+
+    Refer to :func:`enable_special_methods()` to enable the use of this
+    function (you probably don't want to call
+    :func:`special_methods_callback()` directly).
+
+    This function implements a callback for ``autodoc-skip-member`` events to
+    include documented "special methods" (method names with two leading and two
+    trailing underscores) in your documentation. The result is similar to the
+    use of the ``special-members`` flag with one big difference: Special
+    methods are included but other types of members are ignored. This means
+    that attributes like ``__weakref__`` will always be ignored (this was my
+    main annoyance with the ``special-members`` flag).
+
+    The parameters expected by this function are those defined for Sphinx event
+    callback functions (i.e. I'm not going to document them here :-).
+    """
+    if getattr(obj, "__doc__", None) and isinstance(obj, (types.FunctionType, types.MethodType)):
+        return False
+    else:
+        return skip
+
+
+def update_lines(lines, text):
+    """Private helper for ``autodoc-process-docstring`` callbacks."""
+    while lines:
+        lines.pop()
+    lines.extend(text.splitlines())
+
+
+def usage_message_callback(app, what, name, obj, options, lines):
+    """
+    Reformat human friendly usage messages to reStructuredText_.
+
+    Refer to :func:`enable_usage_formatting()` to enable the use of this
+    function (you probably don't want to call :func:`usage_message_callback()`
+    directly).
+
+    This function implements a callback for ``autodoc-process-docstring`` that
+    reformats module docstrings using :func:`.render_usage()` so that Sphinx
+    doesn't mangle usage messages that were written to be human readable
+    instead of machine readable. Only module docstrings whose first line starts
+    with :data:`.USAGE_MARKER` are reformatted.
+
+    The parameters expected by this function are those defined for Sphinx event
+    callback functions (i.e. I'm not going to document them here :-).
+    """
+    # Make sure we only modify the docstrings of modules.
+    if isinstance(obj, types.ModuleType) and lines:
+        # Make sure we only modify docstrings containing a usage message.
+        if lines[0].startswith(USAGE_MARKER):
+            # Convert the usage message to reStructuredText.
+            text = render_usage("\n".join(lines))
+            # Fill up the buffer with our modified docstring.
+            update_lines(lines, text)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tables.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tables.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a32ba3b3f6dc9866e74b1f0ea7ea21a01bc81e0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tables.py
@@ -0,0 +1,341 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: February 16, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Functions that render ASCII tables.
+
+Some generic notes about the table formatting functions in this module:
+
+- These functions were not written with performance in mind (*at all*) because
+  they're intended to format tabular data to be presented on a terminal. If
+  someone were to run into a performance problem using these functions, they'd
+  be printing so much tabular data to the terminal that a human wouldn't be
+  able to digest the tabular data anyway, so the point is moot :-).
+
+- These functions ignore ANSI escape sequences (at least the ones generated by
+  the :mod:`~humanfriendly.terminal` module) in the calculation of columns
+  widths. On reason for this is that column names are highlighted in color when
+  connected to a terminal. It also means that you can use ANSI escape sequences
+  to highlight certain column's values if you feel like it (for example to
+  highlight deviations from the norm in an overview of calculated values).
+"""
+
+# Standard library modules.
+import collections
+import re
+
+# Modules included in our package.
+from humanfriendly.compat import coerce_string
+from humanfriendly.terminal import (
+    ansi_strip,
+    ansi_width,
+    ansi_wrap,
+    terminal_supports_colors,
+    find_terminal_size,
+    HIGHLIGHT_COLOR,
+)
+
+# Public identifiers that require documentation.
+__all__ = (
+    'format_pretty_table',
+    'format_robust_table',
+    'format_rst_table',
+    'format_smart_table',
+)
+
+# Compiled regular expression pattern to recognize table columns containing
+# numeric data (integer and/or floating point numbers). Used to right-align the
+# contents of such columns.
+#
+# Pre-emptive snarky comment: This pattern doesn't match every possible
+# floating point number notation!?!1!1
+#
+# Response: I know, that's intentional. The use of this regular expression
+# pattern has a very high DWIM level and weird floating point notations do not
+# fall under the DWIM umbrella :-).
+NUMERIC_DATA_PATTERN = re.compile(r'^\d+(\.\d+)?$')
+
+
+def format_smart_table(data, column_names):
+    """
+    Render tabular data using the most appropriate representation.
+
+    :param data: An iterable (e.g. a :func:`tuple` or :class:`list`)
+                 containing the rows of the table, where each row is an
+                 iterable containing the columns of the table (strings).
+    :param column_names: An iterable of column names (strings).
+    :returns: The rendered table (a string).
+
+    If you want an easy way to render tabular data on a terminal in a human
+    friendly format then this function is for you! It works as follows:
+
+    - If the input data doesn't contain any line breaks the function
+      :func:`format_pretty_table()` is used to render a pretty table. If the
+      resulting table fits in the terminal without wrapping the rendered pretty
+      table is returned.
+
+    - If the input data does contain line breaks or if a pretty table would
+      wrap (given the width of the terminal) then the function
+      :func:`format_robust_table()` is used to render a more robust table that
+      can deal with data containing line breaks and long text.
+    """
+    # Normalize the input in case we fall back from a pretty table to a robust
+    # table (in which case we'll definitely iterate the input more than once).
+    data = [normalize_columns(r) for r in data]
+    column_names = normalize_columns(column_names)
+    # Make sure the input data doesn't contain any line breaks (because pretty
+    # tables break horribly when a column's text contains a line break :-).
+    if not any(any('\n' in c for c in r) for r in data):
+        # Render a pretty table.
+        pretty_table = format_pretty_table(data, column_names)
+        # Check if the pretty table fits in the terminal.
+        table_width = max(map(ansi_width, pretty_table.splitlines()))
+        num_rows, num_columns = find_terminal_size()
+        if table_width <= num_columns:
+            # The pretty table fits in the terminal without wrapping!
+            return pretty_table
+    # Fall back to a robust table when a pretty table won't work.
+    return format_robust_table(data, column_names)
+
+
+def format_pretty_table(data, column_names=None, horizontal_bar='-', vertical_bar='|'):
+    """
+    Render a table using characters like dashes and vertical bars to emulate borders.
+
+    :param data: An iterable (e.g. a :func:`tuple` or :class:`list`)
+                 containing the rows of the table, where each row is an
+                 iterable containing the columns of the table (strings).
+    :param column_names: An iterable of column names (strings).
+    :param horizontal_bar: The character used to represent a horizontal bar (a
+                           string).
+    :param vertical_bar: The character used to represent a vertical bar (a
+                         string).
+    :returns: The rendered table (a string).
+
+    Here's an example:
+
+    >>> from humanfriendly.tables import format_pretty_table
+    >>> column_names = ['Version', 'Uploaded on', 'Downloads']
+    >>> humanfriendly_releases = [
+    ... ['1.23', '2015-05-25', '218'],
+    ... ['1.23.1', '2015-05-26', '1354'],
+    ... ['1.24', '2015-05-26', '223'],
+    ... ['1.25', '2015-05-26', '4319'],
+    ... ['1.25.1', '2015-06-02', '197'],
+    ... ]
+    >>> print(format_pretty_table(humanfriendly_releases, column_names))
+    -------------------------------------
+    | Version | Uploaded on | Downloads |
+    -------------------------------------
+    | 1.23    | 2015-05-25  |       218 |
+    | 1.23.1  | 2015-05-26  |      1354 |
+    | 1.24    | 2015-05-26  |       223 |
+    | 1.25    | 2015-05-26  |      4319 |
+    | 1.25.1  | 2015-06-02  |       197 |
+    -------------------------------------
+
+    Notes about the resulting table:
+
+    - If a column contains numeric data (integer and/or floating point
+      numbers) in all rows (ignoring column names of course) then the content
+      of that column is right-aligned, as can be seen in the example above. The
+      idea here is to make it easier to compare the numbers in different
+      columns to each other.
+
+    - The column names are highlighted in color so they stand out a bit more
+      (see also :data:`.HIGHLIGHT_COLOR`). The following screen shot shows what
+      that looks like (my terminals are always set to white text on a black
+      background):
+
+      .. image:: images/pretty-table.png
+    """
+    # Normalize the input because we'll have to iterate it more than once.
+    data = [normalize_columns(r, expandtabs=True) for r in data]
+    if column_names is not None:
+        column_names = normalize_columns(column_names)
+        if column_names:
+            if terminal_supports_colors():
+                column_names = [highlight_column_name(n) for n in column_names]
+            data.insert(0, column_names)
+    # Calculate the maximum width of each column.
+    widths = collections.defaultdict(int)
+    numeric_data = collections.defaultdict(list)
+    for row_index, row in enumerate(data):
+        for column_index, column in enumerate(row):
+            widths[column_index] = max(widths[column_index], ansi_width(column))
+            if not (column_names and row_index == 0):
+                numeric_data[column_index].append(bool(NUMERIC_DATA_PATTERN.match(ansi_strip(column))))
+    # Create a horizontal bar of dashes as a delimiter.
+    line_delimiter = horizontal_bar * (sum(widths.values()) + len(widths) * 3 + 1)
+    # Start the table with a vertical bar.
+    lines = [line_delimiter]
+    # Format the rows and columns.
+    for row_index, row in enumerate(data):
+        line = [vertical_bar]
+        for column_index, column in enumerate(row):
+            padding = ' ' * (widths[column_index] - ansi_width(column))
+            if all(numeric_data[column_index]):
+                line.append(' ' + padding + column + ' ')
+            else:
+                line.append(' ' + column + padding + ' ')
+            line.append(vertical_bar)
+        lines.append(u''.join(line))
+        if column_names and row_index == 0:
+            lines.append(line_delimiter)
+    # End the table with a vertical bar.
+    lines.append(line_delimiter)
+    # Join the lines, returning a single string.
+    return u'\n'.join(lines)
+
+
+def format_robust_table(data, column_names):
+    """
+    Render tabular data with one column per line (allowing columns with line breaks).
+
+    :param data: An iterable (e.g. a :func:`tuple` or :class:`list`)
+                 containing the rows of the table, where each row is an
+                 iterable containing the columns of the table (strings).
+    :param column_names: An iterable of column names (strings).
+    :returns: The rendered table (a string).
+
+    Here's an example:
+
+    >>> from humanfriendly.tables import format_robust_table
+    >>> column_names = ['Version', 'Uploaded on', 'Downloads']
+    >>> humanfriendly_releases = [
+    ... ['1.23', '2015-05-25', '218'],
+    ... ['1.23.1', '2015-05-26', '1354'],
+    ... ['1.24', '2015-05-26', '223'],
+    ... ['1.25', '2015-05-26', '4319'],
+    ... ['1.25.1', '2015-06-02', '197'],
+    ... ]
+    >>> print(format_robust_table(humanfriendly_releases, column_names))
+    -----------------------
+    Version: 1.23
+    Uploaded on: 2015-05-25
+    Downloads: 218
+    -----------------------
+    Version: 1.23.1
+    Uploaded on: 2015-05-26
+    Downloads: 1354
+    -----------------------
+    Version: 1.24
+    Uploaded on: 2015-05-26
+    Downloads: 223
+    -----------------------
+    Version: 1.25
+    Uploaded on: 2015-05-26
+    Downloads: 4319
+    -----------------------
+    Version: 1.25.1
+    Uploaded on: 2015-06-02
+    Downloads: 197
+    -----------------------
+
+    The column names are highlighted in bold font and color so they stand out a
+    bit more (see :data:`.HIGHLIGHT_COLOR`).
+    """
+    blocks = []
+    column_names = ["%s:" % n for n in normalize_columns(column_names)]
+    if terminal_supports_colors():
+        column_names = [highlight_column_name(n) for n in column_names]
+    # Convert each row into one or more `name: value' lines (one per column)
+    # and group each `row of lines' into a block (i.e. rows become blocks).
+    for row in data:
+        lines = []
+        for column_index, column_text in enumerate(normalize_columns(row)):
+            stripped_column = column_text.strip()
+            if '\n' not in stripped_column:
+                # Columns without line breaks are formatted inline.
+                lines.append("%s %s" % (column_names[column_index], stripped_column))
+            else:
+                # Columns with line breaks could very well contain indented
+                # lines, so we'll put the column name on a separate line. This
+                # way any indentation remains intact, and it's easier to
+                # copy/paste the text.
+                lines.append(column_names[column_index])
+                lines.extend(column_text.rstrip().splitlines())
+        blocks.append(lines)
+    # Calculate the width of the row delimiter.
+    num_rows, num_columns = find_terminal_size()
+    longest_line = max(max(map(ansi_width, lines)) for lines in blocks)
+    delimiter = u"\n%s\n" % ('-' * min(longest_line, num_columns))
+    # Force a delimiter at the start and end of the table.
+    blocks.insert(0, "")
+    blocks.append("")
+    # Embed the row delimiter between every two blocks.
+    return delimiter.join(u"\n".join(b) for b in blocks).strip()
+
+
+def format_rst_table(data, column_names=None):
+    """
+    Render a table in reStructuredText_ format.
+
+    :param data: An iterable (e.g. a :func:`tuple` or :class:`list`)
+                 containing the rows of the table, where each row is an
+                 iterable containing the columns of the table (strings).
+    :param column_names: An iterable of column names (strings).
+    :returns: The rendered table (a string).
+
+    Here's an example:
+
+    >>> from humanfriendly.tables import format_rst_table
+    >>> column_names = ['Version', 'Uploaded on', 'Downloads']
+    >>> humanfriendly_releases = [
+    ... ['1.23', '2015-05-25', '218'],
+    ... ['1.23.1', '2015-05-26', '1354'],
+    ... ['1.24', '2015-05-26', '223'],
+    ... ['1.25', '2015-05-26', '4319'],
+    ... ['1.25.1', '2015-06-02', '197'],
+    ... ]
+    >>> print(format_rst_table(humanfriendly_releases, column_names))
+    =======  ===========  =========
+    Version  Uploaded on  Downloads
+    =======  ===========  =========
+    1.23     2015-05-25   218
+    1.23.1   2015-05-26   1354
+    1.24     2015-05-26   223
+    1.25     2015-05-26   4319
+    1.25.1   2015-06-02   197
+    =======  ===========  =========
+
+    .. _reStructuredText: https://en.wikipedia.org/wiki/ReStructuredText
+    """
+    data = [normalize_columns(r) for r in data]
+    if column_names:
+        data.insert(0, normalize_columns(column_names))
+    # Calculate the maximum width of each column.
+    widths = collections.defaultdict(int)
+    for row in data:
+        for index, column in enumerate(row):
+            widths[index] = max(widths[index], len(column))
+    # Pad the columns using whitespace.
+    for row in data:
+        for index, column in enumerate(row):
+            if index < (len(row) - 1):
+                row[index] = column.ljust(widths[index])
+    # Add table markers.
+    delimiter = ['=' * w for i, w in sorted(widths.items())]
+    if column_names:
+        data.insert(1, delimiter)
+    data.insert(0, delimiter)
+    data.append(delimiter)
+    # Join the lines and columns together.
+    return '\n'.join('  '.join(r) for r in data)
+
+
+def normalize_columns(row, expandtabs=False):
+    results = []
+    for value in row:
+        text = coerce_string(value)
+        if expandtabs:
+            text = text.expandtabs()
+        results.append(text)
+    return results
+
+
+def highlight_column_name(name):
+    return ansi_wrap(name, bold=True, color=HIGHLIGHT_COLOR)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__init__.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba9739ccb22e5708458c453eeb366de77d0e4b4d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__init__.py
@@ -0,0 +1,776 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 1, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Interaction with interactive text terminals.
+
+The :mod:`~humanfriendly.terminal` module makes it easy to interact with
+interactive text terminals and format text for rendering on such terminals. If
+the terms used in the documentation of this module don't make sense to you then
+please refer to the `Wikipedia article on ANSI escape sequences`_ for details
+about how ANSI escape sequences work.
+
+This module was originally developed for use on UNIX systems, but since then
+Windows 10 gained native support for ANSI escape sequences and this module was
+enhanced to recognize and support this. For details please refer to the
+:func:`enable_ansi_support()` function.
+
+.. _Wikipedia article on ANSI escape sequences: http://en.wikipedia.org/wiki/ANSI_escape_code#Sequence_elements
+"""
+
+# Standard library modules.
+import codecs
+import numbers
+import os
+import platform
+import re
+import subprocess
+import sys
+
+# The `fcntl' module is platform specific so importing it may give an error. We
+# hide this implementation detail from callers by handling the import error and
+# setting a flag instead.
+try:
+    import fcntl
+    import termios
+    import struct
+    HAVE_IOCTL = True
+except ImportError:
+    HAVE_IOCTL = False
+
+# Modules included in our package.
+from humanfriendly.compat import coerce_string, is_unicode, on_windows, which
+from humanfriendly.decorators import cached
+from humanfriendly.deprecation import define_aliases
+from humanfriendly.text import concatenate, format
+from humanfriendly.usage import format_usage
+
+# Public identifiers that require documentation.
+__all__ = (
+    'ANSI_COLOR_CODES',
+    'ANSI_CSI',
+    'ANSI_ERASE_LINE',
+    'ANSI_HIDE_CURSOR',
+    'ANSI_RESET',
+    'ANSI_SGR',
+    'ANSI_SHOW_CURSOR',
+    'ANSI_TEXT_STYLES',
+    'CLEAN_OUTPUT_PATTERN',
+    'DEFAULT_COLUMNS',
+    'DEFAULT_ENCODING',
+    'DEFAULT_LINES',
+    'HIGHLIGHT_COLOR',
+    'ansi_strip',
+    'ansi_style',
+    'ansi_width',
+    'ansi_wrap',
+    'auto_encode',
+    'clean_terminal_output',
+    'connected_to_terminal',
+    'enable_ansi_support',
+    'find_terminal_size',
+    'find_terminal_size_using_ioctl',
+    'find_terminal_size_using_stty',
+    'get_pager_command',
+    'have_windows_native_ansi_support',
+    'message',
+    'output',
+    'readline_strip',
+    'readline_wrap',
+    'show_pager',
+    'terminal_supports_colors',
+    'usage',
+    'warning',
+)
+
+ANSI_CSI = '\x1b['
+"""The ANSI "Control Sequence Introducer" (a string)."""
+
+ANSI_SGR = 'm'
+"""The ANSI "Select Graphic Rendition" sequence (a string)."""
+
+ANSI_ERASE_LINE = '%sK' % ANSI_CSI
+"""The ANSI escape sequence to erase the current line (a string)."""
+
+ANSI_RESET = '%s0%s' % (ANSI_CSI, ANSI_SGR)
+"""The ANSI escape sequence to reset styling (a string)."""
+
+ANSI_HIDE_CURSOR = '%s?25l' % ANSI_CSI
+"""The ANSI escape sequence to hide the text cursor (a string)."""
+
+ANSI_SHOW_CURSOR = '%s?25h' % ANSI_CSI
+"""The ANSI escape sequence to show the text cursor (a string)."""
+
+ANSI_COLOR_CODES = dict(black=0, red=1, green=2, yellow=3, blue=4, magenta=5, cyan=6, white=7)
+"""
+A dictionary with (name, number) pairs of `portable color codes`_. Used by
+:func:`ansi_style()` to generate ANSI escape sequences that change font color.
+
+.. _portable color codes: http://en.wikipedia.org/wiki/ANSI_escape_code#Colors
+"""
+
+ANSI_TEXT_STYLES = dict(bold=1, faint=2, italic=3, underline=4, inverse=7, strike_through=9)
+"""
+A dictionary with (name, number) pairs of text styles (effects). Used by
+:func:`ansi_style()` to generate ANSI escape sequences that change text
+styles. Only widely supported text styles are included here.
+"""
+
+CLEAN_OUTPUT_PATTERN = re.compile(u'(\r|\n|\b|%s)' % re.escape(ANSI_ERASE_LINE))
+"""
+A compiled regular expression used to separate significant characters from other text.
+
+This pattern is used by :func:`clean_terminal_output()` to split terminal
+output into regular text versus backspace, carriage return and line feed
+characters and ANSI 'erase line' escape sequences.
+"""
+
+DEFAULT_LINES = 25
+"""The default number of lines in a terminal (an integer)."""
+
+DEFAULT_COLUMNS = 80
+"""The default number of columns in a terminal (an integer)."""
+
+DEFAULT_ENCODING = 'UTF-8'
+"""The output encoding for Unicode strings."""
+
+HIGHLIGHT_COLOR = os.environ.get('HUMANFRIENDLY_HIGHLIGHT_COLOR', 'green')
+"""
+The color used to highlight important tokens in formatted text (e.g. the usage
+message of the ``humanfriendly`` program). If the environment variable
+``$HUMANFRIENDLY_HIGHLIGHT_COLOR`` is set it determines the value of
+:data:`HIGHLIGHT_COLOR`.
+"""
+
+
+def ansi_strip(text, readline_hints=True):
+    """
+    Strip ANSI escape sequences from the given string.
+
+    :param text: The text from which ANSI escape sequences should be removed (a
+                 string).
+    :param readline_hints: If :data:`True` then :func:`readline_strip()` is
+                           used to remove `readline hints`_ from the string.
+    :returns: The text without ANSI escape sequences (a string).
+    """
+    pattern = '%s.*?%s' % (re.escape(ANSI_CSI), re.escape(ANSI_SGR))
+    text = re.sub(pattern, '', text)
+    if readline_hints:
+        text = readline_strip(text)
+    return text
+
+
+def ansi_style(**kw):
+    """
+    Generate ANSI escape sequences for the given color and/or style(s).
+
+    :param color: The foreground color. Three types of values are supported:
+
+                  - The name of a color (one of the strings 'black', 'red',
+                    'green', 'yellow', 'blue', 'magenta', 'cyan' or 'white').
+                  - An integer that refers to the 256 color mode palette.
+                  - A tuple or list with three integers representing an RGB
+                    (red, green, blue) value.
+
+                  The value :data:`None` (the default) means no escape
+                  sequence to switch color will be emitted.
+    :param background: The background color (see the description
+                       of the `color` argument).
+    :param bright: Use high intensity colors instead of default colors
+                   (a boolean, defaults to :data:`False`).
+    :param readline_hints: If :data:`True` then :func:`readline_wrap()` is
+                           applied to the generated ANSI escape sequences (the
+                           default is :data:`False`).
+    :param kw: Any additional keyword arguments are expected to match a key
+               in the :data:`ANSI_TEXT_STYLES` dictionary. If the argument's
+               value evaluates to :data:`True` the respective style will be
+               enabled.
+    :returns: The ANSI escape sequences to enable the requested text styles or
+              an empty string if no styles were requested.
+    :raises: :exc:`~exceptions.ValueError` when an invalid color name is given.
+
+    Even though only eight named colors are supported, the use of `bright=True`
+    and `faint=True` increases the number of available colors to around 24 (it
+    may be slightly lower, for example because faint black is just black).
+
+    **Support for 8-bit colors**
+
+    In `release 4.7`_ support for 256 color mode was added. While this
+    significantly increases the available colors it's not very human friendly
+    in usage because you need to look up color codes in the `256 color mode
+    palette <https://en.wikipedia.org/wiki/ANSI_escape_code#8-bit>`_.
+
+    You can use the ``humanfriendly --demo`` command to get a demonstration of
+    the available colors, see also the screen shot below. Note that the small
+    font size in the screen shot was so that the demonstration of 256 color
+    mode support would fit into a single screen shot without scrolling :-)
+    (I wasn't feeling very creative).
+
+      .. image:: images/ansi-demo.png
+
+    **Support for 24-bit colors**
+
+    In `release 4.14`_ support for 24-bit colors was added by accepting a tuple
+    or list with three integers representing the RGB (red, green, blue) value
+    of a color. This is not included in the demo because rendering millions of
+    colors was deemed unpractical ;-).
+
+    .. _release 4.7: http://humanfriendly.readthedocs.io/en/latest/changelog.html#release-4-7-2018-01-14
+    .. _release 4.14: http://humanfriendly.readthedocs.io/en/latest/changelog.html#release-4-14-2018-07-13
+    """
+    # Start with sequences that change text styles.
+    sequences = [ANSI_TEXT_STYLES[k] for k, v in kw.items() if k in ANSI_TEXT_STYLES and v]
+    # Append the color code (if any).
+    for color_type in 'color', 'background':
+        color_value = kw.get(color_type)
+        if isinstance(color_value, (tuple, list)):
+            if len(color_value) != 3:
+                msg = "Invalid color value %r! (expected tuple or list with three numbers)"
+                raise ValueError(msg % color_value)
+            sequences.append(48 if color_type == 'background' else 38)
+            sequences.append(2)
+            sequences.extend(map(int, color_value))
+        elif isinstance(color_value, numbers.Number):
+            # Numeric values are assumed to be 256 color codes.
+            sequences.extend((
+                39 if color_type == 'background' else 38,
+                5, int(color_value)
+            ))
+        elif color_value:
+            # Other values are assumed to be strings containing one of the known color names.
+            if color_value not in ANSI_COLOR_CODES:
+                msg = "Invalid color value %r! (expected an integer or one of the strings %s)"
+                raise ValueError(msg % (color_value, concatenate(map(repr, sorted(ANSI_COLOR_CODES)))))
+            # Pick the right offset for foreground versus background
+            # colors and regular intensity versus bright colors.
+            offset = (
+                (100 if kw.get('bright') else 40)
+                if color_type == 'background'
+                else (90 if kw.get('bright') else 30)
+            )
+            # Combine the offset and color code into a single integer.
+            sequences.append(offset + ANSI_COLOR_CODES[color_value])
+    if sequences:
+        encoded = ANSI_CSI + ';'.join(map(str, sequences)) + ANSI_SGR
+        return readline_wrap(encoded) if kw.get('readline_hints') else encoded
+    else:
+        return ''
+
+
+def ansi_width(text):
+    """
+    Calculate the effective width of the given text (ignoring ANSI escape sequences).
+
+    :param text: The text whose width should be calculated (a string).
+    :returns: The width of the text without ANSI escape sequences (an
+              integer).
+
+    This function uses :func:`ansi_strip()` to strip ANSI escape sequences from
+    the given string and returns the length of the resulting string.
+    """
+    return len(ansi_strip(text))
+
+
+def ansi_wrap(text, **kw):
+    """
+    Wrap text in ANSI escape sequences for the given color and/or style(s).
+
+    :param text: The text to wrap (a string).
+    :param kw: Any keyword arguments are passed to :func:`ansi_style()`.
+    :returns: The result of this function depends on the keyword arguments:
+
+              - If :func:`ansi_style()` generates an ANSI escape sequence based
+                on the keyword arguments, the given text is prefixed with the
+                generated ANSI escape sequence and suffixed with
+                :data:`ANSI_RESET`.
+
+              - If :func:`ansi_style()` returns an empty string then the text
+                given by the caller is returned unchanged.
+    """
+    start_sequence = ansi_style(**kw)
+    if start_sequence:
+        end_sequence = ANSI_RESET
+        if kw.get('readline_hints'):
+            end_sequence = readline_wrap(end_sequence)
+        return start_sequence + text + end_sequence
+    else:
+        return text
+
+
+def auto_encode(stream, text, *args, **kw):
+    """
+    Reliably write Unicode strings to the terminal.
+
+    :param stream: The file-like object to write to (a value like
+                   :data:`sys.stdout` or :data:`sys.stderr`).
+    :param text: The text to write to the stream (a string).
+    :param args: Refer to :func:`~humanfriendly.text.format()`.
+    :param kw: Refer to :func:`~humanfriendly.text.format()`.
+
+    Renders the text using :func:`~humanfriendly.text.format()` and writes it
+    to the given stream. If an :exc:`~exceptions.UnicodeEncodeError` is
+    encountered in doing so, the text is encoded using :data:`DEFAULT_ENCODING`
+    and the write is retried. The reasoning behind this rather blunt approach
+    is that it's preferable to get output on the command line in the wrong
+    encoding then to have the Python program blow up with a
+    :exc:`~exceptions.UnicodeEncodeError` exception.
+    """
+    text = format(text, *args, **kw)
+    try:
+        stream.write(text)
+    except UnicodeEncodeError:
+        stream.write(codecs.encode(text, DEFAULT_ENCODING))
+
+
+def clean_terminal_output(text):
+    """
+    Clean up the terminal output of a command.
+
+    :param text: The raw text with special characters (a Unicode string).
+    :returns: A list of Unicode strings (one for each line).
+
+    This function emulates the effect of backspace (0x08), carriage return
+    (0x0D) and line feed (0x0A) characters and the ANSI 'erase line' escape
+    sequence on interactive terminals. It's intended to clean up command output
+    that was originally meant to be rendered on an interactive terminal and
+    that has been captured using e.g. the :man:`script` program [#]_ or the
+    :mod:`pty` module [#]_.
+
+    .. [#] My coloredlogs_ package supports the ``coloredlogs --to-html``
+           command which uses :man:`script` to fool a subprocess into thinking
+           that it's connected to an interactive terminal (in order to get it
+           to emit ANSI escape sequences).
+
+    .. [#] My capturer_ package uses the :mod:`pty` module to fool the current
+           process and subprocesses into thinking they are connected to an
+           interactive terminal (in order to get them to emit ANSI escape
+           sequences).
+
+    **Some caveats about the use of this function:**
+
+    - Strictly speaking the effect of carriage returns cannot be emulated
+      outside of an actual terminal due to the interaction between overlapping
+      output, terminal widths and line wrapping. The goal of this function is
+      to sanitize noise in terminal output while preserving useful output.
+      Think of it as a useful and pragmatic but possibly lossy conversion.
+
+    - The algorithm isn't smart enough to properly handle a pair of ANSI escape
+      sequences that open before a carriage return and close after the last
+      carriage return in a linefeed delimited string; the resulting string will
+      contain only the closing end of the ANSI escape sequence pair. Tracking
+      this kind of complexity requires a state machine and proper parsing.
+
+    .. _capturer: https://pypi.org/project/capturer
+    .. _coloredlogs: https://pypi.org/project/coloredlogs
+    """
+    cleaned_lines = []
+    current_line = ''
+    current_position = 0
+    for token in CLEAN_OUTPUT_PATTERN.split(text):
+        if token == '\r':
+            # Seek back to the start of the current line.
+            current_position = 0
+        elif token == '\b':
+            # Seek back one character in the current line.
+            current_position = max(0, current_position - 1)
+        else:
+            if token == '\n':
+                # Capture the current line.
+                cleaned_lines.append(current_line)
+            if token in ('\n', ANSI_ERASE_LINE):
+                # Clear the current line.
+                current_line = ''
+                current_position = 0
+            elif token:
+                # Merge regular output into the current line.
+                new_position = current_position + len(token)
+                prefix = current_line[:current_position]
+                suffix = current_line[new_position:]
+                current_line = prefix + token + suffix
+                current_position = new_position
+    # Capture the last line (if any).
+    cleaned_lines.append(current_line)
+    # Remove any empty trailing lines.
+    while cleaned_lines and not cleaned_lines[-1]:
+        cleaned_lines.pop(-1)
+    return cleaned_lines
+
+
+def connected_to_terminal(stream=None):
+    """
+    Check if a stream is connected to a terminal.
+
+    :param stream: The stream to check (a file-like object,
+                   defaults to :data:`sys.stdout`).
+    :returns: :data:`True` if the stream is connected to a terminal,
+              :data:`False` otherwise.
+
+    See also :func:`terminal_supports_colors()`.
+    """
+    stream = sys.stdout if stream is None else stream
+    try:
+        return stream.isatty()
+    except Exception:
+        return False
+
+
+@cached
+def enable_ansi_support():
+    """
+    Try to enable support for ANSI escape sequences (required on Windows).
+
+    :returns: :data:`True` if ANSI is supported, :data:`False` otherwise.
+
+    This functions checks for the following supported configurations, in the
+    given order:
+
+    1. On Windows, if :func:`have_windows_native_ansi_support()` confirms
+       native support for ANSI escape sequences :mod:`ctypes` will be used to
+       enable this support.
+
+    2. On Windows, if the environment variable ``$ANSICON`` is set nothing is
+       done because it is assumed that support for ANSI escape sequences has
+       already been enabled via `ansicon <https://github.com/adoxa/ansicon>`_.
+
+    3. On Windows, an attempt is made to import and initialize the Python
+       package :pypi:`colorama` instead (of course for this to work
+       :pypi:`colorama` has to be installed).
+
+    4. On other platforms this function calls :func:`connected_to_terminal()`
+       to determine whether ANSI escape sequences are supported (that is to
+       say all platforms that are not Windows are assumed to support ANSI
+       escape sequences natively, without weird contortions like above).
+
+       This makes it possible to call :func:`enable_ansi_support()`
+       unconditionally without checking the current platform.
+
+    The :func:`~humanfriendly.decorators.cached` decorator is used to ensure
+    that this function is only executed once, but its return value remains
+    available on later calls.
+    """
+    if have_windows_native_ansi_support():
+        import ctypes
+        ctypes.windll.kernel32.SetConsoleMode(ctypes.windll.kernel32.GetStdHandle(-11), 7)
+        ctypes.windll.kernel32.SetConsoleMode(ctypes.windll.kernel32.GetStdHandle(-12), 7)
+        return True
+    elif on_windows():
+        if 'ANSICON' in os.environ:
+            return True
+        try:
+            import colorama
+            colorama.init()
+            return True
+        except ImportError:
+            return False
+    else:
+        return connected_to_terminal()
+
+
+def find_terminal_size():
+    """
+    Determine the number of lines and columns visible in the terminal.
+
+    :returns: A tuple of two integers with the line and column count.
+
+    The result of this function is based on the first of the following three
+    methods that works:
+
+    1. First :func:`find_terminal_size_using_ioctl()` is tried,
+    2. then :func:`find_terminal_size_using_stty()` is tried,
+    3. finally :data:`DEFAULT_LINES` and :data:`DEFAULT_COLUMNS` are returned.
+
+    .. note:: The :func:`find_terminal_size()` function performs the steps
+              above every time it is called, the result is not cached. This is
+              because the size of a virtual terminal can change at any time and
+              the result of :func:`find_terminal_size()` should be correct.
+
+              `Pre-emptive snarky comment`_: It's possible to cache the result
+              of this function and use :mod:`signal.SIGWINCH <signal>` to
+              refresh the cached values!
+
+              Response: As a library I don't consider it the role of the
+              :mod:`humanfriendly.terminal` module to install a process wide
+              signal handler ...
+
+    .. _Pre-emptive snarky comment: http://blogs.msdn.com/b/oldnewthing/archive/2008/01/30/7315957.aspx
+    """
+    # The first method. Any of the standard streams may have been redirected
+    # somewhere and there's no telling which, so we'll just try them all.
+    for stream in sys.stdin, sys.stdout, sys.stderr:
+        try:
+            result = find_terminal_size_using_ioctl(stream)
+            if min(result) >= 1:
+                return result
+        except Exception:
+            pass
+    # The second method.
+    try:
+        result = find_terminal_size_using_stty()
+        if min(result) >= 1:
+            return result
+    except Exception:
+        pass
+    # Fall back to conservative defaults.
+    return DEFAULT_LINES, DEFAULT_COLUMNS
+
+
+def find_terminal_size_using_ioctl(stream):
+    """
+    Find the terminal size using :func:`fcntl.ioctl()`.
+
+    :param stream: A stream connected to the terminal (a file object with a
+                   ``fileno`` attribute).
+    :returns: A tuple of two integers with the line and column count.
+    :raises: This function can raise exceptions but I'm not going to document
+             them here, you should be using :func:`find_terminal_size()`.
+
+    Based on an `implementation found on StackOverflow <http://stackoverflow.com/a/3010495/788200>`_.
+    """
+    if not HAVE_IOCTL:
+        raise NotImplementedError("It looks like the `fcntl' module is not available!")
+    h, w, hp, wp = struct.unpack('HHHH', fcntl.ioctl(stream, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0)))
+    return h, w
+
+
+def find_terminal_size_using_stty():
+    """
+    Find the terminal size using the external command ``stty size``.
+
+    :param stream: A stream connected to the terminal (a file object).
+    :returns: A tuple of two integers with the line and column count.
+    :raises: This function can raise exceptions but I'm not going to document
+             them here, you should be using :func:`find_terminal_size()`.
+    """
+    stty = subprocess.Popen(['stty', 'size'],
+                            stdout=subprocess.PIPE,
+                            stderr=subprocess.PIPE)
+    stdout, stderr = stty.communicate()
+    tokens = stdout.split()
+    if len(tokens) != 2:
+        raise Exception("Invalid output from `stty size'!")
+    return tuple(map(int, tokens))
+
+
+def get_pager_command(text=None):
+    """
+    Get the command to show a text on the terminal using a pager.
+
+    :param text: The text to print to the terminal (a string).
+    :returns: A list of strings with the pager command and arguments.
+
+    The use of a pager helps to avoid the wall of text effect where the user
+    has to scroll up to see where the output began (not very user friendly).
+
+    If the given text contains ANSI escape sequences the command ``less
+    --RAW-CONTROL-CHARS`` is used, otherwise the environment variable
+    ``$PAGER`` is used (if ``$PAGER`` isn't set :man:`less` is used).
+
+    When the selected pager is :man:`less`, the following options are used to
+    make the experience more user friendly:
+
+    - ``--quit-if-one-screen`` causes :man:`less` to automatically exit if the
+      entire text can be displayed on the first screen. This makes the use of a
+      pager transparent for smaller texts (because the operator doesn't have to
+      quit the pager).
+
+    - ``--no-init`` prevents :man:`less` from clearing the screen when it
+      exits. This ensures that the operator gets a chance to review the text
+      (for example a usage message) after quitting the pager, while composing
+      the next command.
+    """
+    # Compose the pager command.
+    if text and ANSI_CSI in text:
+        command_line = ['less', '--RAW-CONTROL-CHARS']
+    else:
+        command_line = [os.environ.get('PAGER', 'less')]
+    # Pass some additional options to `less' (to make it more
+    # user friendly) without breaking support for other pagers.
+    if os.path.basename(command_line[0]) == 'less':
+        command_line.append('--no-init')
+        command_line.append('--quit-if-one-screen')
+    return command_line
+
+
+@cached
+def have_windows_native_ansi_support():
+    """
+    Check if we're running on a Windows 10 release with native support for ANSI escape sequences.
+
+    :returns: :data:`True` if so, :data:`False` otherwise.
+
+    The :func:`~humanfriendly.decorators.cached` decorator is used as a minor
+    performance optimization. Semantically this should have zero impact because
+    the answer doesn't change in the lifetime of a computer process.
+    """
+    if on_windows():
+        try:
+            # I can't be 100% sure this will never break and I'm not in a
+            # position to test it thoroughly either, so I decided that paying
+            # the price of one additional try / except statement is worth the
+            # additional peace of mind :-).
+            components = tuple(int(c) for c in platform.version().split('.'))
+            return components >= (10, 0, 14393)
+        except Exception:
+            pass
+    return False
+
+
+def message(text, *args, **kw):
+    """
+    Print a formatted message to the standard error stream.
+
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
+
+    Renders the message using :func:`~humanfriendly.text.format()` and writes
+    the resulting string (followed by a newline) to :data:`sys.stderr` using
+    :func:`auto_encode()`.
+    """
+    auto_encode(sys.stderr, coerce_string(text) + '\n', *args, **kw)
+
+
+def output(text, *args, **kw):
+    """
+    Print a formatted message to the standard output stream.
+
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
+
+    Renders the message using :func:`~humanfriendly.text.format()` and writes
+    the resulting string (followed by a newline) to :data:`sys.stdout` using
+    :func:`auto_encode()`.
+    """
+    auto_encode(sys.stdout, coerce_string(text) + '\n', *args, **kw)
+
+
+def readline_strip(expr):
+    """
+    Remove `readline hints`_ from a string.
+
+    :param text: The text to strip (a string).
+    :returns: The stripped text.
+    """
+    return expr.replace('\001', '').replace('\002', '')
+
+
+def readline_wrap(expr):
+    """
+    Wrap an ANSI escape sequence in `readline hints`_.
+
+    :param text: The text with the escape sequence to wrap (a string).
+    :returns: The wrapped text.
+
+    .. _readline hints: http://superuser.com/a/301355
+    """
+    return '\001' + expr + '\002'
+
+
+def show_pager(formatted_text, encoding=DEFAULT_ENCODING):
+    """
+    Print a large text to the terminal using a pager.
+
+    :param formatted_text: The text to print to the terminal (a string).
+    :param encoding: The name of the text encoding used to encode the formatted
+                     text if the formatted text is a Unicode string (a string,
+                     defaults to :data:`DEFAULT_ENCODING`).
+
+    When :func:`connected_to_terminal()` returns :data:`True` a pager is used
+    to show the text on the terminal, otherwise the text is printed directly
+    without invoking a pager.
+
+    The use of a pager helps to avoid the wall of text effect where the user
+    has to scroll up to see where the output began (not very user friendly).
+
+    Refer to :func:`get_pager_command()` for details about the command line
+    that's used to invoke the pager.
+    """
+    if connected_to_terminal():
+        # Make sure the selected pager command is available.
+        command_line = get_pager_command(formatted_text)
+        if which(command_line[0]):
+            pager = subprocess.Popen(command_line, stdin=subprocess.PIPE)
+            if is_unicode(formatted_text):
+                formatted_text = formatted_text.encode(encoding)
+            pager.communicate(input=formatted_text)
+            return
+    output(formatted_text)
+
+
+def terminal_supports_colors(stream=None):
+    """
+    Check if a stream is connected to a terminal that supports ANSI escape sequences.
+
+    :param stream: The stream to check (a file-like object,
+                   defaults to :data:`sys.stdout`).
+    :returns: :data:`True` if the terminal supports ANSI escape sequences,
+              :data:`False` otherwise.
+
+    This function was originally inspired by the implementation of
+    `django.core.management.color.supports_color()
+    <https://github.com/django/django/blob/master/django/core/management/color.py>`_
+    but has since evolved significantly.
+    """
+    if on_windows():
+        # On Windows support for ANSI escape sequences is not a given.
+        have_ansicon = 'ANSICON' in os.environ
+        have_colorama = 'colorama' in sys.modules
+        have_native_support = have_windows_native_ansi_support()
+        if not (have_ansicon or have_colorama or have_native_support):
+            return False
+    return connected_to_terminal(stream)
+
+
+def usage(usage_text):
+    """
+    Print a human friendly usage message to the terminal.
+
+    :param text: The usage message to print (a string).
+
+    This function does two things:
+
+    1. If :data:`sys.stdout` is connected to a terminal (see
+       :func:`connected_to_terminal()`) then the usage message is formatted
+       using :func:`.format_usage()`.
+    2. The usage message is shown using a pager (see :func:`show_pager()`).
+    """
+    if terminal_supports_colors(sys.stdout):
+        usage_text = format_usage(usage_text)
+    show_pager(usage_text)
+
+
+def warning(text, *args, **kw):
+    """
+    Show a warning message on the terminal.
+
+    For details about argument handling please refer to
+    :func:`~humanfriendly.text.format()`.
+
+    Renders the message using :func:`~humanfriendly.text.format()` and writes
+    the resulting string (followed by a newline) to :data:`sys.stderr` using
+    :func:`auto_encode()`.
+
+    If :data:`sys.stderr` is connected to a terminal that supports colors,
+    :func:`ansi_wrap()` is used to color the message in a red font (to make
+    the warning stand out from surrounding text).
+    """
+    text = coerce_string(text)
+    if terminal_supports_colors(sys.stderr):
+        text = ansi_wrap(text, color='red')
+    auto_encode(sys.stderr, text + '\n', *args, **kw)
+
+
+# Define aliases for backwards compatibility.
+define_aliases(
+    module_name=__name__,
+    # In humanfriendly 1.31 the find_meta_variables() and format_usage()
+    # functions were extracted to the new module humanfriendly.usage.
+    find_meta_variables='humanfriendly.usage.find_meta_variables',
+    format_usage='humanfriendly.usage.format_usage',
+    # In humanfriendly 8.0 the html_to_ansi() function and HTMLConverter
+    # class were extracted to the new module humanfriendly.terminal.html.
+    html_to_ansi='humanfriendly.terminal.html.html_to_ansi',
+    HTMLConverter='humanfriendly.terminal.html.HTMLConverter',
+)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5affdf64c543f1af609e7efc7cb370a914745ebc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/html.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/html.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..820b8a54555b4718a674516f443afadbc3014771
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/html.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/spinners.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/spinners.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e4567beab31d40cb117aea6fbd2d59e9718e30a7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/__pycache__/spinners.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/html.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/html.py
new file mode 100644
index 0000000000000000000000000000000000000000..4214e09e7069a8a3e4a96cdc870c78db91f4fe13
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/html.py
@@ -0,0 +1,423 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: February 29, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""Convert HTML with simple text formatting to text with ANSI escape sequences."""
+
+# Standard library modules.
+import re
+
+# Modules included in our package.
+from humanfriendly.compat import HTMLParser, StringIO, name2codepoint, unichr
+from humanfriendly.text import compact_empty_lines
+from humanfriendly.terminal import ANSI_COLOR_CODES, ANSI_RESET, ansi_style
+
+# Public identifiers that require documentation.
+__all__ = ('HTMLConverter', 'html_to_ansi')
+
+
+def html_to_ansi(data, callback=None):
+    """
+    Convert HTML with simple text formatting to text with ANSI escape sequences.
+
+    :param data: The HTML to convert (a string).
+    :param callback: Optional callback to pass to :class:`HTMLConverter`.
+    :returns: Text with ANSI escape sequences (a string).
+
+    Please refer to the documentation of the :class:`HTMLConverter` class for
+    details about the conversion process (like which tags are supported) and an
+    example with a screenshot.
+    """
+    converter = HTMLConverter(callback=callback)
+    return converter(data)
+
+
+class HTMLConverter(HTMLParser):
+
+    """
+    Convert HTML with simple text formatting to text with ANSI escape sequences.
+
+    The following text styles are supported:
+
+    - Bold: ``<b>``, ``<strong>`` and ``<span style="font-weight: bold;">``
+    - Italic: ``<i>``, ``<em>`` and ``<span style="font-style: italic;">``
+    - Strike-through: ``<del>``, ``<s>`` and ``<span style="text-decoration: line-through;">``
+    - Underline: ``<ins>``, ``<u>`` and ``<span style="text-decoration: underline">``
+
+    Colors can be specified as follows:
+
+    - Foreground color: ``<span style="color: #RRGGBB;">``
+    - Background color: ``<span style="background-color: #RRGGBB;">``
+
+    Here's a small demonstration:
+
+    .. code-block:: python
+
+       from humanfriendly.text import dedent
+       from humanfriendly.terminal import html_to_ansi
+
+       print(html_to_ansi(dedent('''
+         <b>Hello world!</b>
+         <i>Is this thing on?</i>
+         I guess I can <u>underline</u> or <s>strike-through</s> text?
+         And what about <span style="color: red">color</span>?
+       ''')))
+
+       rainbow_colors = [
+           '#FF0000', '#E2571E', '#FF7F00', '#FFFF00', '#00FF00',
+           '#96BF33', '#0000FF', '#4B0082', '#8B00FF', '#FFFFFF',
+       ]
+       html_rainbow = "".join('<span style="color: %s">o</span>' % c for c in rainbow_colors)
+       print(html_to_ansi("Let's try a rainbow: %s" % html_rainbow))
+
+    Here's what the results look like:
+
+      .. image:: images/html-to-ansi.png
+
+    Some more details:
+
+    - Nested tags are supported, within reasonable limits.
+
+    - Text in ``<code>`` and ``<pre>`` tags will be highlighted in a
+      different color from the main text (currently this is yellow).
+
+    - ``<a href="URL">TEXT</a>`` is converted to the format "TEXT (URL)" where
+      the uppercase symbols are highlighted in light blue with an underline.
+
+    - ``<div>``, ``<p>`` and ``<pre>`` tags are considered block level tags
+      and are wrapped in vertical whitespace to prevent their content from
+      "running into" surrounding text. This may cause runs of multiple empty
+      lines to be emitted. As a *workaround* the :func:`__call__()` method
+      will automatically call :func:`.compact_empty_lines()` on the generated
+      output before returning it to the caller. Of course this won't work
+      when `output` is set to something like :data:`sys.stdout`.
+
+    - ``<br>`` is converted to a single plain text line break.
+
+    Implementation notes:
+
+    - A list of dictionaries with style information is used as a stack where
+      new styling can be pushed and a pop will restore the previous styling.
+      When new styling is pushed, it is merged with (but overrides) the current
+      styling.
+
+    - If you're going to be converting a lot of HTML it might be useful from
+      a performance standpoint to re-use an existing :class:`HTMLConverter`
+      object for unrelated HTML fragments, in this case take a look at the
+      :func:`__call__()` method (it makes this use case very easy).
+
+    .. versionadded:: 4.15
+       :class:`humanfriendly.terminal.HTMLConverter` was added to the
+       `humanfriendly` package during the initial development of my new
+       `chat-archive <https://chat-archive.readthedocs.io/>`_ project, whose
+       command line interface makes for a great demonstration of the
+       flexibility that this feature provides (hint: check out how the search
+       keyword highlighting combines with the regular highlighting).
+    """
+
+    BLOCK_TAGS = ('div', 'p', 'pre')
+    """The names of tags that are padded with vertical whitespace."""
+
+    def __init__(self, *args, **kw):
+        """
+        Initialize an :class:`HTMLConverter` object.
+
+        :param callback: Optional keyword argument to specify a function that
+                         will be called to process text fragments before they
+                         are emitted on the output stream. Note that link text
+                         and preformatted text fragments are not processed by
+                         this callback.
+        :param output: Optional keyword argument to redirect the output to the
+                       given file-like object. If this is not given a new
+                       :class:`~python3:io.StringIO` object is created.
+        """
+        # Hide our optional keyword arguments from the superclass.
+        self.callback = kw.pop("callback", None)
+        self.output = kw.pop("output", None)
+        # Initialize the superclass.
+        HTMLParser.__init__(self, *args, **kw)
+
+    def __call__(self, data):
+        """
+        Reset the parser, convert some HTML and get the text with ANSI escape sequences.
+
+        :param data: The HTML to convert to text (a string).
+        :returns: The converted text (only in case `output` is
+                  a :class:`~python3:io.StringIO` object).
+        """
+        self.reset()
+        self.feed(data)
+        self.close()
+        if isinstance(self.output, StringIO):
+            return compact_empty_lines(self.output.getvalue())
+
+    @property
+    def current_style(self):
+        """Get the current style from the top of the stack (a dictionary)."""
+        return self.stack[-1] if self.stack else {}
+
+    def close(self):
+        """
+        Close previously opened ANSI escape sequences.
+
+        This method overrides the same method in the superclass to ensure that
+        an :data:`.ANSI_RESET` code is emitted when parsing reaches the end of
+        the input but a style is still active. This is intended to prevent
+        malformed HTML from messing up terminal output.
+        """
+        if any(self.stack):
+            self.output.write(ANSI_RESET)
+            self.stack = []
+        HTMLParser.close(self)
+
+    def emit_style(self, style=None):
+        """
+        Emit an ANSI escape sequence for the given or current style to the output stream.
+
+        :param style: A dictionary with arguments for :func:`.ansi_style()` or
+                      :data:`None`, in which case the style at the top of the
+                      stack is emitted.
+        """
+        # Clear the current text styles.
+        self.output.write(ANSI_RESET)
+        # Apply a new text style?
+        style = self.current_style if style is None else style
+        if style:
+            self.output.write(ansi_style(**style))
+
+    def handle_charref(self, value):
+        """
+        Process a decimal or hexadecimal numeric character reference.
+
+        :param value: The decimal or hexadecimal value (a string).
+        """
+        self.output.write(unichr(int(value[1:], 16) if value.startswith('x') else int(value)))
+
+    def handle_data(self, data):
+        """
+        Process textual data.
+
+        :param data: The decoded text (a string).
+        """
+        if self.link_url:
+            # Link text is captured literally so that we can reliably check
+            # whether the text and the URL of the link are the same string.
+            self.link_text = data
+        elif self.callback and self.preformatted_text_level == 0:
+            # Text that is not part of a link and not preformatted text is
+            # passed to the user defined callback to allow for arbitrary
+            # pre-processing.
+            data = self.callback(data)
+        # All text is emitted unmodified on the output stream.
+        self.output.write(data)
+
+    def handle_endtag(self, tag):
+        """
+        Process the end of an HTML tag.
+
+        :param tag: The name of the tag (a string).
+        """
+        if tag in ('a', 'b', 'code', 'del', 'em', 'i', 'ins', 'pre', 's', 'strong', 'span', 'u'):
+            old_style = self.current_style
+            # The following conditional isn't necessary for well formed
+            # HTML but prevents raising exceptions on malformed HTML.
+            if self.stack:
+                self.stack.pop(-1)
+            new_style = self.current_style
+            if tag == 'a':
+                if self.urls_match(self.link_text, self.link_url):
+                    # Don't render the URL when it's part of the link text.
+                    self.emit_style(new_style)
+                else:
+                    self.emit_style(new_style)
+                    self.output.write(' (')
+                    self.emit_style(old_style)
+                    self.output.write(self.render_url(self.link_url))
+                    self.emit_style(new_style)
+                    self.output.write(')')
+            else:
+                self.emit_style(new_style)
+            if tag in ('code', 'pre'):
+                self.preformatted_text_level -= 1
+        if tag in self.BLOCK_TAGS:
+            # Emit an empty line after block level tags.
+            self.output.write('\n\n')
+
+    def handle_entityref(self, name):
+        """
+        Process a named character reference.
+
+        :param name: The name of the character reference (a string).
+        """
+        self.output.write(unichr(name2codepoint[name]))
+
+    def handle_starttag(self, tag, attrs):
+        """
+        Process the start of an HTML tag.
+
+        :param tag: The name of the tag (a string).
+        :param attrs: A list of tuples with two strings each.
+        """
+        if tag in self.BLOCK_TAGS:
+            # Emit an empty line before block level tags.
+            self.output.write('\n\n')
+        if tag == 'a':
+            self.push_styles(color='blue', bright=True, underline=True)
+            # Store the URL that the link points to for later use, so that we
+            # can render the link text before the URL (with the reasoning that
+            # this is the most intuitive way to present a link in a plain text
+            # interface).
+            self.link_url = next((v for n, v in attrs if n == 'href'), '')
+        elif tag == 'b' or tag == 'strong':
+            self.push_styles(bold=True)
+        elif tag == 'br':
+            self.output.write('\n')
+        elif tag == 'code' or tag == 'pre':
+            self.push_styles(color='yellow')
+            self.preformatted_text_level += 1
+        elif tag == 'del' or tag == 's':
+            self.push_styles(strike_through=True)
+        elif tag == 'em' or tag == 'i':
+            self.push_styles(italic=True)
+        elif tag == 'ins' or tag == 'u':
+            self.push_styles(underline=True)
+        elif tag == 'span':
+            styles = {}
+            css = next((v for n, v in attrs if n == 'style'), "")
+            for rule in css.split(';'):
+                name, _, value = rule.partition(':')
+                name = name.strip()
+                value = value.strip()
+                if name == 'background-color':
+                    styles['background'] = self.parse_color(value)
+                elif name == 'color':
+                    styles['color'] = self.parse_color(value)
+                elif name == 'font-style' and value == 'italic':
+                    styles['italic'] = True
+                elif name == 'font-weight' and value == 'bold':
+                    styles['bold'] = True
+                elif name == 'text-decoration' and value == 'line-through':
+                    styles['strike_through'] = True
+                elif name == 'text-decoration' and value == 'underline':
+                    styles['underline'] = True
+            self.push_styles(**styles)
+
+    def normalize_url(self, url):
+        """
+        Normalize a URL to enable string equality comparison.
+
+        :param url: The URL to normalize (a string).
+        :returns: The normalized URL (a string).
+        """
+        return re.sub('^mailto:', '', url)
+
+    def parse_color(self, value):
+        """
+        Convert a CSS color to something that :func:`.ansi_style()` understands.
+
+        :param value: A string like ``rgb(1,2,3)``, ``#AABBCC`` or ``yellow``.
+        :returns: A color value supported by :func:`.ansi_style()` or :data:`None`.
+        """
+        # Parse an 'rgb(N,N,N)' expression.
+        if value.startswith('rgb'):
+            tokens = re.findall(r'\d+', value)
+            if len(tokens) == 3:
+                return tuple(map(int, tokens))
+        # Parse an '#XXXXXX' expression.
+        elif value.startswith('#'):
+            value = value[1:]
+            length = len(value)
+            if length == 6:
+                # Six hex digits (proper notation).
+                return (
+                    int(value[:2], 16),
+                    int(value[2:4], 16),
+                    int(value[4:6], 16),
+                )
+            elif length == 3:
+                # Three hex digits (shorthand).
+                return (
+                    int(value[0], 16),
+                    int(value[1], 16),
+                    int(value[2], 16),
+                )
+        # Try to recognize a named color.
+        value = value.lower()
+        if value in ANSI_COLOR_CODES:
+            return value
+
+    def push_styles(self, **changes):
+        """
+        Push new style information onto the stack.
+
+        :param changes: Any keyword arguments are passed on to :func:`.ansi_style()`.
+
+        This method is a helper for :func:`handle_starttag()`
+        that does the following:
+
+        1. Make a copy of the current styles (from the top of the stack),
+        2. Apply the given `changes` to the copy of the current styles,
+        3. Add the new styles to the stack,
+        4. Emit the appropriate ANSI escape sequence to the output stream.
+        """
+        prototype = self.current_style
+        if prototype:
+            new_style = dict(prototype)
+            new_style.update(changes)
+        else:
+            new_style = changes
+        self.stack.append(new_style)
+        self.emit_style(new_style)
+
+    def render_url(self, url):
+        """
+        Prepare a URL for rendering on the terminal.
+
+        :param url: The URL to simplify (a string).
+        :returns: The simplified URL (a string).
+
+        This method pre-processes a URL before rendering on the terminal. The
+        following modifications are made:
+
+        - The ``mailto:`` prefix is stripped.
+        - Spaces are converted to ``%20``.
+        - A trailing parenthesis is converted to ``%29``.
+        """
+        url = re.sub('^mailto:', '', url)
+        url = re.sub(' ', '%20', url)
+        url = re.sub(r'\)$', '%29', url)
+        return url
+
+    def reset(self):
+        """
+        Reset the state of the HTML parser and ANSI converter.
+
+        When `output` is a :class:`~python3:io.StringIO` object a new
+        instance will be created (and the old one garbage collected).
+        """
+        # Reset the state of the superclass.
+        HTMLParser.reset(self)
+        # Reset our instance variables.
+        self.link_text = None
+        self.link_url = None
+        self.preformatted_text_level = 0
+        if self.output is None or isinstance(self.output, StringIO):
+            # If the caller specified something like output=sys.stdout then it
+            # doesn't make much sense to negate that choice here in reset().
+            self.output = StringIO()
+        self.stack = []
+
+    def urls_match(self, a, b):
+        """
+        Compare two URLs for equality using :func:`normalize_url()`.
+
+        :param a: A string containing a URL.
+        :param b: A string containing a URL.
+        :returns: :data:`True` if the URLs are the same, :data:`False` otherwise.
+
+        This method is used by :func:`handle_endtag()` to omit the URL of a
+        hyperlink (``<a href="...">``) when the link text is that same URL.
+        """
+        return self.normalize_url(a) == self.normalize_url(b)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/spinners.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/spinners.py
new file mode 100644
index 0000000000000000000000000000000000000000..e4dc55d3026790bf0b5e3e5f48f88373868804b5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/terminal/spinners.py
@@ -0,0 +1,310 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 1, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Support for spinners that represent progress on interactive terminals.
+
+The :class:`Spinner` class shows a "spinner" on the terminal to let the user
+know that something is happening during long running operations that would
+otherwise be silent (leaving the user to wonder what they're waiting for).
+Below are some visual examples that should illustrate the point.
+
+**Simple spinners:**
+
+ Here's a screen capture that shows the simplest form of spinner:
+
+  .. image:: images/spinner-basic.gif
+     :alt: Animated screen capture of a simple spinner.
+
+ The following code was used to create the spinner above:
+
+ .. code-block:: python
+
+    import itertools
+    import time
+    from humanfriendly import Spinner
+
+    with Spinner(label="Downloading") as spinner:
+        for i in itertools.count():
+            # Do something useful here.
+            time.sleep(0.1)
+            # Advance the spinner.
+            spinner.step()
+
+**Spinners that show elapsed time:**
+
+ Here's a spinner that shows the elapsed time since it started:
+
+  .. image:: images/spinner-with-timer.gif
+     :alt: Animated screen capture of a spinner showing elapsed time.
+
+ The following code was used to create the spinner above:
+
+ .. code-block:: python
+
+    import itertools
+    import time
+    from humanfriendly import Spinner, Timer
+
+    with Spinner(label="Downloading", timer=Timer()) as spinner:
+        for i in itertools.count():
+            # Do something useful here.
+            time.sleep(0.1)
+            # Advance the spinner.
+            spinner.step()
+
+**Spinners that show progress:**
+
+ Here's a spinner that shows a progress percentage:
+
+  .. image:: images/spinner-with-progress.gif
+     :alt: Animated screen capture of spinner showing progress.
+
+ The following code was used to create the spinner above:
+
+ .. code-block:: python
+
+    import itertools
+    import random
+    import time
+    from humanfriendly import Spinner, Timer
+
+    with Spinner(label="Downloading", total=100) as spinner:
+        progress = 0
+        while progress < 100:
+            # Do something useful here.
+            time.sleep(0.1)
+            # Advance the spinner.
+            spinner.step(progress)
+            # Determine the new progress value.
+            progress += random.random() * 5
+
+If you want to provide user feedback during a long running operation but it's
+not practical to periodically call the :func:`~Spinner.step()` method consider
+using :class:`AutomaticSpinner` instead.
+
+As you may already have noticed in the examples above, :class:`Spinner` objects
+can be used as context managers to automatically call :func:`Spinner.clear()`
+when the spinner ends.
+"""
+
+# Standard library modules.
+import multiprocessing
+import sys
+import time
+
+# Modules included in our package.
+from humanfriendly import Timer
+from humanfriendly.deprecation import deprecated_args
+from humanfriendly.terminal import ANSI_ERASE_LINE
+
+# Public identifiers that require documentation.
+__all__ = ("AutomaticSpinner", "GLYPHS", "MINIMUM_INTERVAL", "Spinner")
+
+GLYPHS = ["-", "\\", "|", "/"]
+"""A list of strings with characters that together form a crude animation :-)."""
+
+MINIMUM_INTERVAL = 0.2
+"""Spinners are redrawn with a frequency no higher than this number (a floating point number of seconds)."""
+
+
+class Spinner(object):
+
+    """Show a spinner on the terminal as a simple means of feedback to the user."""
+
+    @deprecated_args('label', 'total', 'stream', 'interactive', 'timer')
+    def __init__(self, **options):
+        """
+        Initialize a :class:`Spinner` object.
+
+        :param label:
+
+          The label for the spinner (a string or :data:`None`, defaults to
+          :data:`None`).
+
+        :param total:
+
+          The expected number of steps (an integer or :data:`None`). If this is
+          provided the spinner will show a progress percentage.
+
+        :param stream:
+
+          The output stream to show the spinner on (a file-like object,
+          defaults to :data:`sys.stderr`).
+
+        :param interactive:
+
+          :data:`True` to enable rendering of the spinner, :data:`False` to
+          disable (defaults to the result of ``stream.isatty()``).
+
+        :param timer:
+
+          A :class:`.Timer` object (optional). If this is given the spinner
+          will show the elapsed time according to the timer.
+
+        :param interval:
+
+          The spinner will be updated at most once every this many seconds
+          (a floating point number, defaults to :data:`MINIMUM_INTERVAL`).
+
+        :param glyphs:
+
+          A list of strings with single characters that are drawn in the same
+          place in succession to implement a simple animated effect (defaults
+          to :data:`GLYPHS`).
+        """
+        # Store initializer arguments.
+        self.interactive = options.get('interactive')
+        self.interval = options.get('interval', MINIMUM_INTERVAL)
+        self.label = options.get('label')
+        self.states = options.get('glyphs', GLYPHS)
+        self.stream = options.get('stream', sys.stderr)
+        self.timer = options.get('timer')
+        self.total = options.get('total')
+        # Define instance variables.
+        self.counter = 0
+        self.last_update = 0
+        # Try to automatically discover whether the stream is connected to
+        # a terminal, but don't fail if no isatty() method is available.
+        if self.interactive is None:
+            try:
+                self.interactive = self.stream.isatty()
+            except Exception:
+                self.interactive = False
+
+    def step(self, progress=0, label=None):
+        """
+        Advance the spinner by one step and redraw it.
+
+        :param progress: The number of the current step, relative to the total
+                         given to the :class:`Spinner` constructor (an integer,
+                         optional). If not provided the spinner will not show
+                         progress.
+        :param label: The label to use while redrawing (a string, optional). If
+                      not provided the label given to the :class:`Spinner`
+                      constructor is used instead.
+
+        This method advances the spinner by one step without starting a new
+        line, causing an animated effect which is very simple but much nicer
+        than waiting for a prompt which is completely silent for a long time.
+
+        .. note:: This method uses time based rate limiting to avoid redrawing
+                  the spinner too frequently. If you know you're dealing with
+                  code that will call :func:`step()` at a high frequency,
+                  consider using :func:`sleep()` to avoid creating the
+                  equivalent of a busy loop that's rate limiting the spinner
+                  99% of the time.
+        """
+        if self.interactive:
+            time_now = time.time()
+            if time_now - self.last_update >= self.interval:
+                self.last_update = time_now
+                state = self.states[self.counter % len(self.states)]
+                label = label or self.label
+                if not label:
+                    raise Exception("No label set for spinner!")
+                elif self.total and progress:
+                    label = "%s: %.2f%%" % (label, progress / (self.total / 100.0))
+                elif self.timer and self.timer.elapsed_time > 2:
+                    label = "%s (%s)" % (label, self.timer.rounded)
+                self.stream.write("%s %s %s ..\r" % (ANSI_ERASE_LINE, state, label))
+                self.counter += 1
+
+    def sleep(self):
+        """
+        Sleep for a short period before redrawing the spinner.
+
+        This method is useful when you know you're dealing with code that will
+        call :func:`step()` at a high frequency. It will sleep for the interval
+        with which the spinner is redrawn (less than a second). This avoids
+        creating the equivalent of a busy loop that's rate limiting the
+        spinner 99% of the time.
+
+        This method doesn't redraw the spinner, you still have to call
+        :func:`step()` in order to do that.
+        """
+        time.sleep(MINIMUM_INTERVAL)
+
+    def clear(self):
+        """
+        Clear the spinner.
+
+        The next line which is shown on the standard output or error stream
+        after calling this method will overwrite the line that used to show the
+        spinner.
+        """
+        if self.interactive:
+            self.stream.write(ANSI_ERASE_LINE)
+
+    def __enter__(self):
+        """
+        Enable the use of spinners as context managers.
+
+        :returns: The :class:`Spinner` object.
+        """
+        return self
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Clear the spinner when leaving the context."""
+        self.clear()
+
+
+class AutomaticSpinner(object):
+
+    """
+    Show a spinner on the terminal that automatically starts animating.
+
+    This class shows a spinner on the terminal (just like :class:`Spinner`
+    does) that automatically starts animating. This class should be used as a
+    context manager using the :keyword:`with` statement. The animation
+    continues for as long as the context is active.
+
+    :class:`AutomaticSpinner` provides an alternative to :class:`Spinner`
+    for situations where it is not practical for the caller to periodically
+    call :func:`~Spinner.step()` to advance the animation, e.g. because
+    you're performing a blocking call and don't fancy implementing threading or
+    subprocess handling just to provide some user feedback.
+
+    This works using the :mod:`multiprocessing` module by spawning a
+    subprocess to render the spinner while the main process is busy doing
+    something more useful. By using the :keyword:`with` statement you're
+    guaranteed that the subprocess is properly terminated at the appropriate
+    time.
+    """
+
+    def __init__(self, label, show_time=True):
+        """
+        Initialize an automatic spinner.
+
+        :param label: The label for the spinner (a string).
+        :param show_time: If this is :data:`True` (the default) then the spinner
+                          shows elapsed time.
+        """
+        self.label = label
+        self.show_time = show_time
+        self.shutdown_event = multiprocessing.Event()
+        self.subprocess = multiprocessing.Process(target=self._target)
+
+    def __enter__(self):
+        """Enable the use of automatic spinners as context managers."""
+        self.subprocess.start()
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Enable the use of automatic spinners as context managers."""
+        self.shutdown_event.set()
+        self.subprocess.join()
+
+    def _target(self):
+        try:
+            timer = Timer() if self.show_time else None
+            with Spinner(label=self.label, timer=timer) as spinner:
+                while not self.shutdown_event.is_set():
+                    spinner.step()
+                    spinner.sleep()
+        except KeyboardInterrupt:
+            # Swallow Control-C signals without producing a nasty traceback that
+            # won't make any sense to the average user.
+            pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/testing.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/testing.py
new file mode 100644
index 0000000000000000000000000000000000000000..f6abddf07423faacdef2059601a9d52155c498e5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/testing.py
@@ -0,0 +1,669 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: March 6, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Utility classes and functions that make it easy to write :mod:`unittest` compatible test suites.
+
+Over the years I've developed the habit of writing test suites for Python
+projects using the :mod:`unittest` module. During those years I've come to know
+:pypi:`pytest` and in fact I use :pypi:`pytest` to run my test suites (due to
+its much better error reporting) but I've yet to publish a test suite that
+*requires* :pypi:`pytest`. I have several reasons for doing so:
+
+- It's nice to keep my test suites as simple and accessible as possible and
+  not requiring a specific test runner is part of that attitude.
+
+- Whereas :mod:`unittest` is quite explicit, :pypi:`pytest` contains a lot of
+  magic, which kind of contradicts the Python mantra "explicit is better than
+  implicit" (IMHO).
+"""
+
+# Standard library module
+import functools
+import logging
+import os
+import pipes
+import shutil
+import sys
+import tempfile
+import time
+import unittest
+
+# Modules included in our package.
+from humanfriendly.compat import StringIO
+from humanfriendly.text import random_string
+
+# Initialize a logger for this module.
+logger = logging.getLogger(__name__)
+
+# A unique object reference used to detect missing attributes.
+NOTHING = object()
+
+# Public identifiers that require documentation.
+__all__ = (
+    'CallableTimedOut',
+    'CaptureBuffer',
+    'CaptureOutput',
+    'ContextManager',
+    'CustomSearchPath',
+    'MockedProgram',
+    'PatchedAttribute',
+    'PatchedItem',
+    'TemporaryDirectory',
+    'TestCase',
+    'configure_logging',
+    'make_dirs',
+    'retry',
+    'run_cli',
+    'skip_on_raise',
+    'touch',
+)
+
+
+def configure_logging(log_level=logging.DEBUG):
+    """configure_logging(log_level=logging.DEBUG)
+    Automatically configure logging to the terminal.
+
+    :param log_level: The log verbosity (a number, defaults
+                      to :mod:`logging.DEBUG <logging>`).
+
+    When :mod:`coloredlogs` is installed :func:`coloredlogs.install()` will be
+    used to configure logging to the terminal. When this fails with an
+    :exc:`~exceptions.ImportError` then :func:`logging.basicConfig()` is used
+    as a fall back.
+    """
+    try:
+        import coloredlogs
+        coloredlogs.install(level=log_level)
+    except ImportError:
+        logging.basicConfig(
+            level=log_level,
+            format='%(asctime)s %(name)s[%(process)d] %(levelname)s %(message)s',
+            datefmt='%Y-%m-%d %H:%M:%S')
+
+
+def make_dirs(pathname):
+    """
+    Create missing directories.
+
+    :param pathname: The pathname of a directory (a string).
+    """
+    if not os.path.isdir(pathname):
+        os.makedirs(pathname)
+
+
+def retry(func, timeout=60, exc_type=AssertionError):
+    """retry(func, timeout=60, exc_type=AssertionError)
+    Retry a function until assertions no longer fail.
+
+    :param func: A callable. When the callable returns
+                 :data:`False` it will also be retried.
+    :param timeout: The number of seconds after which to abort (a number,
+                    defaults to 60).
+    :param exc_type: The type of exceptions to retry (defaults
+                     to :exc:`~exceptions.AssertionError`).
+    :returns: The value returned by `func`.
+    :raises: Once the timeout has expired :func:`retry()` will raise the
+             previously retried assertion error. When `func` keeps returning
+             :data:`False` until `timeout` expires :exc:`CallableTimedOut`
+             will be raised.
+
+    This function sleeps between retries to avoid claiming CPU cycles we don't
+    need. It starts by sleeping for 0.1 second but adjusts this to one second
+    as the number of retries grows.
+    """
+    pause = 0.1
+    timeout += time.time()
+    while True:
+        try:
+            result = func()
+            if result is not False:
+                return result
+        except exc_type:
+            if time.time() > timeout:
+                raise
+        else:
+            if time.time() > timeout:
+                raise CallableTimedOut()
+        time.sleep(pause)
+        if pause < 1:
+            pause *= 2
+
+
+def run_cli(entry_point, *arguments, **options):
+    """
+    Test a command line entry point.
+
+    :param entry_point: The function that implements the command line interface
+                        (a callable).
+    :param arguments: Any positional arguments (strings) become the command
+                      line arguments (:data:`sys.argv` items 1-N).
+    :param options: The following keyword arguments are supported:
+
+                    **capture**
+                     Whether to use :class:`CaptureOutput`. Defaults
+                     to :data:`True` but can be disabled by passing
+                     :data:`False` instead.
+                    **input**
+                     Refer to :class:`CaptureOutput`.
+                    **merged**
+                     Refer to :class:`CaptureOutput`.
+                    **program_name**
+                     Used to set :data:`sys.argv` item 0.
+    :returns: A tuple with two values:
+
+              1. The return code (an integer).
+              2. The captured output (a string).
+    """
+    # Add the `program_name' option to the arguments.
+    arguments = list(arguments)
+    arguments.insert(0, options.pop('program_name', sys.executable))
+    # Log the command line arguments (and the fact that we're about to call the
+    # command line entry point function).
+    logger.debug("Calling command line entry point with arguments: %s", arguments)
+    # Prepare to capture the return code and output even if the command line
+    # interface raises an exception (whether the exception type is SystemExit
+    # or something else).
+    returncode = 0
+    stdout = None
+    stderr = None
+    try:
+        # Temporarily override sys.argv.
+        with PatchedAttribute(sys, 'argv', arguments):
+            # Manipulate the standard input/output/error streams?
+            options['enabled'] = options.pop('capture', True)
+            with CaptureOutput(**options) as capturer:
+                try:
+                    # Call the command line interface.
+                    entry_point()
+                finally:
+                    # Get the output even if an exception is raised.
+                    stdout = capturer.stdout.getvalue()
+                    stderr = capturer.stderr.getvalue()
+                    # Reconfigure logging to the terminal because it is very
+                    # likely that the entry point function has changed the
+                    # configured log level.
+                    configure_logging()
+    except BaseException as e:
+        if isinstance(e, SystemExit):
+            logger.debug("Intercepting return code %s from SystemExit exception.", e.code)
+            returncode = e.code
+        else:
+            logger.warning("Defaulting return code to 1 due to raised exception.", exc_info=True)
+            returncode = 1
+    else:
+        logger.debug("Command line entry point returned successfully!")
+    # Always log the output captured on stdout/stderr, to make it easier to
+    # diagnose test failures (but avoid duplicate logging when merged=True).
+    is_merged = options.get('merged', False)
+    merged_streams = [('merged streams', stdout)]
+    separate_streams = [('stdout', stdout), ('stderr', stderr)]
+    streams = merged_streams if is_merged else separate_streams
+    for name, value in streams:
+        if value:
+            logger.debug("Output on %s:\n%s", name, value)
+        else:
+            logger.debug("No output on %s.", name)
+    return returncode, stdout
+
+
+def skip_on_raise(*exc_types):
+    """
+    Decorate a test function to translation specific exception types to :exc:`unittest.SkipTest`.
+
+    :param exc_types: One or more positional arguments give the exception
+                      types to be translated to :exc:`unittest.SkipTest`.
+    :returns: A decorator function specialized to `exc_types`.
+    """
+    def decorator(function):
+        @functools.wraps(function)
+        def wrapper(*args, **kw):
+            try:
+                return function(*args, **kw)
+            except exc_types as e:
+                logger.debug("Translating exception to unittest.SkipTest ..", exc_info=True)
+                raise unittest.SkipTest("skipping test because %s was raised" % type(e))
+        return wrapper
+    return decorator
+
+
+def touch(filename):
+    """
+    The equivalent of the UNIX :man:`touch` program in Python.
+
+    :param filename: The pathname of the file to touch (a string).
+
+    Note that missing directories are automatically created using
+    :func:`make_dirs()`.
+    """
+    make_dirs(os.path.dirname(filename))
+    with open(filename, 'a'):
+        os.utime(filename, None)
+
+
+class CallableTimedOut(Exception):
+
+    """Raised by :func:`retry()` when the timeout expires."""
+
+
+class ContextManager(object):
+
+    """Base class to enable composition of context managers."""
+
+    def __enter__(self):
+        """Enable use as context managers."""
+        return self
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Enable use as context managers."""
+
+
+class PatchedAttribute(ContextManager):
+
+    """Context manager that temporary replaces an object attribute using :func:`setattr()`."""
+
+    def __init__(self, obj, name, value):
+        """
+        Initialize a :class:`PatchedAttribute` object.
+
+        :param obj: The object to patch.
+        :param name: An attribute name.
+        :param value: The value to set.
+        """
+        self.object_to_patch = obj
+        self.attribute_to_patch = name
+        self.patched_value = value
+        self.original_value = NOTHING
+
+    def __enter__(self):
+        """
+        Replace (patch) the attribute.
+
+        :returns: The object whose attribute was patched.
+        """
+        # Enable composition of context managers.
+        super(PatchedAttribute, self).__enter__()
+        # Patch the object's attribute.
+        self.original_value = getattr(self.object_to_patch, self.attribute_to_patch, NOTHING)
+        setattr(self.object_to_patch, self.attribute_to_patch, self.patched_value)
+        return self.object_to_patch
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Restore the attribute to its original value."""
+        # Enable composition of context managers.
+        super(PatchedAttribute, self).__exit__(exc_type, exc_value, traceback)
+        # Restore the object's attribute.
+        if self.original_value is NOTHING:
+            delattr(self.object_to_patch, self.attribute_to_patch)
+        else:
+            setattr(self.object_to_patch, self.attribute_to_patch, self.original_value)
+
+
+class PatchedItem(ContextManager):
+
+    """Context manager that temporary replaces an object item using :meth:`~object.__setitem__()`."""
+
+    def __init__(self, obj, item, value):
+        """
+        Initialize a :class:`PatchedItem` object.
+
+        :param obj: The object to patch.
+        :param item: The item to patch.
+        :param value: The value to set.
+        """
+        self.object_to_patch = obj
+        self.item_to_patch = item
+        self.patched_value = value
+        self.original_value = NOTHING
+
+    def __enter__(self):
+        """
+        Replace (patch) the item.
+
+        :returns: The object whose item was patched.
+        """
+        # Enable composition of context managers.
+        super(PatchedItem, self).__enter__()
+        # Patch the object's item.
+        try:
+            self.original_value = self.object_to_patch[self.item_to_patch]
+        except KeyError:
+            self.original_value = NOTHING
+        self.object_to_patch[self.item_to_patch] = self.patched_value
+        return self.object_to_patch
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Restore the item to its original value."""
+        # Enable composition of context managers.
+        super(PatchedItem, self).__exit__(exc_type, exc_value, traceback)
+        # Restore the object's item.
+        if self.original_value is NOTHING:
+            del self.object_to_patch[self.item_to_patch]
+        else:
+            self.object_to_patch[self.item_to_patch] = self.original_value
+
+
+class TemporaryDirectory(ContextManager):
+
+    """
+    Easy temporary directory creation & cleanup using the :keyword:`with` statement.
+
+    Here's an example of how to use this:
+
+    .. code-block:: python
+
+       with TemporaryDirectory() as directory:
+           # Do something useful here.
+           assert os.path.isdir(directory)
+    """
+
+    def __init__(self, **options):
+        """
+        Initialize a :class:`TemporaryDirectory` object.
+
+        :param options: Any keyword arguments are passed on to
+                        :func:`tempfile.mkdtemp()`.
+        """
+        self.mkdtemp_options = options
+        self.temporary_directory = None
+
+    def __enter__(self):
+        """
+        Create the temporary directory using :func:`tempfile.mkdtemp()`.
+
+        :returns: The pathname of the directory (a string).
+        """
+        # Enable composition of context managers.
+        super(TemporaryDirectory, self).__enter__()
+        # Create the temporary directory.
+        self.temporary_directory = tempfile.mkdtemp(**self.mkdtemp_options)
+        return self.temporary_directory
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Cleanup the temporary directory using :func:`shutil.rmtree()`."""
+        # Enable composition of context managers.
+        super(TemporaryDirectory, self).__exit__(exc_type, exc_value, traceback)
+        # Cleanup the temporary directory.
+        if self.temporary_directory is not None:
+            shutil.rmtree(self.temporary_directory)
+            self.temporary_directory = None
+
+
+class MockedHomeDirectory(PatchedItem, TemporaryDirectory):
+
+    """
+    Context manager to temporarily change ``$HOME`` (the current user's profile directory).
+
+    This class is a composition of the :class:`PatchedItem` and
+    :class:`TemporaryDirectory` context managers.
+    """
+
+    def __init__(self):
+        """Initialize a :class:`MockedHomeDirectory` object."""
+        PatchedItem.__init__(self, os.environ, 'HOME', os.environ.get('HOME'))
+        TemporaryDirectory.__init__(self)
+
+    def __enter__(self):
+        """
+        Activate the custom ``$PATH``.
+
+        :returns: The pathname of the directory that has
+                  been added to ``$PATH`` (a string).
+        """
+        # Get the temporary directory.
+        directory = TemporaryDirectory.__enter__(self)
+        # Override the value to patch now that we have
+        # the pathname of the temporary directory.
+        self.patched_value = directory
+        # Temporary patch $HOME.
+        PatchedItem.__enter__(self)
+        # Pass the pathname of the temporary directory to the caller.
+        return directory
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Deactivate the custom ``$HOME``."""
+        super(MockedHomeDirectory, self).__exit__(exc_type, exc_value, traceback)
+
+
+class CustomSearchPath(PatchedItem, TemporaryDirectory):
+
+    """
+    Context manager to temporarily customize ``$PATH`` (the executable search path).
+
+    This class is a composition of the :class:`PatchedItem` and
+    :class:`TemporaryDirectory` context managers.
+    """
+
+    def __init__(self, isolated=False):
+        """
+        Initialize a :class:`CustomSearchPath` object.
+
+        :param isolated: :data:`True` to clear the original search path,
+                         :data:`False` to add the temporary directory to the
+                         start of the search path.
+        """
+        # Initialize our own instance variables.
+        self.isolated_search_path = isolated
+        # Selectively initialize our superclasses.
+        PatchedItem.__init__(self, os.environ, 'PATH', self.current_search_path)
+        TemporaryDirectory.__init__(self)
+
+    def __enter__(self):
+        """
+        Activate the custom ``$PATH``.
+
+        :returns: The pathname of the directory that has
+                  been added to ``$PATH`` (a string).
+        """
+        # Get the temporary directory.
+        directory = TemporaryDirectory.__enter__(self)
+        # Override the value to patch now that we have
+        # the pathname of the temporary directory.
+        self.patched_value = (
+            directory if self.isolated_search_path
+            else os.pathsep.join([directory] + self.current_search_path.split(os.pathsep))
+        )
+        # Temporary patch the $PATH.
+        PatchedItem.__enter__(self)
+        # Pass the pathname of the temporary directory to the caller
+        # because they may want to `install' custom executables.
+        return directory
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Deactivate the custom ``$PATH``."""
+        super(CustomSearchPath, self).__exit__(exc_type, exc_value, traceback)
+
+    @property
+    def current_search_path(self):
+        """The value of ``$PATH`` or :data:`os.defpath` (a string)."""
+        return os.environ.get('PATH', os.defpath)
+
+
+class MockedProgram(CustomSearchPath):
+
+    """
+    Context manager to mock the existence of a program (executable).
+
+    This class extends the functionality of :class:`CustomSearchPath`.
+    """
+
+    def __init__(self, name, returncode=0, script=None):
+        """
+        Initialize a :class:`MockedProgram` object.
+
+        :param name: The name of the program (a string).
+        :param returncode: The return code that the program should emit (a
+                           number, defaults to zero).
+        :param script: Shell script code to include in the mocked program (a
+                       string or :data:`None`). This can be used to mock a
+                       program that is expected to generate specific output.
+        """
+        # Initialize our own instance variables.
+        self.program_name = name
+        self.program_returncode = returncode
+        self.program_script = script
+        self.program_signal_file = None
+        # Initialize our superclasses.
+        super(MockedProgram, self).__init__()
+
+    def __enter__(self):
+        """
+        Create the mock program.
+
+        :returns: The pathname of the directory that has
+                  been added to ``$PATH`` (a string).
+        """
+        directory = super(MockedProgram, self).__enter__()
+        self.program_signal_file = os.path.join(directory, 'program-was-run-%s' % random_string(10))
+        pathname = os.path.join(directory, self.program_name)
+        with open(pathname, 'w') as handle:
+            handle.write('#!/bin/sh\n')
+            handle.write('echo > %s\n' % pipes.quote(self.program_signal_file))
+            if self.program_script:
+                handle.write('%s\n' % self.program_script.strip())
+            handle.write('exit %i\n' % self.program_returncode)
+        os.chmod(pathname, 0o755)
+        return directory
+
+    def __exit__(self, *args, **kw):
+        """
+        Ensure that the mock program was run.
+
+        :raises: :exc:`~exceptions.AssertionError` when
+                 the mock program hasn't been run.
+        """
+        try:
+            assert self.program_signal_file and os.path.isfile(self.program_signal_file), \
+                ("It looks like %r was never run!" % self.program_name)
+        finally:
+            return super(MockedProgram, self).__exit__(*args, **kw)
+
+
+class CaptureOutput(ContextManager):
+
+    """
+    Context manager that captures what's written to :data:`sys.stdout` and :data:`sys.stderr`.
+
+    .. attribute:: stdin
+
+       The :class:`~humanfriendly.compat.StringIO` object used to feed the standard input stream.
+
+    .. attribute:: stdout
+
+       The :class:`CaptureBuffer` object used to capture the standard output stream.
+
+    .. attribute:: stderr
+
+       The :class:`CaptureBuffer` object used to capture the standard error stream.
+    """
+
+    def __init__(self, merged=False, input='', enabled=True):
+        """
+        Initialize a :class:`CaptureOutput` object.
+
+        :param merged: :data:`True` to merge the streams,
+                       :data:`False` to capture them separately.
+        :param input: The data that reads from :data:`sys.stdin`
+                      should return (a string).
+        :param enabled: :data:`True` to enable capturing (the default),
+                        :data:`False` otherwise. This makes it easy to
+                        unconditionally use :class:`CaptureOutput` in
+                        a :keyword:`with` block while preserving the
+                        choice to opt out of capturing output.
+        """
+        self.stdin = StringIO(input)
+        self.stdout = CaptureBuffer()
+        self.stderr = self.stdout if merged else CaptureBuffer()
+        self.patched_attributes = []
+        if enabled:
+            self.patched_attributes.extend(
+                PatchedAttribute(sys, name, getattr(self, name))
+                for name in ('stdin', 'stdout', 'stderr')
+            )
+
+    def __enter__(self):
+        """Start capturing what's written to :data:`sys.stdout` and :data:`sys.stderr`."""
+        super(CaptureOutput, self).__enter__()
+        for context in self.patched_attributes:
+            context.__enter__()
+        return self
+
+    def __exit__(self, exc_type=None, exc_value=None, traceback=None):
+        """Stop capturing what's written to :data:`sys.stdout` and :data:`sys.stderr`."""
+        super(CaptureOutput, self).__exit__(exc_type, exc_value, traceback)
+        for context in self.patched_attributes:
+            context.__exit__(exc_type, exc_value, traceback)
+
+    def get_lines(self):
+        """Get the contents of :attr:`stdout` split into separate lines."""
+        return self.get_text().splitlines()
+
+    def get_text(self):
+        """Get the contents of :attr:`stdout` as a Unicode string."""
+        return self.stdout.get_text()
+
+    def getvalue(self):
+        """Get the text written to :data:`sys.stdout`."""
+        return self.stdout.getvalue()
+
+
+class CaptureBuffer(StringIO):
+
+    """
+    Helper for :class:`CaptureOutput` to provide an easy to use API.
+
+    The two methods defined by this subclass were specifically chosen to match
+    the names of the methods provided by my :pypi:`capturer` package which
+    serves a similar role as :class:`CaptureOutput` but knows how to simulate
+    an interactive terminal (tty).
+    """
+
+    def get_lines(self):
+        """Get the contents of the buffer split into separate lines."""
+        return self.get_text().splitlines()
+
+    def get_text(self):
+        """Get the contents of the buffer as a Unicode string."""
+        return self.getvalue()
+
+
+class TestCase(unittest.TestCase):
+
+    """Subclass of :class:`unittest.TestCase` with automatic logging and other miscellaneous features."""
+
+    def __init__(self, *args, **kw):
+        """
+        Initialize a :class:`TestCase` object.
+
+        Any positional and/or keyword arguments are passed on to the
+        initializer of the superclass.
+        """
+        super(TestCase, self).__init__(*args, **kw)
+
+    def setUp(self, log_level=logging.DEBUG):
+        """setUp(log_level=logging.DEBUG)
+        Automatically configure logging to the terminal.
+
+        :param log_level: Refer to :func:`configure_logging()`.
+
+        The :func:`setUp()` method is automatically called by
+        :class:`unittest.TestCase` before each test method starts.
+        It does two things:
+
+        - Logging to the terminal is configured using
+          :func:`configure_logging()`.
+
+        - Before the test method starts a newline is emitted, to separate the
+          name of the test method (which will be printed to the terminal by
+          :mod:`unittest` or :pypi:`pytest`) from the first line of logging
+          output that the test method is likely going to generate.
+        """
+        # Configure logging to the terminal.
+        configure_logging(log_level)
+        # Separate the name of the test method (printed by the superclass
+        # and/or py.test without a newline at the end) from the first line of
+        # logging output that the test method is likely going to generate.
+        sys.stderr.write("\n")
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tests.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tests.py
new file mode 100644
index 0000000000000000000000000000000000000000..72dad996b9f4623efbcd5161c160ebaf61c6fa4d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/tests.py
@@ -0,0 +1,1495 @@
+#!/usr/bin/env python
+# vim: fileencoding=utf-8 :
+
+# Tests for the `humanfriendly' package.
+#
+# Author: Peter Odding <peter.odding@paylogic.eu>
+# Last Change: June 11, 2021
+# URL: https://humanfriendly.readthedocs.io
+
+"""Test suite for the `humanfriendly` package."""
+
+# Standard library modules.
+import datetime
+import math
+import os
+import random
+import re
+import subprocess
+import sys
+import time
+import types
+import unittest
+import warnings
+
+# Modules included in our package.
+from humanfriendly import (
+    InvalidDate,
+    InvalidLength,
+    InvalidSize,
+    InvalidTimespan,
+    Timer,
+    coerce_boolean,
+    coerce_pattern,
+    format_length,
+    format_number,
+    format_path,
+    format_size,
+    format_timespan,
+    parse_date,
+    parse_length,
+    parse_path,
+    parse_size,
+    parse_timespan,
+    prompts,
+    round_number,
+)
+from humanfriendly.case import CaseInsensitiveDict, CaseInsensitiveKey
+from humanfriendly.cli import main
+from humanfriendly.compat import StringIO
+from humanfriendly.decorators import cached
+from humanfriendly.deprecation import DeprecationProxy, define_aliases, deprecated_args, get_aliases
+from humanfriendly.prompts import (
+    TooManyInvalidReplies,
+    prompt_for_confirmation,
+    prompt_for_choice,
+    prompt_for_input,
+)
+from humanfriendly.sphinx import (
+    deprecation_note_callback,
+    man_role,
+    pypi_role,
+    setup,
+    special_methods_callback,
+    usage_message_callback,
+)
+from humanfriendly.tables import (
+    format_pretty_table,
+    format_robust_table,
+    format_rst_table,
+    format_smart_table,
+)
+from humanfriendly.terminal import (
+    ANSI_CSI,
+    ANSI_ERASE_LINE,
+    ANSI_HIDE_CURSOR,
+    ANSI_RESET,
+    ANSI_SGR,
+    ANSI_SHOW_CURSOR,
+    ansi_strip,
+    ansi_style,
+    ansi_width,
+    ansi_wrap,
+    clean_terminal_output,
+    connected_to_terminal,
+    find_terminal_size,
+    get_pager_command,
+    message,
+    output,
+    show_pager,
+    terminal_supports_colors,
+    warning,
+)
+from humanfriendly.terminal.html import html_to_ansi
+from humanfriendly.terminal.spinners import AutomaticSpinner, Spinner
+from humanfriendly.testing import (
+    CallableTimedOut,
+    CaptureOutput,
+    MockedProgram,
+    PatchedAttribute,
+    PatchedItem,
+    TemporaryDirectory,
+    TestCase,
+    retry,
+    run_cli,
+    skip_on_raise,
+    touch,
+)
+from humanfriendly.text import (
+    compact,
+    compact_empty_lines,
+    concatenate,
+    dedent,
+    generate_slug,
+    pluralize,
+    random_string,
+    trim_empty_lines,
+)
+from humanfriendly.usage import (
+    find_meta_variables,
+    format_usage,
+    parse_usage,
+    render_usage,
+)
+
+# Test dependencies.
+from mock import MagicMock
+
+
+class HumanFriendlyTestCase(TestCase):
+
+    """Container for the `humanfriendly` test suite."""
+
+    def test_case_insensitive_dict(self):
+        """Test the CaseInsensitiveDict class."""
+        # Test support for the dict(iterable) signature.
+        assert len(CaseInsensitiveDict([('key', True), ('KEY', False)])) == 1
+        # Test support for the dict(iterable, **kw) signature.
+        assert len(CaseInsensitiveDict([('one', True), ('ONE', False)], one=False, two=True)) == 2
+        # Test support for the dict(mapping) signature.
+        assert len(CaseInsensitiveDict(dict(key=True, KEY=False))) == 1
+        # Test support for the dict(mapping, **kw) signature.
+        assert len(CaseInsensitiveDict(dict(one=True, ONE=False), one=False, two=True)) == 2
+        # Test support for the dict(**kw) signature.
+        assert len(CaseInsensitiveDict(one=True, ONE=False, two=True)) == 2
+        # Test support for dict.fromkeys().
+        obj = CaseInsensitiveDict.fromkeys(["One", "one", "ONE", "Two", "two", "TWO"])
+        assert len(obj) == 2
+        # Test support for dict.get().
+        obj = CaseInsensitiveDict(existing_key=42)
+        assert obj.get('Existing_Key') == 42
+        # Test support for dict.pop().
+        obj = CaseInsensitiveDict(existing_key=42)
+        assert obj.pop('Existing_Key') == 42
+        assert len(obj) == 0
+        # Test support for dict.setdefault().
+        obj = CaseInsensitiveDict(existing_key=42)
+        assert obj.setdefault('Existing_Key') == 42
+        obj.setdefault('other_key', 11)
+        assert obj['Other_Key'] == 11
+        # Test support for dict.__contains__().
+        obj = CaseInsensitiveDict(existing_key=42)
+        assert 'Existing_Key' in obj
+        # Test support for dict.__delitem__().
+        obj = CaseInsensitiveDict(existing_key=42)
+        del obj['Existing_Key']
+        assert len(obj) == 0
+        # Test support for dict.__getitem__().
+        obj = CaseInsensitiveDict(existing_key=42)
+        assert obj['Existing_Key'] == 42
+        # Test support for dict.__setitem__().
+        obj = CaseInsensitiveDict(existing_key=42)
+        obj['Existing_Key'] = 11
+        assert obj['existing_key'] == 11
+
+    def test_case_insensitive_key(self):
+        """Test the CaseInsensitiveKey class."""
+        # Test the __eq__() special method.
+        polite = CaseInsensitiveKey("Please don't shout")
+        rude = CaseInsensitiveKey("PLEASE DON'T SHOUT")
+        assert polite == rude
+        # Test the __hash__() special method.
+        mapping = {}
+        mapping[polite] = 1
+        mapping[rude] = 2
+        assert len(mapping) == 1
+
+    def test_capture_output(self):
+        """Test the CaptureOutput class."""
+        with CaptureOutput() as capturer:
+            sys.stdout.write("Something for stdout.\n")
+            sys.stderr.write("And for stderr.\n")
+            assert capturer.stdout.get_lines() == ["Something for stdout."]
+            assert capturer.stderr.get_lines() == ["And for stderr."]
+
+    def test_skip_on_raise(self):
+        """Test the skip_on_raise() decorator."""
+        def test_fn():
+            raise NotImplementedError()
+        decorator_fn = skip_on_raise(NotImplementedError)
+        decorated_fn = decorator_fn(test_fn)
+        self.assertRaises(NotImplementedError, test_fn)
+        self.assertRaises(unittest.SkipTest, decorated_fn)
+
+    def test_retry_raise(self):
+        """Test :func:`~humanfriendly.testing.retry()` based on assertion errors."""
+        # Define a helper function that will raise an assertion error on the
+        # first call and return a string on the second call.
+        def success_helper():
+            if not hasattr(success_helper, 'was_called'):
+                setattr(success_helper, 'was_called', True)
+                assert False
+            else:
+                return 'yes'
+        assert retry(success_helper) == 'yes'
+
+        # Define a helper function that always raises an assertion error.
+        def failure_helper():
+            assert False
+        with self.assertRaises(AssertionError):
+            retry(failure_helper, timeout=1)
+
+    def test_retry_return(self):
+        """Test :func:`~humanfriendly.testing.retry()` based on return values."""
+        # Define a helper function that will return False on the first call and
+        # return a number on the second call.
+        def success_helper():
+            if not hasattr(success_helper, 'was_called'):
+                # On the first call we return False.
+                setattr(success_helper, 'was_called', True)
+                return False
+            else:
+                # On the second call we return a number.
+                return 42
+        assert retry(success_helper) == 42
+        with self.assertRaises(CallableTimedOut):
+            retry(lambda: False, timeout=1)
+
+    def test_mocked_program(self):
+        """Test :class:`humanfriendly.testing.MockedProgram`."""
+        name = random_string()
+        script = dedent('''
+            # This goes to stdout.
+            tr a-z A-Z
+            # This goes to stderr.
+            echo Fake warning >&2
+        ''')
+        with MockedProgram(name=name, returncode=42, script=script) as directory:
+            assert os.path.isdir(directory)
+            assert os.path.isfile(os.path.join(directory, name))
+            program = subprocess.Popen(name, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+            stdout, stderr = program.communicate(input=b'hello world\n')
+            assert program.returncode == 42
+            assert stdout == b'HELLO WORLD\n'
+            assert stderr == b'Fake warning\n'
+
+    def test_temporary_directory(self):
+        """Test :class:`humanfriendly.testing.TemporaryDirectory`."""
+        with TemporaryDirectory() as directory:
+            assert os.path.isdir(directory)
+            temporary_file = os.path.join(directory, 'some-file')
+            with open(temporary_file, 'w') as handle:
+                handle.write("Hello world!")
+        assert not os.path.exists(temporary_file)
+        assert not os.path.exists(directory)
+
+    def test_touch(self):
+        """Test :func:`humanfriendly.testing.touch()`."""
+        with TemporaryDirectory() as directory:
+            # Create a file in the temporary directory.
+            filename = os.path.join(directory, random_string())
+            assert not os.path.isfile(filename)
+            touch(filename)
+            assert os.path.isfile(filename)
+            # Create a file in a subdirectory.
+            filename = os.path.join(directory, random_string(), random_string())
+            assert not os.path.isfile(filename)
+            touch(filename)
+            assert os.path.isfile(filename)
+
+    def test_patch_attribute(self):
+        """Test :class:`humanfriendly.testing.PatchedAttribute`."""
+        class Subject(object):
+            my_attribute = 42
+        instance = Subject()
+        assert instance.my_attribute == 42
+        with PatchedAttribute(instance, 'my_attribute', 13) as return_value:
+            assert return_value is instance
+            assert instance.my_attribute == 13
+        assert instance.my_attribute == 42
+
+    def test_patch_item(self):
+        """Test :class:`humanfriendly.testing.PatchedItem`."""
+        instance = dict(my_item=True)
+        assert instance['my_item'] is True
+        with PatchedItem(instance, 'my_item', False) as return_value:
+            assert return_value is instance
+            assert instance['my_item'] is False
+        assert instance['my_item'] is True
+
+    def test_run_cli_intercepts_exit(self):
+        """Test that run_cli() intercepts SystemExit."""
+        returncode, output = run_cli(lambda: sys.exit(42))
+        self.assertEqual(returncode, 42)
+
+    def test_run_cli_intercepts_error(self):
+        """Test that run_cli() intercepts exceptions."""
+        returncode, output = run_cli(self.run_cli_raise_other)
+        self.assertEqual(returncode, 1)
+
+    def run_cli_raise_other(self):
+        """run_cli() sample that raises an exception."""
+        raise ValueError()
+
+    def test_run_cli_intercepts_output(self):
+        """Test that run_cli() intercepts output."""
+        expected_output = random_string() + "\n"
+        returncode, output = run_cli(lambda: sys.stdout.write(expected_output))
+        self.assertEqual(returncode, 0)
+        self.assertEqual(output, expected_output)
+
+    def test_caching_decorator(self):
+        """Test the caching decorator."""
+        # Confirm that the caching decorator works.
+        a = cached(lambda: random.random())
+        b = cached(lambda: random.random())
+        assert a() == a()
+        assert b() == b()
+        # Confirm that functions have their own cache.
+        assert a() != b()
+
+    def test_compact(self):
+        """Test :func:`humanfriendly.text.compact()`."""
+        assert compact(' a \n\n b ') == 'a b'
+        assert compact('''
+            %s template notation
+        ''', 'Simple') == 'Simple template notation'
+        assert compact('''
+            More {type} template notation
+        ''', type='readable') == 'More readable template notation'
+
+    def test_compact_empty_lines(self):
+        """Test :func:`humanfriendly.text.compact_empty_lines()`."""
+        # Simple strings pass through untouched.
+        assert compact_empty_lines('foo') == 'foo'
+        # Horizontal whitespace remains untouched.
+        assert compact_empty_lines('\tfoo') == '\tfoo'
+        # Line breaks should be preserved.
+        assert compact_empty_lines('foo\nbar') == 'foo\nbar'
+        # Vertical whitespace should be preserved.
+        assert compact_empty_lines('foo\n\nbar') == 'foo\n\nbar'
+        # Vertical whitespace should be compressed.
+        assert compact_empty_lines('foo\n\n\nbar') == 'foo\n\nbar'
+        assert compact_empty_lines('foo\n\n\n\nbar') == 'foo\n\nbar'
+        assert compact_empty_lines('foo\n\n\n\n\nbar') == 'foo\n\nbar'
+
+    def test_dedent(self):
+        """Test :func:`humanfriendly.text.dedent()`."""
+        assert dedent('\n line 1\n  line 2\n\n') == 'line 1\n line 2\n'
+        assert dedent('''
+            Dedented, %s text
+        ''', 'interpolated') == 'Dedented, interpolated text\n'
+        assert dedent('''
+            Dedented, {op} text
+        ''', op='formatted') == 'Dedented, formatted text\n'
+
+    def test_pluralization(self):
+        """Test :func:`humanfriendly.text.pluralize()`."""
+        assert pluralize(1, 'word') == '1 word'
+        assert pluralize(2, 'word') == '2 words'
+        assert pluralize(1, 'box', 'boxes') == '1 box'
+        assert pluralize(2, 'box', 'boxes') == '2 boxes'
+
+    def test_generate_slug(self):
+        """Test :func:`humanfriendly.text.generate_slug()`."""
+        # Test the basic functionality.
+        self.assertEqual('some-random-text', generate_slug('Some Random Text!'))
+        # Test that previous output doesn't change.
+        self.assertEqual('some-random-text', generate_slug('some-random-text'))
+        # Test that inputs which can't be converted to a slug raise an exception.
+        with self.assertRaises(ValueError):
+            generate_slug(' ')
+        with self.assertRaises(ValueError):
+            generate_slug('-')
+
+    def test_boolean_coercion(self):
+        """Test :func:`humanfriendly.coerce_boolean()`."""
+        for value in [True, 'TRUE', 'True', 'true', 'on', 'yes', '1']:
+            self.assertEqual(True, coerce_boolean(value))
+        for value in [False, 'FALSE', 'False', 'false', 'off', 'no', '0']:
+            self.assertEqual(False, coerce_boolean(value))
+        with self.assertRaises(ValueError):
+            coerce_boolean('not a boolean')
+
+    def test_pattern_coercion(self):
+        """Test :func:`humanfriendly.coerce_pattern()`."""
+        empty_pattern = re.compile('')
+        # Make sure strings are converted to compiled regular expressions.
+        assert isinstance(coerce_pattern('foobar'), type(empty_pattern))
+        # Make sure compiled regular expressions pass through untouched.
+        assert empty_pattern is coerce_pattern(empty_pattern)
+        # Make sure flags are respected.
+        pattern = coerce_pattern('foobar', re.IGNORECASE)
+        assert pattern.match('FOOBAR')
+        # Make sure invalid values raise the expected exception.
+        with self.assertRaises(ValueError):
+            coerce_pattern([])
+
+    def test_format_timespan(self):
+        """Test :func:`humanfriendly.format_timespan()`."""
+        minute = 60
+        hour = minute * 60
+        day = hour * 24
+        week = day * 7
+        year = week * 52
+        assert '1 nanosecond' == format_timespan(0.000000001, detailed=True)
+        assert '500 nanoseconds' == format_timespan(0.0000005, detailed=True)
+        assert '1 microsecond' == format_timespan(0.000001, detailed=True)
+        assert '500 microseconds' == format_timespan(0.0005, detailed=True)
+        assert '1 millisecond' == format_timespan(0.001, detailed=True)
+        assert '500 milliseconds' == format_timespan(0.5, detailed=True)
+        assert '0.5 seconds' == format_timespan(0.5, detailed=False)
+        assert '0 seconds' == format_timespan(0)
+        assert '0.54 seconds' == format_timespan(0.54321)
+        assert '1 second' == format_timespan(1)
+        assert '3.14 seconds' == format_timespan(math.pi)
+        assert '1 minute' == format_timespan(minute)
+        assert '1 minute and 20 seconds' == format_timespan(80)
+        assert '2 minutes' == format_timespan(minute * 2)
+        assert '1 hour' == format_timespan(hour)
+        assert '2 hours' == format_timespan(hour * 2)
+        assert '1 day' == format_timespan(day)
+        assert '2 days' == format_timespan(day * 2)
+        assert '1 week' == format_timespan(week)
+        assert '2 weeks' == format_timespan(week * 2)
+        assert '1 year' == format_timespan(year)
+        assert '2 years' == format_timespan(year * 2)
+        assert '6 years, 5 weeks, 4 days, 3 hours, 2 minutes and 500 milliseconds' == \
+            format_timespan(year * 6 + week * 5 + day * 4 + hour * 3 + minute * 2 + 0.5, detailed=True)
+        assert '1 year, 2 weeks and 3 days' == \
+            format_timespan(year + week * 2 + day * 3 + hour * 12)
+        # Make sure milliseconds are never shown separately when detailed=False.
+        # https://github.com/xolox/python-humanfriendly/issues/10
+        assert '1 minute, 1 second and 100 milliseconds' == format_timespan(61.10, detailed=True)
+        assert '1 minute and 1.1 seconds' == format_timespan(61.10, detailed=False)
+        # Test for loss of precision as reported in issue 11:
+        # https://github.com/xolox/python-humanfriendly/issues/11
+        assert '1 minute and 0.3 seconds' == format_timespan(60.300)
+        assert '5 minutes and 0.3 seconds' == format_timespan(300.300)
+        assert '1 second and 15 milliseconds' == format_timespan(1.015, detailed=True)
+        assert '10 seconds and 15 milliseconds' == format_timespan(10.015, detailed=True)
+        assert '1 microsecond and 50 nanoseconds' == format_timespan(0.00000105, detailed=True)
+        # Test the datetime.timedelta support:
+        # https://github.com/xolox/python-humanfriendly/issues/27
+        now = datetime.datetime.now()
+        then = now - datetime.timedelta(hours=23)
+        assert '23 hours' == format_timespan(now - then)
+
+    def test_parse_timespan(self):
+        """Test :func:`humanfriendly.parse_timespan()`."""
+        self.assertEqual(0, parse_timespan('0'))
+        self.assertEqual(0, parse_timespan('0s'))
+        self.assertEqual(0.000000001, parse_timespan('1ns'))
+        self.assertEqual(0.000000051, parse_timespan('51ns'))
+        self.assertEqual(0.000001, parse_timespan('1us'))
+        self.assertEqual(0.000052, parse_timespan('52us'))
+        self.assertEqual(0.001, parse_timespan('1ms'))
+        self.assertEqual(0.001, parse_timespan('1 millisecond'))
+        self.assertEqual(0.5, parse_timespan('500 milliseconds'))
+        self.assertEqual(0.5, parse_timespan('0.5 seconds'))
+        self.assertEqual(5, parse_timespan('5s'))
+        self.assertEqual(5, parse_timespan('5 seconds'))
+        self.assertEqual(60 * 2, parse_timespan('2m'))
+        self.assertEqual(60 * 2, parse_timespan('2 minutes'))
+        self.assertEqual(60 * 3, parse_timespan('3 min'))
+        self.assertEqual(60 * 3, parse_timespan('3 mins'))
+        self.assertEqual(60 * 60 * 3, parse_timespan('3 h'))
+        self.assertEqual(60 * 60 * 3, parse_timespan('3 hours'))
+        self.assertEqual(60 * 60 * 24 * 4, parse_timespan('4d'))
+        self.assertEqual(60 * 60 * 24 * 4, parse_timespan('4 days'))
+        self.assertEqual(60 * 60 * 24 * 7 * 5, parse_timespan('5 w'))
+        self.assertEqual(60 * 60 * 24 * 7 * 5, parse_timespan('5 weeks'))
+        with self.assertRaises(InvalidTimespan):
+            parse_timespan('1z')
+
+    def test_parse_date(self):
+        """Test :func:`humanfriendly.parse_date()`."""
+        self.assertEqual((2013, 6, 17, 0, 0, 0), parse_date('2013-06-17'))
+        self.assertEqual((2013, 6, 17, 2, 47, 42), parse_date('2013-06-17 02:47:42'))
+        self.assertEqual((2016, 11, 30, 0, 47, 17), parse_date(u'2016-11-30 00:47:17'))
+        with self.assertRaises(InvalidDate):
+            parse_date('2013-06-XY')
+
+    def test_format_size(self):
+        """Test :func:`humanfriendly.format_size()`."""
+        self.assertEqual('0 bytes', format_size(0))
+        self.assertEqual('1 byte', format_size(1))
+        self.assertEqual('42 bytes', format_size(42))
+        self.assertEqual('1 KB', format_size(1000 ** 1))
+        self.assertEqual('1 MB', format_size(1000 ** 2))
+        self.assertEqual('1 GB', format_size(1000 ** 3))
+        self.assertEqual('1 TB', format_size(1000 ** 4))
+        self.assertEqual('1 PB', format_size(1000 ** 5))
+        self.assertEqual('1 EB', format_size(1000 ** 6))
+        self.assertEqual('1 ZB', format_size(1000 ** 7))
+        self.assertEqual('1 YB', format_size(1000 ** 8))
+        self.assertEqual('1 KiB', format_size(1024 ** 1, binary=True))
+        self.assertEqual('1 MiB', format_size(1024 ** 2, binary=True))
+        self.assertEqual('1 GiB', format_size(1024 ** 3, binary=True))
+        self.assertEqual('1 TiB', format_size(1024 ** 4, binary=True))
+        self.assertEqual('1 PiB', format_size(1024 ** 5, binary=True))
+        self.assertEqual('1 EiB', format_size(1024 ** 6, binary=True))
+        self.assertEqual('1 ZiB', format_size(1024 ** 7, binary=True))
+        self.assertEqual('1 YiB', format_size(1024 ** 8, binary=True))
+        self.assertEqual('45 KB', format_size(1000 * 45))
+        self.assertEqual('2.9 TB', format_size(1000 ** 4 * 2.9))
+
+    def test_parse_size(self):
+        """Test :func:`humanfriendly.parse_size()`."""
+        self.assertEqual(0, parse_size('0B'))
+        self.assertEqual(42, parse_size('42'))
+        self.assertEqual(42, parse_size('42B'))
+        self.assertEqual(1000, parse_size('1k'))
+        self.assertEqual(1024, parse_size('1k', binary=True))
+        self.assertEqual(1000, parse_size('1 KB'))
+        self.assertEqual(1000, parse_size('1 kilobyte'))
+        self.assertEqual(1024, parse_size('1 kilobyte', binary=True))
+        self.assertEqual(1000 ** 2 * 69, parse_size('69 MB'))
+        self.assertEqual(1000 ** 3, parse_size('1 GB'))
+        self.assertEqual(1000 ** 4, parse_size('1 TB'))
+        self.assertEqual(1000 ** 5, parse_size('1 PB'))
+        self.assertEqual(1000 ** 6, parse_size('1 EB'))
+        self.assertEqual(1000 ** 7, parse_size('1 ZB'))
+        self.assertEqual(1000 ** 8, parse_size('1 YB'))
+        self.assertEqual(1000 ** 3 * 1.5, parse_size('1.5 GB'))
+        self.assertEqual(1024 ** 8 * 1.5, parse_size('1.5 YiB'))
+        with self.assertRaises(InvalidSize):
+            parse_size('1q')
+        with self.assertRaises(InvalidSize):
+            parse_size('a')
+
+    def test_format_length(self):
+        """Test :func:`humanfriendly.format_length()`."""
+        self.assertEqual('0 metres', format_length(0))
+        self.assertEqual('1 metre', format_length(1))
+        self.assertEqual('42 metres', format_length(42))
+        self.assertEqual('1 km', format_length(1 * 1000))
+        self.assertEqual('15.3 cm', format_length(0.153))
+        self.assertEqual('1 cm', format_length(1e-02))
+        self.assertEqual('1 mm', format_length(1e-03))
+        self.assertEqual('1 nm', format_length(1e-09))
+
+    def test_parse_length(self):
+        """Test :func:`humanfriendly.parse_length()`."""
+        self.assertEqual(0, parse_length('0m'))
+        self.assertEqual(42, parse_length('42'))
+        self.assertEqual(1.5, parse_length('1.5'))
+        self.assertEqual(42, parse_length('42m'))
+        self.assertEqual(1000, parse_length('1km'))
+        self.assertEqual(0.153, parse_length('15.3 cm'))
+        self.assertEqual(1e-02, parse_length('1cm'))
+        self.assertEqual(1e-03, parse_length('1mm'))
+        self.assertEqual(1e-09, parse_length('1nm'))
+        with self.assertRaises(InvalidLength):
+            parse_length('1z')
+        with self.assertRaises(InvalidLength):
+            parse_length('a')
+
+    def test_format_number(self):
+        """Test :func:`humanfriendly.format_number()`."""
+        self.assertEqual('1', format_number(1))
+        self.assertEqual('1.5', format_number(1.5))
+        self.assertEqual('1.56', format_number(1.56789))
+        self.assertEqual('1.567', format_number(1.56789, 3))
+        self.assertEqual('1,000', format_number(1000))
+        self.assertEqual('1,000', format_number(1000.12, 0))
+        self.assertEqual('1,000,000', format_number(1000000))
+        self.assertEqual('1,000,000.42', format_number(1000000.42))
+        # Regression test for https://github.com/xolox/python-humanfriendly/issues/40.
+        self.assertEqual('-285.67', format_number(-285.67))
+
+    def test_round_number(self):
+        """Test :func:`humanfriendly.round_number()`."""
+        self.assertEqual('1', round_number(1))
+        self.assertEqual('1', round_number(1.0))
+        self.assertEqual('1.00', round_number(1, keep_width=True))
+        self.assertEqual('3.14', round_number(3.141592653589793))
+
+    def test_format_path(self):
+        """Test :func:`humanfriendly.format_path()`."""
+        friendly_path = os.path.join('~', '.vimrc')
+        absolute_path = os.path.join(os.environ['HOME'], '.vimrc')
+        self.assertEqual(friendly_path, format_path(absolute_path))
+
+    def test_parse_path(self):
+        """Test :func:`humanfriendly.parse_path()`."""
+        friendly_path = os.path.join('~', '.vimrc')
+        absolute_path = os.path.join(os.environ['HOME'], '.vimrc')
+        self.assertEqual(absolute_path, parse_path(friendly_path))
+
+    def test_pretty_tables(self):
+        """Test :func:`humanfriendly.tables.format_pretty_table()`."""
+        # The simplest case possible :-).
+        data = [['Just one column']]
+        assert format_pretty_table(data) == dedent("""
+            -------------------
+            | Just one column |
+            -------------------
+        """).strip()
+        # A bit more complex: two rows, three columns, varying widths.
+        data = [['One', 'Two', 'Three'], ['1', '2', '3']]
+        assert format_pretty_table(data) == dedent("""
+            ---------------------
+            | One | Two | Three |
+            | 1   | 2   | 3     |
+            ---------------------
+        """).strip()
+        # A table including column names.
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'c']]
+        assert ansi_strip(format_pretty_table(data, column_names)) == dedent("""
+            ---------------------
+            | One | Two | Three |
+            ---------------------
+            | 1   | 2   | 3     |
+            | a   | b   | c     |
+            ---------------------
+        """).strip()
+        # A table that contains a column with only numeric data (will be right aligned).
+        column_names = ['Just a label', 'Important numbers']
+        data = [['Row one', '15'], ['Row two', '300']]
+        assert ansi_strip(format_pretty_table(data, column_names)) == dedent("""
+            ------------------------------------
+            | Just a label | Important numbers |
+            ------------------------------------
+            | Row one      |                15 |
+            | Row two      |               300 |
+            ------------------------------------
+        """).strip()
+
+    def test_robust_tables(self):
+        """Test :func:`humanfriendly.tables.format_robust_table()`."""
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'c']]
+        assert ansi_strip(format_robust_table(data, column_names)) == dedent("""
+            --------
+            One: 1
+            Two: 2
+            Three: 3
+            --------
+            One: a
+            Two: b
+            Three: c
+            --------
+        """).strip()
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'Here comes a\nmulti line column!']]
+        assert ansi_strip(format_robust_table(data, column_names)) == dedent("""
+            ------------------
+            One: 1
+            Two: 2
+            Three: 3
+            ------------------
+            One: a
+            Two: b
+            Three:
+            Here comes a
+            multi line column!
+            ------------------
+        """).strip()
+
+    def test_smart_tables(self):
+        """Test :func:`humanfriendly.tables.format_smart_table()`."""
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'c']]
+        assert ansi_strip(format_smart_table(data, column_names)) == dedent("""
+            ---------------------
+            | One | Two | Three |
+            ---------------------
+            | 1   | 2   | 3     |
+            | a   | b   | c     |
+            ---------------------
+        """).strip()
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'Here comes a\nmulti line column!']]
+        assert ansi_strip(format_smart_table(data, column_names)) == dedent("""
+            ------------------
+            One: 1
+            Two: 2
+            Three: 3
+            ------------------
+            One: a
+            Two: b
+            Three:
+            Here comes a
+            multi line column!
+            ------------------
+        """).strip()
+
+    def test_rst_tables(self):
+        """Test :func:`humanfriendly.tables.format_rst_table()`."""
+        # Generate a table with column names.
+        column_names = ['One', 'Two', 'Three']
+        data = [['1', '2', '3'], ['a', 'b', 'c']]
+        self.assertEqual(
+            format_rst_table(data, column_names),
+            dedent("""
+                ===  ===  =====
+                One  Two  Three
+                ===  ===  =====
+                1    2    3
+                a    b    c
+                ===  ===  =====
+            """).rstrip(),
+        )
+        # Generate a table without column names.
+        data = [['1', '2', '3'], ['a', 'b', 'c']]
+        self.assertEqual(
+            format_rst_table(data),
+            dedent("""
+                =  =  =
+                1  2  3
+                a  b  c
+                =  =  =
+            """).rstrip(),
+        )
+
+    def test_concatenate(self):
+        """Test :func:`humanfriendly.text.concatenate()`."""
+        assert concatenate([]) == ''
+        assert concatenate(['one']) == 'one'
+        assert concatenate(['one', 'two']) == 'one and two'
+        assert concatenate(['one', 'two', 'three']) == 'one, two and three'
+        # Test the 'conjunction' option.
+        assert concatenate(['one', 'two', 'three'], conjunction='or') == 'one, two or three'
+        # Test the 'serial_comma' option.
+        assert concatenate(['one', 'two', 'three'], serial_comma=True) == 'one, two, and three'
+
+    def test_split(self):
+        """Test :func:`humanfriendly.text.split()`."""
+        from humanfriendly.text import split
+        self.assertEqual(split(''), [])
+        self.assertEqual(split('foo'), ['foo'])
+        self.assertEqual(split('foo, bar'), ['foo', 'bar'])
+        self.assertEqual(split('foo, bar, baz'), ['foo', 'bar', 'baz'])
+        self.assertEqual(split('foo,bar,baz'), ['foo', 'bar', 'baz'])
+
+    def test_timer(self):
+        """Test :func:`humanfriendly.Timer`."""
+        for seconds, text in ((1, '1 second'),
+                              (2, '2 seconds'),
+                              (60, '1 minute'),
+                              (60 * 2, '2 minutes'),
+                              (60 * 60, '1 hour'),
+                              (60 * 60 * 2, '2 hours'),
+                              (60 * 60 * 24, '1 day'),
+                              (60 * 60 * 24 * 2, '2 days'),
+                              (60 * 60 * 24 * 7, '1 week'),
+                              (60 * 60 * 24 * 7 * 2, '2 weeks')):
+            t = Timer(time.time() - seconds)
+            self.assertEqual(round_number(t.elapsed_time, keep_width=True), '%i.00' % seconds)
+            self.assertEqual(str(t), text)
+        # Test rounding to seconds.
+        t = Timer(time.time() - 2.2)
+        self.assertEqual(t.rounded, '2 seconds')
+        # Test automatic timer.
+        automatic_timer = Timer()
+        time.sleep(1)
+        # XXX The following normalize_timestamp(ndigits=0) calls are intended
+        #     to compensate for unreliable clock sources in virtual machines
+        #     like those encountered on Travis CI, see also:
+        #     https://travis-ci.org/xolox/python-humanfriendly/jobs/323944263
+        self.assertEqual(normalize_timestamp(automatic_timer.elapsed_time, 0), '1.00')
+        # Test resumable timer.
+        resumable_timer = Timer(resumable=True)
+        for i in range(2):
+            with resumable_timer:
+                time.sleep(1)
+        self.assertEqual(normalize_timestamp(resumable_timer.elapsed_time, 0), '2.00')
+        # Make sure Timer.__enter__() returns the timer object.
+        with Timer(resumable=True) as timer:
+            assert timer is not None
+
+    def test_spinner(self):
+        """Test :func:`humanfriendly.Spinner`."""
+        stream = StringIO()
+        spinner = Spinner(label='test spinner', total=4, stream=stream, interactive=True)
+        for progress in [1, 2, 3, 4]:
+            spinner.step(progress=progress)
+            time.sleep(0.2)
+        spinner.clear()
+        output = stream.getvalue()
+        output = (output.replace(ANSI_SHOW_CURSOR, '')
+                        .replace(ANSI_HIDE_CURSOR, ''))
+        lines = [line for line in output.split(ANSI_ERASE_LINE) if line]
+        self.assertTrue(len(lines) > 0)
+        self.assertTrue(all('test spinner' in line for line in lines))
+        self.assertTrue(all('%' in line for line in lines))
+        self.assertEqual(sorted(set(lines)), sorted(lines))
+
+    def test_automatic_spinner(self):
+        """
+        Test :func:`humanfriendly.AutomaticSpinner`.
+
+        There's not a lot to test about the :class:`.AutomaticSpinner` class,
+        but by at least running it here we are assured that the code functions
+        on all supported Python versions. :class:`.AutomaticSpinner` is built
+        on top of the :class:`.Spinner` class so at least we also have the
+        tests for the :class:`.Spinner` class to back us up.
+        """
+        with AutomaticSpinner(label='test spinner'):
+            time.sleep(1)
+
+    def test_prompt_for_choice(self):
+        """Test :func:`humanfriendly.prompts.prompt_for_choice()`."""
+        # Choice selection without any options should raise an exception.
+        with self.assertRaises(ValueError):
+            prompt_for_choice([])
+        # If there's only one option no prompt should be rendered so we expect
+        # the following code to not raise an EOFError exception (despite
+        # connecting standard input to /dev/null).
+        with open(os.devnull) as handle:
+            with PatchedAttribute(sys, 'stdin', handle):
+                only_option = 'only one option (shortcut)'
+                assert prompt_for_choice([only_option]) == only_option
+        # Choice selection by full string match.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: 'foo'):
+            assert prompt_for_choice(['foo', 'bar']) == 'foo'
+        # Choice selection by substring input.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: 'f'):
+            assert prompt_for_choice(['foo', 'bar']) == 'foo'
+        # Choice selection by number.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: '2'):
+            assert prompt_for_choice(['foo', 'bar']) == 'bar'
+        # Choice selection by going with the default.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: ''):
+            assert prompt_for_choice(['foo', 'bar'], default='bar') == 'bar'
+        # Invalid substrings are refused.
+        replies = ['', 'q', 'z']
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: replies.pop(0)):
+            assert prompt_for_choice(['foo', 'bar', 'baz']) == 'baz'
+        # Choice selection by substring input requires an unambiguous substring match.
+        replies = ['a', 'q']
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: replies.pop(0)):
+            assert prompt_for_choice(['foo', 'bar', 'baz', 'qux']) == 'qux'
+        # Invalid numbers are refused.
+        replies = ['42', '2']
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: replies.pop(0)):
+            assert prompt_for_choice(['foo', 'bar', 'baz']) == 'bar'
+        # Test that interactive prompts eventually give up on invalid replies.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: ''):
+            with self.assertRaises(TooManyInvalidReplies):
+                prompt_for_choice(['a', 'b', 'c'])
+
+    def test_prompt_for_confirmation(self):
+        """Test :func:`humanfriendly.prompts.prompt_for_confirmation()`."""
+        # Test some (more or less) reasonable replies that indicate agreement.
+        for reply in 'yes', 'Yes', 'YES', 'y', 'Y':
+            with PatchedAttribute(prompts, 'interactive_prompt', lambda p: reply):
+                assert prompt_for_confirmation("Are you sure?") is True
+        # Test some (more or less) reasonable replies that indicate disagreement.
+        for reply in 'no', 'No', 'NO', 'n', 'N':
+            with PatchedAttribute(prompts, 'interactive_prompt', lambda p: reply):
+                assert prompt_for_confirmation("Are you sure?") is False
+        # Test that empty replies select the default choice.
+        for default_choice in True, False:
+            with PatchedAttribute(prompts, 'interactive_prompt', lambda p: ''):
+                assert prompt_for_confirmation("Are you sure?", default=default_choice) is default_choice
+        # Test that a warning is shown when no input nor a default is given.
+        replies = ['', 'y']
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: replies.pop(0)):
+            with CaptureOutput(merged=True) as capturer:
+                assert prompt_for_confirmation("Are you sure?") is True
+                assert "there's no default choice" in capturer.get_text()
+        # Test that the default reply is shown in uppercase.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: 'y'):
+            for default_value, expected_text in (True, 'Y/n'), (False, 'y/N'), (None, 'y/n'):
+                with CaptureOutput(merged=True) as capturer:
+                    assert prompt_for_confirmation("Are you sure?", default=default_value) is True
+                    assert expected_text in capturer.get_text()
+        # Test that interactive prompts eventually give up on invalid replies.
+        with PatchedAttribute(prompts, 'interactive_prompt', lambda p: ''):
+            with self.assertRaises(TooManyInvalidReplies):
+                prompt_for_confirmation("Are you sure?")
+
+    def test_prompt_for_input(self):
+        """Test :func:`humanfriendly.prompts.prompt_for_input()`."""
+        with open(os.devnull) as handle:
+            with PatchedAttribute(sys, 'stdin', handle):
+                # If standard input isn't connected to a terminal the default value should be returned.
+                default_value = "To seek the holy grail!"
+                assert prompt_for_input("What is your quest?", default=default_value) == default_value
+                # If standard input isn't connected to a terminal and no default value
+                # is given the EOFError exception should be propagated to the caller.
+                with self.assertRaises(EOFError):
+                    prompt_for_input("What is your favorite color?")
+
+    def test_cli(self):
+        """Test the command line interface."""
+        # Test that the usage message is printed by default.
+        returncode, output = run_cli(main)
+        assert 'Usage:' in output
+        # Test that the usage message can be requested explicitly.
+        returncode, output = run_cli(main, '--help')
+        assert 'Usage:' in output
+        # Test handling of invalid command line options.
+        returncode, output = run_cli(main, '--unsupported-option')
+        assert returncode != 0
+        # Test `humanfriendly --format-number'.
+        returncode, output = run_cli(main, '--format-number=1234567')
+        assert output.strip() == '1,234,567'
+        # Test `humanfriendly --format-size'.
+        random_byte_count = random.randint(1024, 1024 * 1024)
+        returncode, output = run_cli(main, '--format-size=%i' % random_byte_count)
+        assert output.strip() == format_size(random_byte_count)
+        # Test `humanfriendly --format-size --binary'.
+        random_byte_count = random.randint(1024, 1024 * 1024)
+        returncode, output = run_cli(main, '--format-size=%i' % random_byte_count, '--binary')
+        assert output.strip() == format_size(random_byte_count, binary=True)
+        # Test `humanfriendly --format-length'.
+        random_len = random.randint(1024, 1024 * 1024)
+        returncode, output = run_cli(main, '--format-length=%i' % random_len)
+        assert output.strip() == format_length(random_len)
+        random_len = float(random_len) / 12345.6
+        returncode, output = run_cli(main, '--format-length=%f' % random_len)
+        assert output.strip() == format_length(random_len)
+        # Test `humanfriendly --format-table'.
+        returncode, output = run_cli(main, '--format-table', '--delimiter=\t', input='1\t2\t3\n4\t5\t6\n7\t8\t9')
+        assert output.strip() == dedent('''
+            -------------
+            | 1 | 2 | 3 |
+            | 4 | 5 | 6 |
+            | 7 | 8 | 9 |
+            -------------
+        ''').strip()
+        # Test `humanfriendly --format-timespan'.
+        random_timespan = random.randint(5, 600)
+        returncode, output = run_cli(main, '--format-timespan=%i' % random_timespan)
+        assert output.strip() == format_timespan(random_timespan)
+        # Test `humanfriendly --parse-size'.
+        returncode, output = run_cli(main, '--parse-size=5 KB')
+        assert int(output) == parse_size('5 KB')
+        # Test `humanfriendly --parse-size'.
+        returncode, output = run_cli(main, '--parse-size=5 YiB')
+        assert int(output) == parse_size('5 YB', binary=True)
+        # Test `humanfriendly --parse-length'.
+        returncode, output = run_cli(main, '--parse-length=5 km')
+        assert int(output) == parse_length('5 km')
+        returncode, output = run_cli(main, '--parse-length=1.05 km')
+        assert float(output) == parse_length('1.05 km')
+        # Test `humanfriendly --run-command'.
+        returncode, output = run_cli(main, '--run-command', 'bash', '-c', 'sleep 2 && exit 42')
+        assert returncode == 42
+        # Test `humanfriendly --demo'. The purpose of this test is
+        # to ensure that the demo runs successfully on all versions
+        # of Python and outputs the expected sections (recognized by
+        # their headings) without triggering exceptions. This was
+        # written as a regression test after issue #28 was reported:
+        # https://github.com/xolox/python-humanfriendly/issues/28
+        returncode, output = run_cli(main, '--demo')
+        assert returncode == 0
+        lines = [ansi_strip(line) for line in output.splitlines()]
+        assert "Text styles:" in lines
+        assert "Foreground colors:" in lines
+        assert "Background colors:" in lines
+        assert "256 color mode (standard colors):" in lines
+        assert "256 color mode (high-intensity colors):" in lines
+        assert "256 color mode (216 colors):" in lines
+        assert "256 color mode (gray scale colors):" in lines
+
+    def test_ansi_style(self):
+        """Test :func:`humanfriendly.terminal.ansi_style()`."""
+        assert ansi_style(bold=True) == '%s1%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(faint=True) == '%s2%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(italic=True) == '%s3%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(underline=True) == '%s4%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(inverse=True) == '%s7%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(strike_through=True) == '%s9%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(color='blue') == '%s34%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(background='blue') == '%s44%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(color='blue', bright=True) == '%s94%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(color=214) == '%s38;5;214%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(background=214) == '%s39;5;214%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(color=(0, 0, 0)) == '%s38;2;0;0;0%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(color=(255, 255, 255)) == '%s38;2;255;255;255%s' % (ANSI_CSI, ANSI_SGR)
+        assert ansi_style(background=(50, 100, 150)) == '%s48;2;50;100;150%s' % (ANSI_CSI, ANSI_SGR)
+        with self.assertRaises(ValueError):
+            ansi_style(color='unknown')
+
+    def test_ansi_width(self):
+        """Test :func:`humanfriendly.terminal.ansi_width()`."""
+        text = "Whatever"
+        # Make sure ansi_width() works as expected on strings without ANSI escape sequences.
+        assert len(text) == ansi_width(text)
+        # Wrap a text in ANSI escape sequences and make sure ansi_width() treats it as expected.
+        wrapped = ansi_wrap(text, bold=True)
+        # Make sure ansi_wrap() changed the text.
+        assert wrapped != text
+        # Make sure ansi_wrap() added additional bytes.
+        assert len(wrapped) > len(text)
+        # Make sure the result of ansi_width() stays the same.
+        assert len(text) == ansi_width(wrapped)
+
+    def test_ansi_wrap(self):
+        """Test :func:`humanfriendly.terminal.ansi_wrap()`."""
+        text = "Whatever"
+        # Make sure ansi_wrap() does nothing when no keyword arguments are given.
+        assert text == ansi_wrap(text)
+        # Make sure ansi_wrap() starts the text with the CSI sequence.
+        assert ansi_wrap(text, bold=True).startswith(ANSI_CSI)
+        # Make sure ansi_wrap() ends the text by resetting the ANSI styles.
+        assert ansi_wrap(text, bold=True).endswith(ANSI_RESET)
+
+    def test_html_to_ansi(self):
+        """Test the :func:`humanfriendly.terminal.html_to_ansi()` function."""
+        assert html_to_ansi("Just some plain text") == "Just some plain text"
+        # Hyperlinks.
+        assert html_to_ansi('<a href="https://python.org">python.org</a>') == \
+            '\x1b[0m\x1b[4;94mpython.org\x1b[0m (\x1b[0m\x1b[4;94mhttps://python.org\x1b[0m)'
+        # Make sure `mailto:' prefixes are stripped (they're not at all useful in a terminal).
+        assert html_to_ansi('<a href="mailto:peter@peterodding.com">peter@peterodding.com</a>') == \
+            '\x1b[0m\x1b[4;94mpeter@peterodding.com\x1b[0m'
+        # Bold text.
+        assert html_to_ansi("Let's try <b>bold</b>") == "Let's try \x1b[0m\x1b[1mbold\x1b[0m"
+        assert html_to_ansi("Let's try <span style=\"font-weight: bold\">bold</span>") == \
+            "Let's try \x1b[0m\x1b[1mbold\x1b[0m"
+        # Italic text.
+        assert html_to_ansi("Let's try <i>italic</i>") == \
+            "Let's try \x1b[0m\x1b[3mitalic\x1b[0m"
+        assert html_to_ansi("Let's try <span style=\"font-style: italic\">italic</span>") == \
+            "Let's try \x1b[0m\x1b[3mitalic\x1b[0m"
+        # Underlined text.
+        assert html_to_ansi("Let's try <ins>underline</ins>") == \
+            "Let's try \x1b[0m\x1b[4munderline\x1b[0m"
+        assert html_to_ansi("Let's try <span style=\"text-decoration: underline\">underline</span>") == \
+            "Let's try \x1b[0m\x1b[4munderline\x1b[0m"
+        # Strike-through text.
+        assert html_to_ansi("Let's try <s>strike-through</s>") == \
+            "Let's try \x1b[0m\x1b[9mstrike-through\x1b[0m"
+        assert html_to_ansi("Let's try <span style=\"text-decoration: line-through\">strike-through</span>") == \
+            "Let's try \x1b[0m\x1b[9mstrike-through\x1b[0m"
+        # Pre-formatted text.
+        assert html_to_ansi("Let's try <code>pre-formatted</code>") == \
+            "Let's try \x1b[0m\x1b[33mpre-formatted\x1b[0m"
+        # Text colors (with a 6 digit hexadecimal color value).
+        assert html_to_ansi("Let's try <span style=\"color: #AABBCC\">text colors</s>") == \
+            "Let's try \x1b[0m\x1b[38;2;170;187;204mtext colors\x1b[0m"
+        # Background colors (with an rgb(N, N, N) expression).
+        assert html_to_ansi("Let's try <span style=\"background-color: rgb(50, 50, 50)\">background colors</s>") == \
+            "Let's try \x1b[0m\x1b[48;2;50;50;50mbackground colors\x1b[0m"
+        # Line breaks.
+        assert html_to_ansi("Let's try some<br>line<br>breaks") == \
+            "Let's try some\nline\nbreaks"
+        # Check that decimal entities are decoded.
+        assert html_to_ansi("&#38;") == "&"
+        # Check that named entities are decoded.
+        assert html_to_ansi("&amp;") == "&"
+        assert html_to_ansi("&gt;") == ">"
+        assert html_to_ansi("&lt;") == "<"
+        # Check that hexadecimal entities are decoded.
+        assert html_to_ansi("&#x26;") == "&"
+        # Check that the text callback is actually called.
+
+        def callback(text):
+            return text.replace(':wink:', ';-)')
+
+        assert ':wink:' not in html_to_ansi('<b>:wink:</b>', callback=callback)
+        # Check that the text callback doesn't process preformatted text.
+        assert ':wink:' in html_to_ansi('<code>:wink:</code>', callback=callback)
+        # Try a somewhat convoluted but nevertheless real life example from my
+        # personal chat archives that causes humanfriendly releases 4.15 and
+        # 4.15.1 to raise an exception.
+        assert html_to_ansi(u'''
+            Tweakers zit er idd nog steeds:<br><br>
+            peter@peter-work&gt; curl -s <a href="tweakers.net">tweakers.net</a> | grep -i hosting<br>
+            &lt;a href="<a href="http://www.true.nl/webhosting/">http://www.true.nl/webhosting/</a>"
+                rel="external" id="true" title="Hosting door True"&gt;&lt;/a&gt;<br>
+            Hosting door &lt;a href="<a href="http://www.true.nl/vps/">http://www.true.nl/vps/</a>"
+                title="VPS hosting" rel="external"&gt;True</a>
+        ''')
+
+    def test_generate_output(self):
+        """Test the :func:`humanfriendly.terminal.output()` function."""
+        text = "Standard output generated by output()"
+        with CaptureOutput(merged=False) as capturer:
+            output(text)
+            self.assertEqual([text], capturer.stdout.get_lines())
+            self.assertEqual([], capturer.stderr.get_lines())
+
+    def test_generate_message(self):
+        """Test the :func:`humanfriendly.terminal.message()` function."""
+        text = "Standard error generated by message()"
+        with CaptureOutput(merged=False) as capturer:
+            message(text)
+            self.assertEqual([], capturer.stdout.get_lines())
+            self.assertEqual([text], capturer.stderr.get_lines())
+
+    def test_generate_warning(self):
+        """Test the :func:`humanfriendly.terminal.warning()` function."""
+        from capturer import CaptureOutput
+        text = "Standard error generated by warning()"
+        with CaptureOutput(merged=False) as capturer:
+            warning(text)
+            self.assertEqual([], capturer.stdout.get_lines())
+            self.assertEqual([ansi_wrap(text, color='red')], self.ignore_coverage_warning(capturer.stderr))
+
+    def ignore_coverage_warning(self, stream):
+        """
+        Filter out coverage.py warning from standard error.
+
+        This is intended to remove the following line from the lines captured
+        on the standard error stream:
+
+        Coverage.py warning: No data was collected. (no-data-collected)
+        """
+        return [line for line in stream.get_lines() if 'no-data-collected' not in line]
+
+    def test_clean_output(self):
+        """Test :func:`humanfriendly.terminal.clean_terminal_output()`."""
+        # Simple output should pass through unharmed (single line).
+        assert clean_terminal_output('foo') == ['foo']
+        # Simple output should pass through unharmed (multiple lines).
+        assert clean_terminal_output('foo\nbar') == ['foo', 'bar']
+        # Carriage returns and preceding substrings are removed.
+        assert clean_terminal_output('foo\rbar\nbaz') == ['bar', 'baz']
+        # Carriage returns move the cursor to the start of the line without erasing text.
+        assert clean_terminal_output('aaa\rab') == ['aba']
+        # Backspace moves the cursor one position back without erasing text.
+        assert clean_terminal_output('aaa\b\bb') == ['aba']
+        # Trailing empty lines should be stripped.
+        assert clean_terminal_output('foo\nbar\nbaz\n\n\n') == ['foo', 'bar', 'baz']
+
+    def test_find_terminal_size(self):
+        """Test :func:`humanfriendly.terminal.find_terminal_size()`."""
+        lines, columns = find_terminal_size()
+        # We really can't assert any minimum or maximum values here because it
+        # simply doesn't make any sense; it's impossible for me to anticipate
+        # on what environments this test suite will run in the future.
+        assert lines > 0
+        assert columns > 0
+        # The find_terminal_size_using_ioctl() function is the default
+        # implementation and it will likely work fine. This makes it hard to
+        # test the fall back code paths though. However there's an easy way to
+        # make find_terminal_size_using_ioctl() fail ...
+        saved_stdin = sys.stdin
+        saved_stdout = sys.stdout
+        saved_stderr = sys.stderr
+        try:
+            # What do you mean this is brute force?! ;-)
+            sys.stdin = StringIO()
+            sys.stdout = StringIO()
+            sys.stderr = StringIO()
+            # Now find_terminal_size_using_ioctl() should fail even though
+            # find_terminal_size_using_stty() might work fine.
+            lines, columns = find_terminal_size()
+            assert lines > 0
+            assert columns > 0
+            # There's also an ugly way to make `stty size' fail: The
+            # subprocess.Popen class uses os.execvp() underneath, so if we
+            # clear the $PATH it will break.
+            saved_path = os.environ['PATH']
+            try:
+                os.environ['PATH'] = ''
+                # Now find_terminal_size_using_stty() should fail.
+                lines, columns = find_terminal_size()
+                assert lines > 0
+                assert columns > 0
+            finally:
+                os.environ['PATH'] = saved_path
+        finally:
+            sys.stdin = saved_stdin
+            sys.stdout = saved_stdout
+            sys.stderr = saved_stderr
+
+    def test_terminal_capabilities(self):
+        """Test the functions that check for terminal capabilities."""
+        from capturer import CaptureOutput
+        for test_stream in connected_to_terminal, terminal_supports_colors:
+            # This test suite should be able to run interactively as well as
+            # non-interactively, so we can't expect or demand that standard streams
+            # will always be connected to a terminal. Fortunately Capturer enables
+            # us to fake it :-).
+            for stream in sys.stdout, sys.stderr:
+                with CaptureOutput():
+                    assert test_stream(stream)
+            # Test something that we know can never be a terminal.
+            with open(os.devnull) as handle:
+                assert not test_stream(handle)
+            # Verify that objects without isatty() don't raise an exception.
+            assert not test_stream(object())
+
+    def test_show_pager(self):
+        """Test :func:`humanfriendly.terminal.show_pager()`."""
+        original_pager = os.environ.get('PAGER', None)
+        try:
+            # We specifically avoid `less' because it would become awkward to
+            # run the test suite in an interactive terminal :-).
+            os.environ['PAGER'] = 'cat'
+            # Generate a significant amount of random text spread over multiple
+            # lines that we expect to be reported literally on the terminal.
+            random_text = "\n".join(random_string(25) for i in range(50))
+            # Run the pager command and validate the output.
+            with CaptureOutput() as capturer:
+                show_pager(random_text)
+                assert random_text in capturer.get_text()
+        finally:
+            if original_pager is not None:
+                # Restore the original $PAGER value.
+                os.environ['PAGER'] = original_pager
+            else:
+                # Clear the custom $PAGER value.
+                os.environ.pop('PAGER')
+
+    def test_get_pager_command(self):
+        """Test :func:`humanfriendly.terminal.get_pager_command()`."""
+        # Make sure --RAW-CONTROL-CHARS isn't used when it's not needed.
+        assert '--RAW-CONTROL-CHARS' not in get_pager_command("Usage message")
+        # Make sure --RAW-CONTROL-CHARS is used when it's needed.
+        assert '--RAW-CONTROL-CHARS' in get_pager_command(ansi_wrap("Usage message", bold=True))
+        # Make sure that less-specific options are only used when valid.
+        options_specific_to_less = ['--no-init', '--quit-if-one-screen']
+        for pager in 'cat', 'less':
+            original_pager = os.environ.get('PAGER', None)
+            try:
+                # Set $PAGER to `cat' or `less'.
+                os.environ['PAGER'] = pager
+                # Get the pager command line.
+                command_line = get_pager_command()
+                # Check for less-specific options.
+                if pager == 'less':
+                    assert all(opt in command_line for opt in options_specific_to_less)
+                else:
+                    assert not any(opt in command_line for opt in options_specific_to_less)
+            finally:
+                if original_pager is not None:
+                    # Restore the original $PAGER value.
+                    os.environ['PAGER'] = original_pager
+                else:
+                    # Clear the custom $PAGER value.
+                    os.environ.pop('PAGER')
+
+    def test_find_meta_variables(self):
+        """Test :func:`humanfriendly.usage.find_meta_variables()`."""
+        assert sorted(find_meta_variables("""
+            Here's one example: --format-number=VALUE
+            Here's another example: --format-size=BYTES
+            A final example: --format-timespan=SECONDS
+            This line doesn't contain a META variable.
+        """)) == sorted(['VALUE', 'BYTES', 'SECONDS'])
+
+    def test_parse_usage_simple(self):
+        """Test :func:`humanfriendly.usage.parse_usage()` (a simple case)."""
+        introduction, options = self.preprocess_parse_result("""
+            Usage: my-fancy-app [OPTIONS]
+
+            Boring description.
+
+            Supported options:
+
+              -h, --help
+
+                Show this message and exit.
+        """)
+        # The following fragments are (expected to be) part of the introduction.
+        assert "Usage: my-fancy-app [OPTIONS]" in introduction
+        assert "Boring description." in introduction
+        assert "Supported options:" in introduction
+        # The following fragments are (expected to be) part of the documented options.
+        assert "-h, --help" in options
+        assert "Show this message and exit." in options
+
+    def test_parse_usage_tricky(self):
+        """Test :func:`humanfriendly.usage.parse_usage()` (a tricky case)."""
+        introduction, options = self.preprocess_parse_result("""
+            Usage: my-fancy-app [OPTIONS]
+
+            Here's the introduction to my-fancy-app. Some of the lines in the
+            introduction start with a command line option just to confuse the
+            parsing algorithm :-)
+
+            For example
+            --an-awesome-option
+            is still part of the introduction.
+
+            Supported options:
+
+              -a, --an-awesome-option
+
+                Explanation why this is an awesome option.
+
+              -b, --a-boring-option
+
+                Explanation why this is a boring option.
+        """)
+        # The following fragments are (expected to be) part of the introduction.
+        assert "Usage: my-fancy-app [OPTIONS]" in introduction
+        assert any('still part of the introduction' in p for p in introduction)
+        assert "Supported options:" in introduction
+        # The following fragments are (expected to be) part of the documented options.
+        assert "-a, --an-awesome-option" in options
+        assert "Explanation why this is an awesome option." in options
+        assert "-b, --a-boring-option" in options
+        assert "Explanation why this is a boring option." in options
+
+    def test_parse_usage_commas(self):
+        """Test :func:`humanfriendly.usage.parse_usage()` against option labels containing commas."""
+        introduction, options = self.preprocess_parse_result("""
+            Usage: my-fancy-app [OPTIONS]
+
+            Some introduction goes here.
+
+            Supported options:
+
+              -f, --first-option
+
+                Explanation of first option.
+
+              -s, --second-option=WITH,COMMA
+
+                This should be a separate option's description.
+        """)
+        # The following fragments are (expected to be) part of the introduction.
+        assert "Usage: my-fancy-app [OPTIONS]" in introduction
+        assert "Some introduction goes here." in introduction
+        assert "Supported options:" in introduction
+        # The following fragments are (expected to be) part of the documented options.
+        assert "-f, --first-option" in options
+        assert "Explanation of first option." in options
+        assert "-s, --second-option=WITH,COMMA" in options
+        assert "This should be a separate option's description." in options
+
+    def preprocess_parse_result(self, text):
+        """Ignore leading/trailing whitespace in usage parsing tests."""
+        return tuple([p.strip() for p in r] for r in parse_usage(dedent(text)))
+
+    def test_format_usage(self):
+        """Test :func:`humanfriendly.usage.format_usage()`."""
+        # Test that options are highlighted.
+        usage_text = "Just one --option"
+        formatted_text = format_usage(usage_text)
+        assert len(formatted_text) > len(usage_text)
+        assert formatted_text.startswith("Just one ")
+        # Test that the "Usage: ..." line is highlighted.
+        usage_text = "Usage: humanfriendly [OPTIONS]"
+        formatted_text = format_usage(usage_text)
+        assert len(formatted_text) > len(usage_text)
+        assert usage_text in formatted_text
+        assert not formatted_text.startswith(usage_text)
+        # Test that meta variables aren't erroneously highlighted.
+        usage_text = (
+            "--valid-option=VALID_METAVAR\n"
+            "VALID_METAVAR is bogus\n"
+            "INVALID_METAVAR should not be highlighted\n"
+        )
+        formatted_text = format_usage(usage_text)
+        formatted_lines = formatted_text.splitlines()
+        # Make sure the meta variable in the second line is highlighted.
+        assert ANSI_CSI in formatted_lines[1]
+        # Make sure the meta variable in the third line isn't highlighted.
+        assert ANSI_CSI not in formatted_lines[2]
+
+    def test_render_usage(self):
+        """Test :func:`humanfriendly.usage.render_usage()`."""
+        assert render_usage("Usage: some-command WITH ARGS") == "**Usage:** `some-command WITH ARGS`"
+        assert render_usage("Supported options:") == "**Supported options:**"
+        assert 'code-block' in render_usage(dedent("""
+            Here comes a shell command:
+
+              $ echo test
+              test
+        """))
+        assert all(token in render_usage(dedent("""
+            Supported options:
+
+              -n, --dry-run
+
+                Don't change anything.
+        """)) for token in ('`-n`', '`--dry-run`'))
+
+    def test_deprecated_args(self):
+        """Test the deprecated_args() decorator function."""
+        @deprecated_args('foo', 'bar')
+        def test_function(**options):
+            assert options['foo'] == 'foo'
+            assert options.get('bar') in (None, 'bar')
+            return 42
+        fake_fn = MagicMock()
+        with PatchedAttribute(warnings, 'warn', fake_fn):
+            assert test_function('foo', 'bar') == 42
+            with self.assertRaises(TypeError):
+                test_function('foo', 'bar', 'baz')
+        assert fake_fn.was_called
+
+    def test_alias_proxy_deprecation_warning(self):
+        """Test that the DeprecationProxy class emits deprecation warnings."""
+        fake_fn = MagicMock()
+        with PatchedAttribute(warnings, 'warn', fake_fn):
+            module = sys.modules[__name__]
+            aliases = dict(concatenate='humanfriendly.text.concatenate')
+            proxy = DeprecationProxy(module, aliases)
+            assert proxy.concatenate == concatenate
+        assert fake_fn.was_called
+
+    def test_alias_proxy_sphinx_compensation(self):
+        """Test that the DeprecationProxy class emits deprecation warnings."""
+        with PatchedItem(sys.modules, 'sphinx', types.ModuleType('sphinx')):
+            define_aliases(__name__, concatenate='humanfriendly.text.concatenate')
+            assert "concatenate" in dir(sys.modules[__name__])
+            assert "concatenate" in get_aliases(__name__)
+
+    def test_alias_proxy_sphinx_integration(self):
+        """Test that aliases can be injected into generated documentation."""
+        module = sys.modules[__name__]
+        define_aliases(__name__, concatenate='humanfriendly.text.concatenate')
+        lines = module.__doc__.splitlines()
+        deprecation_note_callback(app=None, what=None, name=None, obj=module, options=None, lines=lines)
+        # Check that something was injected.
+        assert "\n".join(lines) != module.__doc__
+
+    def test_sphinx_customizations(self):
+        """Test the :mod:`humanfriendly.sphinx` module."""
+        class FakeApp(object):
+
+            def __init__(self):
+                self.callbacks = {}
+                self.roles = {}
+
+            def __documented_special_method__(self):
+                """Documented unofficial special method."""
+                pass
+
+            def __undocumented_special_method__(self):
+                # Intentionally not documented :-).
+                pass
+
+            def add_role(self, name, callback):
+                self.roles[name] = callback
+
+            def connect(self, event, callback):
+                self.callbacks.setdefault(event, []).append(callback)
+
+            def bogus_usage(self):
+                """Usage: This is not supposed to be reformatted!"""
+                pass
+
+        # Test event callback registration.
+        fake_app = FakeApp()
+        setup(fake_app)
+        assert man_role == fake_app.roles['man']
+        assert pypi_role == fake_app.roles['pypi']
+        assert deprecation_note_callback in fake_app.callbacks['autodoc-process-docstring']
+        assert special_methods_callback in fake_app.callbacks['autodoc-skip-member']
+        assert usage_message_callback in fake_app.callbacks['autodoc-process-docstring']
+        # Test that `special methods' which are documented aren't skipped.
+        assert special_methods_callback(
+            app=None, what=None, name=None,
+            obj=FakeApp.__documented_special_method__,
+            skip=True, options=None,
+        ) is False
+        # Test that `special methods' which are undocumented are skipped.
+        assert special_methods_callback(
+            app=None, what=None, name=None,
+            obj=FakeApp.__undocumented_special_method__,
+            skip=True, options=None,
+        ) is True
+        # Test formatting of usage messages. obj/lines
+        from humanfriendly import cli, sphinx
+        # We expect the docstring in the `cli' module to be reformatted
+        # (because it contains a usage message in the expected format).
+        assert self.docstring_is_reformatted(cli)
+        # We don't expect the docstring in the `sphinx' module to be
+        # reformatted (because it doesn't contain a usage message).
+        assert not self.docstring_is_reformatted(sphinx)
+        # We don't expect the docstring of the following *method* to be
+        # reformatted because only *module* docstrings should be reformatted.
+        assert not self.docstring_is_reformatted(fake_app.bogus_usage)
+
+    def docstring_is_reformatted(self, entity):
+        """Check whether :func:`.usage_message_callback()` reformats a module's docstring."""
+        lines = trim_empty_lines(entity.__doc__).splitlines()
+        saved_lines = list(lines)
+        usage_message_callback(
+            app=None, what=None, name=None,
+            obj=entity, options=None, lines=lines,
+        )
+        return lines != saved_lines
+
+
+def normalize_timestamp(value, ndigits=1):
+    """
+    Round timestamps to the given number of digits.
+
+    This helps to make the test suite less sensitive to timing issues caused by
+    multitasking, processor scheduling, etc.
+    """
+    return '%.2f' % round(float(value), ndigits=ndigits)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/text.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/text.py
new file mode 100644
index 0000000000000000000000000000000000000000..a257a6a189ff70c95567e7765f8ed530bafca8c2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/text.py
@@ -0,0 +1,449 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: December 1, 2020
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Simple text manipulation functions.
+
+The :mod:`~humanfriendly.text` module contains simple functions to manipulate text:
+
+- The :func:`concatenate()` and :func:`pluralize()` functions make it easy to
+  generate human friendly output.
+
+- The :func:`format()`, :func:`compact()` and :func:`dedent()` functions
+  provide a clean and simple to use syntax for composing large text fragments
+  with interpolated variables.
+
+- The :func:`tokenize()` function parses simple user input.
+"""
+
+# Standard library modules.
+import numbers
+import random
+import re
+import string
+import textwrap
+
+# Public identifiers that require documentation.
+__all__ = (
+    'compact',
+    'compact_empty_lines',
+    'concatenate',
+    'dedent',
+    'format',
+    'generate_slug',
+    'is_empty_line',
+    'join_lines',
+    'pluralize',
+    'pluralize_raw',
+    'random_string',
+    'split',
+    'split_paragraphs',
+    'tokenize',
+    'trim_empty_lines',
+)
+
+
+def compact(text, *args, **kw):
+    '''
+    Compact whitespace in a string.
+
+    Trims leading and trailing whitespace, replaces runs of whitespace
+    characters with a single space and interpolates any arguments using
+    :func:`format()`.
+
+    :param text: The text to compact (a string).
+    :param args: Any positional arguments are interpolated using :func:`format()`.
+    :param kw: Any keyword arguments are interpolated using :func:`format()`.
+    :returns: The compacted text (a string).
+
+    Here's an example of how I like to use the :func:`compact()` function, this
+    is an example from a random unrelated project I'm working on at the moment::
+
+        raise PortDiscoveryError(compact("""
+            Failed to discover port(s) that Apache is listening on!
+            Maybe I'm parsing the wrong configuration file? ({filename})
+        """, filename=self.ports_config))
+
+    The combination of :func:`compact()` and Python's multi line strings allows
+    me to write long text fragments with interpolated variables that are easy
+    to write, easy to read and work well with Python's whitespace
+    sensitivity.
+    '''
+    non_whitespace_tokens = text.split()
+    compacted_text = ' '.join(non_whitespace_tokens)
+    return format(compacted_text, *args, **kw)
+
+
+def compact_empty_lines(text):
+    """
+    Replace repeating empty lines with a single empty line (similar to ``cat -s``).
+
+    :param text: The text in which to compact empty lines (a string).
+    :returns: The text with empty lines compacted (a string).
+    """
+    i = 0
+    lines = text.splitlines(True)
+    while i < len(lines):
+        if i > 0 and is_empty_line(lines[i - 1]) and is_empty_line(lines[i]):
+            lines.pop(i)
+        else:
+            i += 1
+    return ''.join(lines)
+
+
+def concatenate(items, conjunction='and', serial_comma=False):
+    """
+    Concatenate a list of items in a human friendly way.
+
+    :param items:
+
+        A sequence of strings.
+
+    :param conjunction:
+
+        The word to use before the last item (a string, defaults to "and").
+
+    :param serial_comma:
+
+        :data:`True` to use a `serial comma`_, :data:`False` otherwise
+        (defaults to :data:`False`).
+
+    :returns:
+
+        A single string.
+
+    >>> from humanfriendly.text import concatenate
+    >>> concatenate(["eggs", "milk", "bread"])
+    'eggs, milk and bread'
+
+    .. _serial comma: https://en.wikipedia.org/wiki/Serial_comma
+    """
+    items = list(items)
+    if len(items) > 1:
+        final_item = items.pop()
+        formatted = ', '.join(items)
+        if serial_comma:
+            formatted += ','
+        return ' '.join([formatted, conjunction, final_item])
+    elif items:
+        return items[0]
+    else:
+        return ''
+
+
+def dedent(text, *args, **kw):
+    """
+    Dedent a string (remove common leading whitespace from all lines).
+
+    Removes common leading whitespace from all lines in the string using
+    :func:`textwrap.dedent()`, removes leading and trailing empty lines using
+    :func:`trim_empty_lines()` and interpolates any arguments using
+    :func:`format()`.
+
+    :param text: The text to dedent (a string).
+    :param args: Any positional arguments are interpolated using :func:`format()`.
+    :param kw: Any keyword arguments are interpolated using :func:`format()`.
+    :returns: The dedented text (a string).
+
+    The :func:`compact()` function's documentation contains an example of how I
+    like to use the :func:`compact()` and :func:`dedent()` functions. The main
+    difference is that I use :func:`compact()` for text that will be presented
+    to the user (where whitespace is not so significant) and :func:`dedent()`
+    for data file and code generation tasks (where newlines and indentation are
+    very significant).
+    """
+    dedented_text = textwrap.dedent(text)
+    trimmed_text = trim_empty_lines(dedented_text)
+    return format(trimmed_text, *args, **kw)
+
+
+def format(text, *args, **kw):
+    """
+    Format a string using the string formatting operator and/or :meth:`str.format()`.
+
+    :param text: The text to format (a string).
+    :param args: Any positional arguments are interpolated into the text using
+                 the string formatting operator (``%``). If no positional
+                 arguments are given no interpolation is done.
+    :param kw: Any keyword arguments are interpolated into the text using the
+               :meth:`str.format()` function. If no keyword arguments are given
+               no interpolation is done.
+    :returns: The text with any positional and/or keyword arguments
+              interpolated (a string).
+
+    The implementation of this function is so trivial that it seems silly to
+    even bother writing and documenting it. Justifying this requires some
+    context :-).
+
+    **Why format() instead of the string formatting operator?**
+
+    For really simple string interpolation Python's string formatting operator
+    is ideal, but it does have some strange quirks:
+
+    - When you switch from interpolating a single value to interpolating
+      multiple values you have to wrap them in tuple syntax. Because
+      :func:`format()` takes a `variable number of arguments`_ it always
+      receives a tuple (which saves me a context switch :-). Here's an
+      example:
+
+      >>> from humanfriendly.text import format
+      >>> # The string formatting operator.
+      >>> print('the magic number is %s' % 42)
+      the magic number is 42
+      >>> print('the magic numbers are %s and %s' % (12, 42))
+      the magic numbers are 12 and 42
+      >>> # The format() function.
+      >>> print(format('the magic number is %s', 42))
+      the magic number is 42
+      >>> print(format('the magic numbers are %s and %s', 12, 42))
+      the magic numbers are 12 and 42
+
+    - When you interpolate a single value and someone accidentally passes in a
+      tuple your code raises a :exc:`~exceptions.TypeError`. Because
+      :func:`format()` takes a `variable number of arguments`_ it always
+      receives a tuple so this can never happen. Here's an example:
+
+      >>> # How expecting to interpolate a single value can fail.
+      >>> value = (12, 42)
+      >>> print('the magic value is %s' % value)
+      Traceback (most recent call last):
+        File "<stdin>", line 1, in <module>
+      TypeError: not all arguments converted during string formatting
+      >>> # The following line works as intended, no surprises here!
+      >>> print(format('the magic value is %s', value))
+      the magic value is (12, 42)
+
+    **Why format() instead of the str.format() method?**
+
+    When you're doing complex string interpolation the :meth:`str.format()`
+    function results in more readable code, however I frequently find myself
+    adding parentheses to force evaluation order. The :func:`format()` function
+    avoids this because of the relative priority between the comma and dot
+    operators. Here's an example:
+
+    >>> "{adjective} example" + " " + "(can't think of anything less {adjective})".format(adjective='silly')
+    "{adjective} example (can't think of anything less silly)"
+    >>> ("{adjective} example" + " " + "(can't think of anything less {adjective})").format(adjective='silly')
+    "silly example (can't think of anything less silly)"
+    >>> format("{adjective} example" + " " + "(can't think of anything less {adjective})", adjective='silly')
+    "silly example (can't think of anything less silly)"
+
+    The :func:`compact()` and :func:`dedent()` functions are wrappers that
+    combine :func:`format()` with whitespace manipulation to make it easy to
+    write nice to read Python code.
+
+    .. _variable number of arguments: https://docs.python.org/2/tutorial/controlflow.html#arbitrary-argument-lists
+    """
+    if args:
+        text %= args
+    if kw:
+        text = text.format(**kw)
+    return text
+
+
+def generate_slug(text, delimiter="-"):
+    """
+    Convert text to a normalized "slug" without whitespace.
+
+    :param text: The original text, for example ``Some Random Text!``.
+    :param delimiter: The delimiter used to separate words
+                      (defaults to the ``-`` character).
+    :returns: The slug text, for example ``some-random-text``.
+    :raises: :exc:`~exceptions.ValueError` when the provided
+             text is nonempty but results in an empty slug.
+    """
+    slug = text.lower()
+    escaped = delimiter.replace("\\", "\\\\")
+    slug = re.sub("[^a-z0-9]+", escaped, slug)
+    slug = slug.strip(delimiter)
+    if text and not slug:
+        msg = "The provided text %r results in an empty slug!"
+        raise ValueError(format(msg, text))
+    return slug
+
+
+def is_empty_line(text):
+    """
+    Check if a text is empty or contains only whitespace.
+
+    :param text: The text to check for "emptiness" (a string).
+    :returns: :data:`True` if the text is empty or contains only whitespace,
+              :data:`False` otherwise.
+    """
+    return len(text) == 0 or text.isspace()
+
+
+def join_lines(text):
+    """
+    Remove "hard wrapping" from the paragraphs in a string.
+
+    :param text: The text to reformat (a string).
+    :returns: The text without hard wrapping (a string).
+
+    This function works by removing line breaks when the last character before
+    a line break and the first character after the line break are both
+    non-whitespace characters. This means that common leading indentation will
+    break :func:`join_lines()` (in that case you can use :func:`dedent()`
+    before calling :func:`join_lines()`).
+    """
+    return re.sub(r'(\S)\n(\S)', r'\1 \2', text)
+
+
+def pluralize(count, singular, plural=None):
+    """
+    Combine a count with the singular or plural form of a word.
+
+    :param count: The count (a number).
+    :param singular: The singular form of the word (a string).
+    :param plural: The plural form of the word (a string or :data:`None`).
+    :returns: The count and singular or plural word concatenated (a string).
+
+    See :func:`pluralize_raw()` for the logic underneath :func:`pluralize()`.
+    """
+    return '%s %s' % (count, pluralize_raw(count, singular, plural))
+
+
+def pluralize_raw(count, singular, plural=None):
+    """
+    Select the singular or plural form of a word based on a count.
+
+    :param count: The count (a number).
+    :param singular: The singular form of the word (a string).
+    :param plural: The plural form of the word (a string or :data:`None`).
+    :returns: The singular or plural form of the word (a string).
+
+    When the given count is exactly 1.0 the singular form of the word is
+    selected, in all other cases the plural form of the word is selected.
+
+    If the plural form of the word is not provided it is obtained by
+    concatenating the singular form of the word with the letter "s". Of course
+    this will not always be correct, which is why you have the option to
+    specify both forms.
+    """
+    if not plural:
+        plural = singular + 's'
+    return singular if float(count) == 1.0 else plural
+
+
+def random_string(length=(25, 100), characters=string.ascii_letters):
+    """random_string(length=(25, 100), characters=string.ascii_letters)
+    Generate a random string.
+
+    :param length: The length of the string to be generated (a number or a
+                   tuple with two numbers). If this is a tuple then a random
+                   number between the two numbers given in the tuple is used.
+    :param characters: The characters to be used (a string, defaults
+                       to :data:`string.ascii_letters`).
+    :returns: A random string.
+
+    The :func:`random_string()` function is very useful in test suites; by the
+    time I included it in :mod:`humanfriendly.text` I had already included
+    variants of this function in seven different test suites :-).
+    """
+    if not isinstance(length, numbers.Number):
+        length = random.randint(length[0], length[1])
+    return ''.join(random.choice(characters) for _ in range(length))
+
+
+def split(text, delimiter=','):
+    """
+    Split a comma-separated list of strings.
+
+    :param text: The text to split (a string).
+    :param delimiter: The delimiter to split on (a string).
+    :returns: A list of zero or more nonempty strings.
+
+    Here's the default behavior of Python's built in :meth:`str.split()`
+    function:
+
+    >>> 'foo,bar, baz,'.split(',')
+    ['foo', 'bar', ' baz', '']
+
+    In contrast here's the default behavior of the :func:`split()` function:
+
+    >>> from humanfriendly.text import split
+    >>> split('foo,bar, baz,')
+    ['foo', 'bar', 'baz']
+
+    Here is an example that parses a nested data structure (a mapping of
+    logging level names to one or more styles per level) that's encoded in a
+    string so it can be set as an environment variable:
+
+    >>> from pprint import pprint
+    >>> encoded_data = 'debug=green;warning=yellow;error=red;critical=red,bold'
+    >>> parsed_data = dict((k, split(v, ',')) for k, v in (split(kv, '=') for kv in split(encoded_data, ';')))
+    >>> pprint(parsed_data)
+    {'debug': ['green'],
+     'warning': ['yellow'],
+     'error': ['red'],
+     'critical': ['red', 'bold']}
+    """
+    return [token.strip() for token in text.split(delimiter) if token and not token.isspace()]
+
+
+def split_paragraphs(text):
+    """
+    Split a string into paragraphs (one or more lines delimited by an empty line).
+
+    :param text: The text to split into paragraphs (a string).
+    :returns: A list of strings.
+    """
+    paragraphs = []
+    for chunk in text.split('\n\n'):
+        chunk = trim_empty_lines(chunk)
+        if chunk and not chunk.isspace():
+            paragraphs.append(chunk)
+    return paragraphs
+
+
+def tokenize(text):
+    """
+    Tokenize a text into numbers and strings.
+
+    :param text: The text to tokenize (a string).
+    :returns: A list of strings and/or numbers.
+
+    This function is used to implement robust tokenization of user input in
+    functions like :func:`.parse_size()` and :func:`.parse_timespan()`. It
+    automatically coerces integer and floating point numbers, ignores
+    whitespace and knows how to separate numbers from strings even without
+    whitespace. Some examples to make this more concrete:
+
+    >>> from humanfriendly.text import tokenize
+    >>> tokenize('42')
+    [42]
+    >>> tokenize('42MB')
+    [42, 'MB']
+    >>> tokenize('42.5MB')
+    [42.5, 'MB']
+    >>> tokenize('42.5 MB')
+    [42.5, 'MB']
+    """
+    tokenized_input = []
+    for token in re.split(r'(\d+(?:\.\d+)?)', text):
+        token = token.strip()
+        if re.match(r'\d+\.\d+', token):
+            tokenized_input.append(float(token))
+        elif token.isdigit():
+            tokenized_input.append(int(token))
+        elif token:
+            tokenized_input.append(token)
+    return tokenized_input
+
+
+def trim_empty_lines(text):
+    """
+    Trim leading and trailing empty lines from the given text.
+
+    :param text: The text to trim (a string).
+    :returns: The trimmed text (a string).
+    """
+    lines = text.splitlines(True)
+    while lines and is_empty_line(lines[0]):
+        lines.pop(0)
+    while lines and is_empty_line(lines[-1]):
+        lines.pop(-1)
+    return ''.join(lines)
diff --git a/TP03/TP03/lib/python3.9/site-packages/humanfriendly/usage.py b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/usage.py
new file mode 100644
index 0000000000000000000000000000000000000000..81ba943ae094854da1392380308b683bbbc23058
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/humanfriendly/usage.py
@@ -0,0 +1,351 @@
+# Human friendly input/output in Python.
+#
+# Author: Peter Odding <peter@peterodding.com>
+# Last Change: June 11, 2021
+# URL: https://humanfriendly.readthedocs.io
+
+"""
+Parsing and reformatting of usage messages.
+
+The :mod:`~humanfriendly.usage` module parses and reformats usage messages:
+
+- The :func:`format_usage()` function takes a usage message and inserts ANSI
+  escape sequences that highlight items of special significance like command
+  line options, meta variables, etc. The resulting usage message is (intended
+  to be) easier to read on a terminal.
+
+- The :func:`render_usage()` function takes a usage message and rewrites it to
+  reStructuredText_ suitable for inclusion in the documentation of a Python
+  package. This provides a DRY solution to keeping a single authoritative
+  definition of the usage message while making it easily available in
+  documentation. As a cherry on the cake it's not just a pre-formatted dump of
+  the usage message but a nicely formatted reStructuredText_ fragment.
+
+- The remaining functions in this module support the two functions above.
+
+Usage messages in general are free format of course, however the functions in
+this module assume a certain structure from usage messages in order to
+successfully parse and reformat them, refer to :func:`parse_usage()` for
+details.
+
+.. _DRY: https://en.wikipedia.org/wiki/Don%27t_repeat_yourself
+.. _reStructuredText: https://en.wikipedia.org/wiki/ReStructuredText
+"""
+
+# Standard library modules.
+import csv
+import functools
+import logging
+import re
+
+# Standard library module or external dependency (see setup.py).
+from importlib import import_module
+
+# Modules included in our package.
+from humanfriendly.compat import StringIO
+from humanfriendly.text import dedent, split_paragraphs, trim_empty_lines
+
+# Public identifiers that require documentation.
+__all__ = (
+    'find_meta_variables',
+    'format_usage',
+    'import_module',  # previously exported (backwards compatibility)
+    'inject_usage',
+    'parse_usage',
+    'render_usage',
+    'USAGE_MARKER',
+)
+
+USAGE_MARKER = "Usage:"
+"""The string that starts the first line of a usage message."""
+
+START_OF_OPTIONS_MARKER = "Supported options:"
+"""The string that marks the start of the documented command line options."""
+
+# Compiled regular expression used to tokenize usage messages.
+USAGE_PATTERN = re.compile(r'''
+    # Make sure whatever we're matching isn't preceded by a non-whitespace
+    # character.
+    (?<!\S)
+    (
+        # A short command line option or a long command line option
+        # (possibly including a meta variable for a value).
+        (-\w|--\w+(-\w+)*(=\S+)?)
+        # Or ...
+        |
+        # An environment variable.
+        \$[A-Za-z_][A-Za-z0-9_]*
+        # Or ...
+        |
+        # Might be a meta variable (usage() will figure it out).
+        [A-Z][A-Z0-9_]+
+    )
+''', re.VERBOSE)
+
+# Compiled regular expression used to recognize options.
+OPTION_PATTERN = re.compile(r'^(-\w|--\w+(-\w+)*(=\S+)?)$')
+
+# Initialize a logger for this module.
+logger = logging.getLogger(__name__)
+
+
+def format_usage(usage_text):
+    """
+    Highlight special items in a usage message.
+
+    :param usage_text: The usage message to process (a string).
+    :returns: The usage message with special items highlighted.
+
+    This function highlights the following special items:
+
+    - The initial line of the form "Usage: ..."
+    - Short and long command line options
+    - Environment variables
+    - Meta variables (see :func:`find_meta_variables()`)
+
+    All items are highlighted in the color defined by
+    :data:`.HIGHLIGHT_COLOR`.
+    """
+    # Ugly workaround to avoid circular import errors due to interdependencies
+    # between the humanfriendly.terminal and humanfriendly.usage modules.
+    from humanfriendly.terminal import ansi_wrap, HIGHLIGHT_COLOR
+    formatted_lines = []
+    meta_variables = find_meta_variables(usage_text)
+    for line in usage_text.strip().splitlines(True):
+        if line.startswith(USAGE_MARKER):
+            # Highlight the "Usage: ..." line in bold font and color.
+            formatted_lines.append(ansi_wrap(line, color=HIGHLIGHT_COLOR))
+        else:
+            # Highlight options, meta variables and environment variables.
+            formatted_lines.append(replace_special_tokens(
+                line, meta_variables,
+                lambda token: ansi_wrap(token, color=HIGHLIGHT_COLOR),
+            ))
+    return ''.join(formatted_lines)
+
+
+def find_meta_variables(usage_text):
+    """
+    Find the meta variables in the given usage message.
+
+    :param usage_text: The usage message to parse (a string).
+    :returns: A list of strings with any meta variables found in the usage
+              message.
+
+    When a command line option requires an argument, the convention is to
+    format such options as ``--option=ARG``. The text ``ARG`` in this example
+    is the meta variable.
+    """
+    meta_variables = set()
+    for match in USAGE_PATTERN.finditer(usage_text):
+        token = match.group(0)
+        if token.startswith('-'):
+            option, _, value = token.partition('=')
+            if value:
+                meta_variables.add(value)
+    return list(meta_variables)
+
+
+def parse_usage(text):
+    """
+    Parse a usage message by inferring its structure (and making some assumptions :-).
+
+    :param text: The usage message to parse (a string).
+    :returns: A tuple of two lists:
+
+              1. A list of strings with the paragraphs of the usage message's
+                 "introduction" (the paragraphs before the documentation of the
+                 supported command line options).
+
+              2. A list of strings with pairs of command line options and their
+                 descriptions: Item zero is a line listing a supported command
+                 line option, item one is the description of that command line
+                 option, item two is a line listing another supported command
+                 line option, etc.
+
+    Usage messages in general are free format of course, however
+    :func:`parse_usage()` assume a certain structure from usage messages in
+    order to successfully parse them:
+
+    - The usage message starts with a line ``Usage: ...`` that shows a symbolic
+      representation of the way the program is to be invoked.
+
+    - After some free form text a line ``Supported options:`` (surrounded by
+      empty lines) precedes the documentation of the supported command line
+      options.
+
+    - The command line options are documented as follows::
+
+        -v, --verbose
+
+          Make more noise.
+
+      So all of the variants of the command line option are shown together on a
+      separate line, followed by one or more paragraphs describing the option.
+
+    - There are several other minor assumptions, but to be honest I'm not sure if
+      anyone other than me is ever going to use this functionality, so for now I
+      won't list every intricate detail :-).
+
+      If you're curious anyway, refer to the usage message of the `humanfriendly`
+      package (defined in the :mod:`humanfriendly.cli` module) and compare it with
+      the usage message you see when you run ``humanfriendly --help`` and the
+      generated usage message embedded in the readme.
+
+      Feel free to request more detailed documentation if you're interested in
+      using the :mod:`humanfriendly.usage` module outside of the little ecosystem
+      of Python packages that I have been building over the past years.
+    """
+    introduction = []
+    documented_options = []
+    # Split the raw usage message into paragraphs.
+    paragraphs = split_paragraphs(text)
+    # Get the paragraphs that are part of the introduction.
+    while paragraphs:
+        # Check whether we've found the end of the introduction.
+        end_of_intro = (paragraphs[0] == START_OF_OPTIONS_MARKER)
+        # Append the current paragraph to the introduction.
+        introduction.append(paragraphs.pop(0))
+        # Stop after we've processed the complete introduction.
+        if end_of_intro:
+            break
+    logger.debug("Parsed introduction: %s", introduction)
+    # Parse the paragraphs that document command line options.
+    while paragraphs:
+        documented_options.append(dedent(paragraphs.pop(0)))
+        description = []
+        while paragraphs:
+            # Check if the next paragraph starts the documentation of another
+            # command line option. We split on a comma followed by a space so
+            # that our parsing doesn't trip up when the label used for an
+            # option's value contains commas.
+            tokens = [t.strip() for t in re.split(r',\s', paragraphs[0]) if t and not t.isspace()]
+            if all(OPTION_PATTERN.match(t) for t in tokens):
+                break
+            else:
+                description.append(paragraphs.pop(0))
+        # Join the description's paragraphs back together so we can remove
+        # common leading indentation.
+        documented_options.append(dedent('\n\n'.join(description)))
+    logger.debug("Parsed options: %s", documented_options)
+    return introduction, documented_options
+
+
+def render_usage(text):
+    """
+    Reformat a command line program's usage message to reStructuredText_.
+
+    :param text: The plain text usage message (a string).
+    :returns: The usage message rendered to reStructuredText_ (a string).
+    """
+    meta_variables = find_meta_variables(text)
+    introduction, options = parse_usage(text)
+    output = [render_paragraph(p, meta_variables) for p in introduction]
+    if options:
+        output.append('\n'.join([
+            '.. csv-table::',
+            '   :header: Option, Description',
+            '   :widths: 30, 70',
+            '',
+        ]))
+        csv_buffer = StringIO()
+        csv_writer = csv.writer(csv_buffer)
+        while options:
+            variants = options.pop(0)
+            description = options.pop(0)
+            csv_writer.writerow([
+                render_paragraph(variants, meta_variables),
+                ('\n\n'.join(render_paragraph(p, meta_variables) for p in split_paragraphs(description))).rstrip(),
+            ])
+        csv_lines = csv_buffer.getvalue().splitlines()
+        output.append('\n'.join('   %s' % line for line in csv_lines))
+    logger.debug("Rendered output: %s", output)
+    return '\n\n'.join(trim_empty_lines(o) for o in output)
+
+
+def inject_usage(module_name):
+    """
+    Use cog_ to inject a usage message into a reStructuredText_ file.
+
+    :param module_name: The name of the module whose ``__doc__`` attribute is
+                        the source of the usage message (a string).
+
+    This simple wrapper around :func:`render_usage()` makes it very easy to
+    inject a reformatted usage message into your documentation using cog_. To
+    use it you add a fragment like the following to your ``*.rst`` file::
+
+       .. [[[cog
+       .. from humanfriendly.usage import inject_usage
+       .. inject_usage('humanfriendly.cli')
+       .. ]]]
+       .. [[[end]]]
+
+    The lines in the fragment above are single line reStructuredText_ comments
+    that are not copied to the output. Their purpose is to instruct cog_ where
+    to inject the reformatted usage message. Once you've added these lines to
+    your ``*.rst`` file, updating the rendered usage message becomes really
+    simple thanks to cog_:
+
+    .. code-block:: sh
+
+       $ cog.py -r README.rst
+
+    This will inject or replace the rendered usage message in your
+    ``README.rst`` file with an up to date copy.
+
+    .. _cog: http://nedbatchelder.com/code/cog/
+    """
+    import cog
+    usage_text = import_module(module_name).__doc__
+    cog.out("\n" + render_usage(usage_text) + "\n\n")
+
+
+def render_paragraph(paragraph, meta_variables):
+    # Reformat the "Usage:" line to highlight "Usage:" in bold and show the
+    # remainder of the line as pre-formatted text.
+    if paragraph.startswith(USAGE_MARKER):
+        tokens = paragraph.split()
+        return "**%s** `%s`" % (tokens[0], ' '.join(tokens[1:]))
+    # Reformat the "Supported options:" line to highlight it in bold.
+    if paragraph == 'Supported options:':
+        return "**%s**" % paragraph
+    # Reformat shell transcripts into code blocks.
+    if re.match(r'^\s*\$\s+\S', paragraph):
+        # Split the paragraph into lines.
+        lines = paragraph.splitlines()
+        # Check if the paragraph is already indented.
+        if not paragraph[0].isspace():
+            # If the paragraph isn't already indented we'll indent it now.
+            lines = ['  %s' % line for line in lines]
+        lines.insert(0, '.. code-block:: sh')
+        lines.insert(1, '')
+        return "\n".join(lines)
+    # The following reformatting applies only to paragraphs which are not
+    # indented. Yes this is a hack - for now we assume that indented paragraphs
+    # are code blocks, even though this assumption can be wrong.
+    if not paragraph[0].isspace():
+        # Change UNIX style `quoting' so it doesn't trip up DocUtils.
+        paragraph = re.sub("`(.+?)'", r'"\1"', paragraph)
+        # Escape asterisks.
+        paragraph = paragraph.replace('*', r'\*')
+        # Reformat inline tokens.
+        paragraph = replace_special_tokens(
+            paragraph, meta_variables,
+            lambda token: '``%s``' % token,
+        )
+    return paragraph
+
+
+def replace_special_tokens(text, meta_variables, replace_fn):
+    return USAGE_PATTERN.sub(functools.partial(
+        replace_tokens_callback,
+        meta_variables=meta_variables,
+        replace_fn=replace_fn
+    ), text)
+
+
+def replace_tokens_callback(match, meta_variables, replace_fn):
+    token = match.group(0)
+    if not (re.match('^[A-Z][A-Z0-9_]+$', token) and token not in meta_variables):
+        token = replace_fn(token)
+    return token
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..10e0dcedd556981a2ea6c21acbf7763731992e07
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2020 Jeff Forcier.
+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.
+
+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/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..c3cf0d7dfdd15eeb2d70698da5a0b6b1173fca49
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/METADATA
@@ -0,0 +1,80 @@
+Metadata-Version: 2.1
+Name: invoke
+Version: 2.2.0
+Summary: Pythonic task execution
+Home-page: https://pyinvoke.org
+Author: Jeff Forcier
+Author-email: jeff@bitprophet.org
+License: BSD
+Project-URL: Docs, https://docs.pyinvoke.org
+Project-URL: Source, https://github.com/pyinvoke/invoke
+Project-URL: Issues, https://github.com/pyinvoke/invoke/issues
+Project-URL: Changelog, https://www.pyinvoke.org/changelog.html
+Project-URL: CI, https://app.circleci.com/pipelines/github/pyinvoke/invoke
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Environment :: Console
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: System Administrators
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Unix
+Classifier: Operating System :: MacOS :: MacOS X
+Classifier: Operating System :: Microsoft :: Windows
+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
+Classifier: Topic :: Software Development
+Classifier: Topic :: Software Development :: Build Tools
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Software Development :: Libraries :: Python Modules
+Classifier: Topic :: System :: Software Distribution
+Classifier: Topic :: System :: Systems Administration
+Requires-Python: >=3.6
+License-File: LICENSE
+
+
+|version| |python| |license| |ci| |coverage|
+
+.. |version| image:: https://img.shields.io/pypi/v/invoke
+    :target: https://pypi.org/project/invoke/
+    :alt: PyPI - Package Version
+.. |python| image:: https://img.shields.io/pypi/pyversions/invoke
+    :target: https://pypi.org/project/invoke/
+    :alt: PyPI - Python Version
+.. |license| image:: https://img.shields.io/pypi/l/invoke
+    :target: https://github.com/pyinvoke/invoke/blob/main/LICENSE
+    :alt: PyPI - License
+.. |ci| image:: https://img.shields.io/circleci/build/github/pyinvoke/invoke/main
+    :target: https://app.circleci.com/pipelines/github/pyinvoke/invoke
+    :alt: CircleCI
+.. |coverage| image:: https://img.shields.io/codecov/c/gh/pyinvoke/invoke
+    :target: https://app.codecov.io/gh/pyinvoke/invoke
+    :alt: Codecov
+
+Welcome to Invoke!
+==================
+
+Invoke is a Python (2.7 and 3.4+) library for managing shell-oriented
+subprocesses and organizing executable Python code into CLI-invokable tasks. It
+draws inspiration from various sources (``make``/``rake``, Fabric 1.x, etc) to
+arrive at a powerful & clean feature set.
+
+To find out what's new in this version of Invoke, please see `the changelog
+<https://pyinvoke.org/changelog.html#{}>`_.
+
+The project maintainer keeps a `roadmap
+<https://bitprophet.org/projects#roadmap>`_ on his website.
+
+
+For a high level introduction, including example code, please see `our main
+project website <https://pyinvoke.org>`_; or for detailed API docs, see `the
+versioned API website <https://docs.pyinvoke.org>`_.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..0571f9534c2b514df4d7d28fb969216dc0f14d53
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/RECORD
@@ -0,0 +1,109 @@
+../../../bin/inv,sha256=Xo9TUGST10OqZsdo1a84RZSekMfsRRIJO9Xd8quhvqI,276
+../../../bin/invoke,sha256=Xo9TUGST10OqZsdo1a84RZSekMfsRRIJO9Xd8quhvqI,276
+invoke-2.2.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+invoke-2.2.0.dist-info/LICENSE,sha256=eSL5f4lvHRYeHr9HCD4wSiNjg2GyVcaQK15PNO7aDa0,1314
+invoke-2.2.0.dist-info/METADATA,sha256=A8gbO_OilV6H3PETKvOy3rD4_7wQ2hoaB68XcT5MwFY,3290
+invoke-2.2.0.dist-info/RECORD,,
+invoke-2.2.0.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
+invoke-2.2.0.dist-info/entry_points.txt,sha256=s9qT3Azo8z02_BkakRKhVrx4NOma22jkwCavQD3-nw0,82
+invoke-2.2.0.dist-info/top_level.txt,sha256=ZlTlAVMd8lzn3sXyAhCRi0LNslCasA7rlucRHq9w79w,7
+invoke/__init__.py,sha256=XBXrLV9I81Nq6ELEoN_XAE4vTNmM6Big-1eWt1dQH3k,2229
+invoke/__main__.py,sha256=nwyePAl8dedcetg1CiEQNC0-CHESN0DJy5tK2YEqGeo,47
+invoke/__pycache__/__init__.cpython-39.pyc,,
+invoke/__pycache__/__main__.cpython-39.pyc,,
+invoke/__pycache__/_version.cpython-39.pyc,,
+invoke/__pycache__/collection.cpython-39.pyc,,
+invoke/__pycache__/config.cpython-39.pyc,,
+invoke/__pycache__/context.cpython-39.pyc,,
+invoke/__pycache__/env.cpython-39.pyc,,
+invoke/__pycache__/exceptions.cpython-39.pyc,,
+invoke/__pycache__/executor.cpython-39.pyc,,
+invoke/__pycache__/loader.cpython-39.pyc,,
+invoke/__pycache__/main.cpython-39.pyc,,
+invoke/__pycache__/program.cpython-39.pyc,,
+invoke/__pycache__/runners.cpython-39.pyc,,
+invoke/__pycache__/tasks.cpython-39.pyc,,
+invoke/__pycache__/terminals.cpython-39.pyc,,
+invoke/__pycache__/util.cpython-39.pyc,,
+invoke/__pycache__/watchers.cpython-39.pyc,,
+invoke/_version.py,sha256=ZImePD-iC7cIRpZJK9yXu_CmkAL5Y8erLgGUDKIhH8U,80
+invoke/collection.py,sha256=0Qv9bnfKeUbkAaTLINxrzG9MBrhjwrhd7Rv6v6WgdKI,23060
+invoke/completion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+invoke/completion/__pycache__/__init__.cpython-39.pyc,,
+invoke/completion/__pycache__/complete.cpython-39.pyc,,
+invoke/completion/bash.completion,sha256=OvJRVRvoW7aMDf5qMKidi8x-ND-KkIM5JS5-6iJ3eHE,1356
+invoke/completion/complete.py,sha256=j3Tv2oNrKyuQHPi5tavAUYN5vo8v4vABNl_T9t_0YOY,5222
+invoke/completion/fish.completion,sha256=G28g1dpA-Q9-Q6KmlcGd_6XMw8h7ExHjAJ6ny04ufr8,382
+invoke/completion/zsh.completion,sha256=YiekKS7ZDCIqLmlC31Ht9H95S2n8aNsfnn4bjBcFRLQ,1429
+invoke/config.py,sha256=NGBAmHWoUI_PHBxTAZNtRt2X4P09ouWRRzBdVj3MTac,49653
+invoke/context.py,sha256=k1KbmT2hDk846Su4wUuElZ4nXIYXYjqeIxuS0g_0_lc,25486
+invoke/env.py,sha256=T_ejssb-lmdZwPHFjJGH62KnhQKim-ziiWBxM-8ejW8,4394
+invoke/exceptions.py,sha256=e5vwp9cJS8teQK30WLY4ICKU8ateSUexU6BuFnEllDA,12227
+invoke/executor.py,sha256=T_iQ6uNTC2Z_LB7WWVxV4ab0jvYVKoKO_3hCFQ3FBlA,8855
+invoke/loader.py,sha256=C5dtubZRfjEdaF8WUi3blZjQxv8yGCtvipXrMMMSG4Y,6005
+invoke/main.py,sha256=njYYo2anK4krAE4mCV9Z9I1bRJFaOCp-UBL1vRE-Wq4,235
+invoke/parser/__init__.py,sha256=HpSB_sx2aZrCOUy5Cl_LMyfCBuGwrB9-d1OS4821Dzs,181
+invoke/parser/__pycache__/__init__.cpython-39.pyc,,
+invoke/parser/__pycache__/argument.cpython-39.pyc,,
+invoke/parser/__pycache__/context.cpython-39.pyc,,
+invoke/parser/__pycache__/parser.cpython-39.pyc,,
+invoke/parser/argument.py,sha256=eyIGaOtjyEz2M2BMiIz0cvn8J6zinpUhgxoXexJzHpk,6045
+invoke/parser/context.py,sha256=NaqvcN4E9W-7Ems48tJzIedBqcrZnbR41TA_rSE5JGo,9815
+invoke/parser/parser.py,sha256=g99NcgzHGfEjsNzwyFmAo_MRhqlGf82SXXBzOZXr6Rw,19809
+invoke/program.py,sha256=oBrtCjtAdycz3UDCJM5vTrdHE37SL7UPw-AzzcwWsRU,38177
+invoke/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+invoke/runners.py,sha256=4WJHoj8UFggD6e-F12hFsTiHTHBO5fHEZZAIduFNWNo,65509
+invoke/tasks.py,sha256=FBj_EStMXfQ0Y9Nw8gPctRxwKp4Lya8QdnrDklVVJVk,19946
+invoke/terminals.py,sha256=8ghVNgaMTInOg-8lp7-TRMWpXqgH_MTNuW2VEmTBAyA,8065
+invoke/util.py,sha256=NKjJoZA4Tb8VzAvr58gIAWvQBaTFDKRg3bjRSxdeMcs,10018
+invoke/vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+invoke/vendor/__pycache__/__init__.cpython-39.pyc,,
+invoke/vendor/fluidity/__init__.py,sha256=f5SF3sMYo71808nX-9bJt0pb5-BCZ2srikX1aCqczpw,196
+invoke/vendor/fluidity/__pycache__/__init__.cpython-39.pyc,,
+invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-39.pyc,,
+invoke/vendor/fluidity/__pycache__/machine.cpython-39.pyc,,
+invoke/vendor/fluidity/backwardscompat.py,sha256=P_qC1dIhIHq6LQYDGxWed-V8o3viMcPOYv4mx0NY52U,135
+invoke/vendor/fluidity/machine.py,sha256=9ZhzmAg-3Q_5jCWHOih1WtoTMAKhkgT2EePkXW-258M,8686
+invoke/vendor/lexicon/__init__.py,sha256=iFssP2WfLyW5pmp4EDFvd_63zvAyZ_7YKh2nrfbvlHY,1133
+invoke/vendor/lexicon/__pycache__/__init__.cpython-39.pyc,,
+invoke/vendor/lexicon/__pycache__/_version.cpython-39.pyc,,
+invoke/vendor/lexicon/__pycache__/alias_dict.cpython-39.pyc,,
+invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-39.pyc,,
+invoke/vendor/lexicon/_version.py,sha256=GFgEreRHgT-8UlwM974VYEId1Wj19fqMAk-hpObAjeI,80
+invoke/vendor/lexicon/alias_dict.py,sha256=gsSlVPy3wt5HGJSzjhdBiMVcPnIuVLU3Sl1VbybVs5w,3223
+invoke/vendor/lexicon/attribute_dict.py,sha256=j2myombp3ZH3fTOy4RhVAyZXrP_-1iwVqdenEvY2u-Q,407
+invoke/vendor/yaml/__init__.py,sha256=gfp2CbRVhzknghkiiJD2l6Z0pI-mv_iZHPSJ4aj0-nY,13170
+invoke/vendor/yaml/__pycache__/__init__.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/composer.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/constructor.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/cyaml.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/dumper.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/emitter.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/error.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/events.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/loader.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/nodes.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/parser.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/reader.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/representer.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/resolver.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/scanner.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/serializer.cpython-39.pyc,,
+invoke/vendor/yaml/__pycache__/tokens.cpython-39.pyc,,
+invoke/vendor/yaml/composer.py,sha256=_Ko30Wr6eDWUeUpauUGT3Lcg9QPBnOPVlTnIMRGJ9FM,4883
+invoke/vendor/yaml/constructor.py,sha256=kNgkfaeLUkwQYY_Q6Ff1Tz2XVw_pG1xVE9Ak7z-viLA,28639
+invoke/vendor/yaml/cyaml.py,sha256=6ZrAG9fAYvdVe2FK_w0hmXoG7ZYsoYUwapG8CiC72H0,3851
+invoke/vendor/yaml/dumper.py,sha256=PLctZlYwZLp7XmeUdwRuv4nYOZ2UBnDIUy8-lKfLF-o,2837
+invoke/vendor/yaml/emitter.py,sha256=jghtaU7eFwg31bG0B7RZea_29Adi9CKmXq_QjgQpCkQ,43006
+invoke/vendor/yaml/error.py,sha256=Ah9z-toHJUbE9j-M8YpxgSRM5CgLCcwVzJgLLRF2Fxo,2533
+invoke/vendor/yaml/events.py,sha256=50_TksgQiE4up-lKo_V-nBy-tAIxkIPQxY5qDhKCeHw,2445
+invoke/vendor/yaml/loader.py,sha256=UVa-zIqmkFSCIYq_PgSGm4NSJttHY2Rf_zQ4_b1fHN0,2061
+invoke/vendor/yaml/nodes.py,sha256=gPKNj8pKCdh2d4gr3gIYINnPOaOxGhJAUiYhGRnPE84,1440
+invoke/vendor/yaml/parser.py,sha256=ilWp5vvgoHFGzvOZDItFoGjD6D42nhlZrZyjAwa0oJo,25495
+invoke/vendor/yaml/reader.py,sha256=0dmzirOiDG4Xo41RnuQS7K9rkY3xjHiVasfDMNTqCNw,6794
+invoke/vendor/yaml/representer.py,sha256=82UM3ZxUQKqsKAF4ltWOxCS6jGPIFtXpGs7mvqyv4Xs,14184
+invoke/vendor/yaml/resolver.py,sha256=Z1W8AOMA6Proy4gIO2OhUO4IPS_bFNAl0Ca3rwChpPg,8999
+invoke/vendor/yaml/scanner.py,sha256=KeQIKGNlSyPE8QDwionHxy9CgbqE5teJEz05FR9-nAg,51277
+invoke/vendor/yaml/serializer.py,sha256=ChuFgmhU01hj4xgI8GaKv6vfM2Bujwa9i7d2FAHj7cA,4165
+invoke/vendor/yaml/tokens.py,sha256=lTQIzSVw8Mg9wv459-TjiOQe6wVziqaRlqX2_89rp54,2573
+invoke/watchers.py,sha256=E8CB8ikiXFw-15snsFnbZjwq-exFMqNqFOqkGgcsqLs,5097
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..becc9a66ea739ba941d48a749e248761cc6e658a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.37.1)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..1e8edcd7d7e2ac986ccffb0efa31c2900a81f100
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/entry_points.txt
@@ -0,0 +1,4 @@
+[console_scripts]
+inv = invoke.main:program.run
+invoke = invoke.main:program.run
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..460820dae255358ffcce95fac8a3ba5e7cade295
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke-2.2.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+invoke
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b707267590f58603d629d6dc7eaab260da59d703
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/__init__.py
@@ -0,0 +1,70 @@
+from typing import Any, Optional
+
+from ._version import __version_info__, __version__  # noqa
+from .collection import Collection  # noqa
+from .config import Config  # noqa
+from .context import Context, MockContext  # noqa
+from .exceptions import (  # noqa
+    AmbiguousEnvVar,
+    AuthFailure,
+    CollectionNotFound,
+    Exit,
+    ParseError,
+    PlatformError,
+    ResponseNotAccepted,
+    SubprocessPipeError,
+    ThreadException,
+    UncastableEnvVar,
+    UnexpectedExit,
+    UnknownFileType,
+    UnpicklableConfigMember,
+    WatcherError,
+    CommandTimedOut,
+)
+from .executor import Executor  # noqa
+from .loader import FilesystemLoader  # noqa
+from .parser import Argument, Parser, ParserContext, ParseResult  # noqa
+from .program import Program  # noqa
+from .runners import Runner, Local, Failure, Result, Promise  # noqa
+from .tasks import task, call, Call, Task  # noqa
+from .terminals import pty_size  # noqa
+from .watchers import FailingResponder, Responder, StreamWatcher  # noqa
+
+
+def run(command: str, **kwargs: Any) -> Optional[Result]:
+    """
+    Run ``command`` in a subprocess and return a `.Result` object.
+
+    See `.Runner.run` for API details.
+
+    .. note::
+        This function is a convenience wrapper around Invoke's `.Context` and
+        `.Runner` APIs.
+
+        Specifically, it creates an anonymous `.Context` instance and calls its
+        `~.Context.run` method, which in turn defaults to using a `.Local`
+        runner subclass for command execution.
+
+    .. versionadded:: 1.0
+    """
+    return Context().run(command, **kwargs)
+
+
+def sudo(command: str, **kwargs: Any) -> Optional[Result]:
+    """
+    Run ``command`` in a ``sudo`` subprocess and return a `.Result` object.
+
+    See `.Context.sudo` for API details, such as the ``password`` kwarg.
+
+    .. note::
+        This function is a convenience wrapper around Invoke's `.Context` and
+        `.Runner` APIs.
+
+        Specifically, it creates an anonymous `.Context` instance and calls its
+        `~.Context.sudo` method, which in turn defaults to using a `.Local`
+        runner subclass for command execution (plus sudo-related bits &
+        pieces).
+
+    .. versionadded:: 1.4
+    """
+    return Context().sudo(command, **kwargs)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__main__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c8118ca31d523d3078287bf4bc0bc9d07a774e2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/__main__.py
@@ -0,0 +1,3 @@
+from invoke.main import program
+
+program.run()
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a5178bd06bb3eea72477d35750f27350c4a8d690
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__main__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__main__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7138600bd5846d76caf02da34674287fedd0c14b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/__main__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/_version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/_version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fc1bee89050bdb6a71670c72e7d088b1533ac0ea
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/_version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/collection.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/collection.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..56d9b99732526d121c659d375b140a1ec6d6453c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/collection.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/config.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/config.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cf9ce5be6462131184f78270e7c51ba5f87689c0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/config.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/context.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/context.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4d37248312f01aa45a72acfbbd093907533f952d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/context.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/env.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/env.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..94fda9117e35f978d66d168c0758e33fb23f5b3d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/env.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/exceptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/exceptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b11b11567e4de3d4615a52c1bc4b6ca933b8efc9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/exceptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/executor.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/executor.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..75f3dfd1a0157ecaa2d6a31c8cd5de41a7d48c45
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/executor.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/loader.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/loader.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..081f00e3df1f6150c63cbe58c629d5fcb911ca8b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/loader.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/main.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/main.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a530b9e156b3cf857a21b654bef60a7e14ebda52
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/main.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/program.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/program.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4117ec4e223f714a5ea225dda80a0bdb57c86d0a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/program.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/runners.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/runners.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a767a24b61efb1ac5a0fe9ebf3fa5439521d7e3d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/runners.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/tasks.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/tasks.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd2d9c08712551752d3250d2d50edb61d91b8072
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/tasks.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/terminals.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/terminals.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ab9fa7e1f5157b3caff2d2bcb6c675f1f77ff620
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/terminals.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/util.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/util.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..451c333cac333e5321e61db70aa6c570da9355d8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/util.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/watchers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/watchers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4a8a0bc891e81889e9ab4c38691a4f38b9a3ccc6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/__pycache__/watchers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/_version.py b/TP03/TP03/lib/python3.9/site-packages/invoke/_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..8d59ddd65ff324c5af04e9c2403c27a6a42b314c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/_version.py
@@ -0,0 +1,2 @@
+__version_info__ = (2, 2, 0)
+__version__ = ".".join(map(str, __version_info__))
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/collection.py b/TP03/TP03/lib/python3.9/site-packages/invoke/collection.py
new file mode 100644
index 0000000000000000000000000000000000000000..23dcff9283b43584040ba6833c6f18f96a3207b3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/collection.py
@@ -0,0 +1,608 @@
+import copy
+from types import ModuleType
+from typing import Any, Callable, Dict, List, Optional, Tuple
+
+from .util import Lexicon, helpline
+
+from .config import merge_dicts, copy_dict
+from .parser import Context as ParserContext
+from .tasks import Task
+
+
+class Collection:
+    """
+    A collection of executable tasks. See :doc:`/concepts/namespaces`.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, *args: Any, **kwargs: Any) -> None:
+        """
+        Create a new task collection/namespace.
+
+        `.Collection` offers a set of methods for building a collection of
+        tasks from scratch, plus a convenient constructor wrapping said API.
+
+        In either case:
+
+        * The first positional argument may be a string, which (if given) is
+          used as the collection's default name when performing namespace
+          lookups;
+        * A ``loaded_from`` keyword argument may be given, which sets metadata
+          indicating the filesystem path the collection was loaded from. This
+          is used as a guide when loading per-project :ref:`configuration files
+          <config-hierarchy>`.
+        * An ``auto_dash_names`` kwarg may be given, controlling whether task
+          and collection names have underscores turned to dashes in most cases;
+          it defaults to ``True`` but may be set to ``False`` to disable.
+
+          The CLI machinery will pass in the value of the
+          ``tasks.auto_dash_names`` config value to this kwarg.
+
+        **The method approach**
+
+        May initialize with no arguments and use methods (e.g.
+        `.add_task`/`.add_collection`) to insert objects::
+
+            c = Collection()
+            c.add_task(some_task)
+
+        If an initial string argument is given, it is used as the default name
+        for this collection, should it be inserted into another collection as a
+        sub-namespace::
+
+            docs = Collection('docs')
+            docs.add_task(doc_task)
+            ns = Collection()
+            ns.add_task(top_level_task)
+            ns.add_collection(docs)
+            # Valid identifiers are now 'top_level_task' and 'docs.doc_task'
+            # (assuming the task objects were actually named the same as the
+            # variables we're using :))
+
+        For details, see the API docs for the rest of the class.
+
+        **The constructor approach**
+
+        All ``*args`` given to `.Collection` (besides the abovementioned
+        optional positional 'name' argument and ``loaded_from`` kwarg) are
+        expected to be `.Task` or `.Collection` instances which will be passed
+        to `.add_task`/`.add_collection` as appropriate. Module objects are
+        also valid (as they are for `.add_collection`). For example, the below
+        snippet results in the same two task identifiers as the one above::
+
+            ns = Collection(top_level_task, Collection('docs', doc_task))
+
+        If any ``**kwargs`` are given, the keywords are used as the initial
+        name arguments for the respective values::
+
+            ns = Collection(
+                top_level_task=some_other_task,
+                docs=Collection(doc_task)
+            )
+
+        That's exactly equivalent to::
+
+            docs = Collection(doc_task)
+            ns = Collection()
+            ns.add_task(some_other_task, 'top_level_task')
+            ns.add_collection(docs, 'docs')
+
+        See individual methods' API docs for details.
+        """
+        # Initialize
+        self.tasks = Lexicon()
+        self.collections = Lexicon()
+        self.default: Optional[str] = None
+        self.name = None
+        self._configuration: Dict[str, Any] = {}
+        # Specific kwargs if applicable
+        self.loaded_from = kwargs.pop("loaded_from", None)
+        self.auto_dash_names = kwargs.pop("auto_dash_names", None)
+        # splat-kwargs version of default value (auto_dash_names=True)
+        if self.auto_dash_names is None:
+            self.auto_dash_names = True
+        # Name if applicable
+        _args = list(args)
+        if _args and isinstance(args[0], str):
+            self.name = self.transform(_args.pop(0))
+        # Dispatch args/kwargs
+        for arg in _args:
+            self._add_object(arg)
+        # Dispatch kwargs
+        for name, obj in kwargs.items():
+            self._add_object(obj, name)
+
+    def _add_object(self, obj: Any, name: Optional[str] = None) -> None:
+        method: Callable
+        if isinstance(obj, Task):
+            method = self.add_task
+        elif isinstance(obj, (Collection, ModuleType)):
+            method = self.add_collection
+        else:
+            raise TypeError("No idea how to insert {!r}!".format(type(obj)))
+        method(obj, name=name)
+
+    def __repr__(self) -> str:
+        task_names = list(self.tasks.keys())
+        collections = ["{}...".format(x) for x in self.collections.keys()]
+        return "<Collection {!r}: {}>".format(
+            self.name, ", ".join(sorted(task_names) + sorted(collections))
+        )
+
+    def __eq__(self, other: object) -> bool:
+        if isinstance(other, Collection):
+            return (
+                self.name == other.name
+                and self.tasks == other.tasks
+                and self.collections == other.collections
+            )
+        return False
+
+    def __bool__(self) -> bool:
+        return bool(self.task_names)
+
+    @classmethod
+    def from_module(
+        cls,
+        module: ModuleType,
+        name: Optional[str] = None,
+        config: Optional[Dict[str, Any]] = None,
+        loaded_from: Optional[str] = None,
+        auto_dash_names: Optional[bool] = None,
+    ) -> "Collection":
+        """
+        Return a new `.Collection` created from ``module``.
+
+        Inspects ``module`` for any `.Task` instances and adds them to a new
+        `.Collection`, returning it. If any explicit namespace collections
+        exist (named ``ns`` or ``namespace``) a copy of that collection object
+        is preferentially loaded instead.
+
+        When the implicit/default collection is generated, it will be named
+        after the module's ``__name__`` attribute, or its last dotted section
+        if it's a submodule. (I.e. it should usually map to the actual ``.py``
+        filename.)
+
+        Explicitly given collections will only be given that module-derived
+        name if they don't already have a valid ``.name`` attribute.
+
+        If the module has a docstring (``__doc__``) it is copied onto the
+        resulting `.Collection` (and used for display in help, list etc
+        output.)
+
+        :param str name:
+            A string, which if given will override any automatically derived
+            collection name (or name set on the module's root namespace, if it
+            has one.)
+
+        :param dict config:
+            Used to set config options on the newly created `.Collection`
+            before returning it (saving you a call to `.configure`.)
+
+            If the imported module had a root namespace object, ``config`` is
+            merged on top of it (i.e. overriding any conflicts.)
+
+        :param str loaded_from:
+            Identical to the same-named kwarg from the regular class
+            constructor - should be the path where the module was
+            found.
+
+        :param bool auto_dash_names:
+            Identical to the same-named kwarg from the regular class
+            constructor - determines whether emitted names are auto-dashed.
+
+        .. versionadded:: 1.0
+        """
+        module_name = module.__name__.split(".")[-1]
+
+        def instantiate(obj_name: Optional[str] = None) -> "Collection":
+            # Explicitly given name wins over root ns name (if applicable),
+            # which wins over actual module name.
+            args = [name or obj_name or module_name]
+            kwargs = dict(
+                loaded_from=loaded_from, auto_dash_names=auto_dash_names
+            )
+            instance = cls(*args, **kwargs)
+            instance.__doc__ = module.__doc__
+            return instance
+
+        # See if the module provides a default NS to use in lieu of creating
+        # our own collection.
+        for candidate in ("ns", "namespace"):
+            obj = getattr(module, candidate, None)
+            if obj and isinstance(obj, Collection):
+                # TODO: make this into Collection.clone() or similar?
+                ret = instantiate(obj_name=obj.name)
+                ret.tasks = ret._transform_lexicon(obj.tasks)
+                ret.collections = ret._transform_lexicon(obj.collections)
+                ret.default = (
+                    ret.transform(obj.default) if obj.default else None
+                )
+                # Explicitly given config wins over root ns config
+                obj_config = copy_dict(obj._configuration)
+                if config:
+                    merge_dicts(obj_config, config)
+                ret._configuration = obj_config
+                return ret
+        # Failing that, make our own collection from the module's tasks.
+        tasks = filter(lambda x: isinstance(x, Task), vars(module).values())
+        # Again, explicit name wins over implicit one from module path
+        collection = instantiate()
+        for task in tasks:
+            collection.add_task(task)
+        if config:
+            collection.configure(config)
+        return collection
+
+    def add_task(
+        self,
+        task: "Task",
+        name: Optional[str] = None,
+        aliases: Optional[Tuple[str, ...]] = None,
+        default: Optional[bool] = None,
+    ) -> None:
+        """
+        Add `.Task` ``task`` to this collection.
+
+        :param task: The `.Task` object to add to this collection.
+
+        :param name:
+            Optional string name to bind to (overrides the task's own
+            self-defined ``name`` attribute and/or any Python identifier (i.e.
+            ``.func_name``.)
+
+        :param aliases:
+            Optional iterable of additional names to bind the task as, on top
+            of the primary name. These will be used in addition to any aliases
+            the task itself declares internally.
+
+        :param default: Whether this task should be the collection default.
+
+        .. versionadded:: 1.0
+        """
+        if name is None:
+            if task.name:
+                name = task.name
+            # XXX https://github.com/python/mypy/issues/1424
+            elif hasattr(task.body, "func_name"):
+                name = task.body.func_name  # type: ignore
+            elif hasattr(task.body, "__name__"):
+                name = task.__name__
+            else:
+                raise ValueError("Could not obtain a name for this task!")
+        name = self.transform(name)
+        if name in self.collections:
+            err = "Name conflict: this collection has a sub-collection named {!r} already"  # noqa
+            raise ValueError(err.format(name))
+        self.tasks[name] = task
+        for alias in list(task.aliases) + list(aliases or []):
+            self.tasks.alias(self.transform(alias), to=name)
+        if default is True or (default is None and task.is_default):
+            self._check_default_collision(name)
+            self.default = name
+
+    def add_collection(
+        self,
+        coll: "Collection",
+        name: Optional[str] = None,
+        default: Optional[bool] = None,
+    ) -> None:
+        """
+        Add `.Collection` ``coll`` as a sub-collection of this one.
+
+        :param coll: The `.Collection` to add.
+
+        :param str name:
+            The name to attach the collection as. Defaults to the collection's
+            own internal name.
+
+        :param default:
+            Whether this sub-collection('s default task-or-collection) should
+            be the default invocation of the parent collection.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 1.5
+            Added the ``default`` parameter.
+        """
+        # Handle module-as-collection
+        if isinstance(coll, ModuleType):
+            coll = Collection.from_module(coll)
+        # Ensure we have a name, or die trying
+        name = name or coll.name
+        if not name:
+            raise ValueError("Non-root collections must have a name!")
+        name = self.transform(name)
+        # Test for conflict
+        if name in self.tasks:
+            err = "Name conflict: this collection has a task named {!r} already"  # noqa
+            raise ValueError(err.format(name))
+        # Insert
+        self.collections[name] = coll
+        if default:
+            self._check_default_collision(name)
+            self.default = name
+
+    def _check_default_collision(self, name: str) -> None:
+        if self.default:
+            msg = "'{}' cannot be the default because '{}' already is!"
+            raise ValueError(msg.format(name, self.default))
+
+    def _split_path(self, path: str) -> Tuple[str, str]:
+        """
+        Obtain first collection + remainder, of a task path.
+
+        E.g. for ``"subcollection.taskname"``, return ``("subcollection",
+        "taskname")``; for ``"subcollection.nested.taskname"`` return
+        ``("subcollection", "nested.taskname")``, etc.
+
+        An empty path becomes simply ``('', '')``.
+        """
+        parts = path.split(".")
+        coll = parts.pop(0)
+        rest = ".".join(parts)
+        return coll, rest
+
+    def subcollection_from_path(self, path: str) -> "Collection":
+        """
+        Given a ``path`` to a subcollection, return that subcollection.
+
+        .. versionadded:: 1.0
+        """
+        parts = path.split(".")
+        collection = self
+        while parts:
+            collection = collection.collections[parts.pop(0)]
+        return collection
+
+    def __getitem__(self, name: Optional[str] = None) -> Any:
+        """
+        Returns task named ``name``. Honors aliases and subcollections.
+
+        If this collection has a default task, it is returned when ``name`` is
+        empty or ``None``. If empty input is given and no task has been
+        selected as the default, ValueError will be raised.
+
+        Tasks within subcollections should be given in dotted form, e.g.
+        'foo.bar'. Subcollection default tasks will be returned on the
+        subcollection's name.
+
+        .. versionadded:: 1.0
+        """
+        return self.task_with_config(name)[0]
+
+    def _task_with_merged_config(
+        self, coll: str, rest: str, ours: Dict[str, Any]
+    ) -> Tuple[str, Dict[str, Any]]:
+        task, config = self.collections[coll].task_with_config(rest)
+        return task, dict(config, **ours)
+
+    def task_with_config(
+        self, name: Optional[str]
+    ) -> Tuple[str, Dict[str, Any]]:
+        """
+        Return task named ``name`` plus its configuration dict.
+
+        E.g. in a deeply nested tree, this method returns the `.Task`, and a
+        configuration dict created by merging that of this `.Collection` and
+        any nested `Collections <.Collection>`, up through the one actually
+        holding the `.Task`.
+
+        See `~.Collection.__getitem__` for semantics of the ``name`` argument.
+
+        :returns: Two-tuple of (`.Task`, `dict`).
+
+        .. versionadded:: 1.0
+        """
+        # Our top level configuration
+        ours = self.configuration()
+        # Default task for this collection itself
+        if not name:
+            if not self.default:
+                raise ValueError("This collection has no default task.")
+            return self[self.default], ours
+        # Normalize name to the format we're expecting
+        name = self.transform(name)
+        # Non-default tasks within subcollections -> recurse (sorta)
+        if "." in name:
+            coll, rest = self._split_path(name)
+            return self._task_with_merged_config(coll, rest, ours)
+        # Default task for subcollections (via empty-name lookup)
+        if name in self.collections:
+            return self._task_with_merged_config(name, "", ours)
+        # Regular task lookup
+        return self.tasks[name], ours
+
+    def __contains__(self, name: str) -> bool:
+        try:
+            self[name]
+            return True
+        except KeyError:
+            return False
+
+    def to_contexts(
+        self, ignore_unknown_help: Optional[bool] = None
+    ) -> List[ParserContext]:
+        """
+        Returns all contained tasks and subtasks as a list of parser contexts.
+
+        :param bool ignore_unknown_help:
+            Passed on to each task's ``get_arguments()`` method. See the config
+            option by the same name for details.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 1.7
+            Added the ``ignore_unknown_help`` kwarg.
+        """
+        result = []
+        for primary, aliases in self.task_names.items():
+            task = self[primary]
+            result.append(
+                ParserContext(
+                    name=primary,
+                    aliases=aliases,
+                    args=task.get_arguments(
+                        ignore_unknown_help=ignore_unknown_help
+                    ),
+                )
+            )
+        return result
+
+    def subtask_name(self, collection_name: str, task_name: str) -> str:
+        return ".".join(
+            [self.transform(collection_name), self.transform(task_name)]
+        )
+
+    def transform(self, name: str) -> str:
+        """
+        Transform ``name`` with the configured auto-dashes behavior.
+
+        If the collection's ``auto_dash_names`` attribute is ``True``
+        (default), all non leading/trailing underscores are turned into dashes.
+        (Leading/trailing underscores tend to get stripped elsewhere in the
+        stack.)
+
+        If it is ``False``, the inverse is applied - all dashes are turned into
+        underscores.
+
+        .. versionadded:: 1.0
+        """
+        # Short-circuit on anything non-applicable, e.g. empty strings, bools,
+        # None, etc.
+        if not name:
+            return name
+        from_, to = "_", "-"
+        if not self.auto_dash_names:
+            from_, to = "-", "_"
+        replaced = []
+        end = len(name) - 1
+        for i, char in enumerate(name):
+            # Don't replace leading or trailing underscores (+ taking dotted
+            # names into account)
+            # TODO: not 100% convinced of this / it may be exposing a
+            # discrepancy between this level & higher levels which tend to
+            # strip out leading/trailing underscores entirely.
+            if (
+                i not in (0, end)
+                and char == from_
+                and name[i - 1] != "."
+                and name[i + 1] != "."
+            ):
+                char = to
+            replaced.append(char)
+        return "".join(replaced)
+
+    def _transform_lexicon(self, old: Lexicon) -> Lexicon:
+        """
+        Take a Lexicon and apply `.transform` to its keys and aliases.
+
+        :returns: A new Lexicon.
+        """
+        new = Lexicon()
+        # Lexicons exhibit only their real keys in most places, so this will
+        # only grab those, not aliases.
+        for key, value in old.items():
+            # Deepcopy the value so we're not just copying a reference
+            new[self.transform(key)] = copy.deepcopy(value)
+        # Also copy all aliases, which are string-to-string key mappings
+        for key, value in old.aliases.items():
+            new.alias(from_=self.transform(key), to=self.transform(value))
+        return new
+
+    @property
+    def task_names(self) -> Dict[str, List[str]]:
+        """
+        Return all task identifiers for this collection as a one-level dict.
+
+        Specifically, a dict with the primary/"real" task names as the key, and
+        any aliases as a list value.
+
+        It basically collapses the namespace tree into a single
+        easily-scannable collection of invocation strings, and is thus suitable
+        for things like flat-style task listings or transformation into parser
+        contexts.
+
+        .. versionadded:: 1.0
+        """
+        ret = {}
+        # Our own tasks get no prefix, just go in as-is: {name: [aliases]}
+        for name, task in self.tasks.items():
+            ret[name] = list(map(self.transform, task.aliases))
+        # Subcollection tasks get both name + aliases prefixed
+        for coll_name, coll in self.collections.items():
+            for task_name, aliases in coll.task_names.items():
+                aliases = list(
+                    map(lambda x: self.subtask_name(coll_name, x), aliases)
+                )
+                # Tack on collection name to alias list if this task is the
+                # collection's default.
+                if coll.default == task_name:
+                    aliases += (coll_name,)
+                ret[self.subtask_name(coll_name, task_name)] = aliases
+        return ret
+
+    def configuration(self, taskpath: Optional[str] = None) -> Dict[str, Any]:
+        """
+        Obtain merged configuration values from collection & children.
+
+        :param taskpath:
+            (Optional) Task name/path, identical to that used for
+            `~.Collection.__getitem__` (e.g. may be dotted for nested tasks,
+            etc.) Used to decide which path to follow in the collection tree
+            when merging config values.
+
+        :returns: A `dict` containing configuration values.
+
+        .. versionadded:: 1.0
+        """
+        if taskpath is None:
+            return copy_dict(self._configuration)
+        return self.task_with_config(taskpath)[1]
+
+    def configure(self, options: Dict[str, Any]) -> None:
+        """
+        (Recursively) merge ``options`` into the current `.configuration`.
+
+        Options configured this way will be available to all tasks. It is
+        recommended to use unique keys to avoid potential clashes with other
+        config options
+
+        For example, if you were configuring a Sphinx docs build target
+        directory, it's better to use a key like ``'sphinx.target'`` than
+        simply ``'target'``.
+
+        :param options: An object implementing the dictionary protocol.
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        merge_dicts(self._configuration, options)
+
+    def serialized(self) -> Dict[str, Any]:
+        """
+        Return an appropriate-for-serialization version of this object.
+
+        See the documentation for `.Program` and its ``json`` task listing
+        format; this method is the driver for that functionality.
+
+        .. versionadded:: 1.0
+        """
+        return {
+            "name": self.name,
+            "help": helpline(self),
+            "default": self.default,
+            "tasks": [
+                {
+                    "name": self.transform(x.name),
+                    "help": helpline(x),
+                    "aliases": [self.transform(y) for y in x.aliases],
+                }
+                for x in sorted(self.tasks.values(), key=lambda x: x.name)
+            ],
+            "collections": [
+                x.serialized()
+                for x in sorted(
+                    self.collections.values(), key=lambda x: x.name or ""
+                )
+            ],
+        }
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dfc5352a58960eee8cbec39b3682dae0a92468ae
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/complete.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/complete.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d897ec659e40e200d2e659791e7a45f9b76adb96
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/__pycache__/complete.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/bash.completion b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/bash.completion
new file mode 100644
index 0000000000000000000000000000000000000000..55f7c397ca940923c3603037278f9e15d9665f08
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/bash.completion
@@ -0,0 +1,32 @@
+# Invoke tab-completion script to be sourced with Bash shell.
+# Known to work on Bash 3.x, untested on 4.x.
+
+_complete_{binary}() {{
+    local candidates
+
+    # COMP_WORDS contains the entire command string up til now (including
+    # program name).
+    # We hand it to Invoke so it can figure out the current context: spit back
+    # core options, task names, the current task's options, or some combo.
+    candidates=`{binary} --complete -- ${{COMP_WORDS[*]}}`
+
+    # `compgen -W` takes list of valid options & a partial word & spits back
+    # possible matches. Necessary for any partial word completions (vs
+    # completions performed when no partial words are present).
+    #
+    # $2 is the current word or token being tabbed on, either empty string or a
+    # partial word, and thus wants to be compgen'd to arrive at some subset of
+    # our candidate list which actually matches.
+    #
+    # COMPREPLY is the list of valid completions handed back to `complete`.
+    COMPREPLY=( $(compgen -W "${{candidates}}" -- $2) )
+}}
+
+
+# Tell shell builtin to use the above for completing our invocations.
+# * -F: use given function name to generate completions.
+# * -o default: when function generates no results, use filenames.
+# * positional args: program names to complete for.
+complete -F _complete_{binary} -o default {spaced_names}
+
+# vim: set ft=sh :
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/complete.py b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/complete.py
new file mode 100644
index 0000000000000000000000000000000000000000..97e9a959eeb25f549e2d74d9f7d2dec031cba921
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/complete.py
@@ -0,0 +1,129 @@
+"""
+Command-line completion mechanisms, executed by the core ``--complete`` flag.
+"""
+
+from typing import List
+import glob
+import os
+import re
+import shlex
+from typing import TYPE_CHECKING
+
+from ..exceptions import Exit, ParseError
+from ..util import debug, task_name_sort_key
+
+if TYPE_CHECKING:
+    from ..collection import Collection
+    from ..parser import Parser, ParseResult, ParserContext
+
+
+def complete(
+    names: List[str],
+    core: "ParseResult",
+    initial_context: "ParserContext",
+    collection: "Collection",
+    parser: "Parser",
+) -> Exit:
+    # Strip out program name (scripts give us full command line)
+    # TODO: this may not handle path/to/script though?
+    invocation = re.sub(r"^({}) ".format("|".join(names)), "", core.remainder)
+    debug("Completing for invocation: {!r}".format(invocation))
+    # Tokenize (shlex will have to do)
+    tokens = shlex.split(invocation)
+    # Handle flags (partial or otherwise)
+    if tokens and tokens[-1].startswith("-"):
+        tail = tokens[-1]
+        debug("Invocation's tail {!r} is flag-like".format(tail))
+        # Gently parse invocation to obtain 'current' context.
+        # Use last seen context in case of failure (required for
+        # otherwise-invalid partial invocations being completed).
+
+        contexts: List[ParserContext]
+        try:
+            debug("Seeking context name in tokens: {!r}".format(tokens))
+            contexts = parser.parse_argv(tokens)
+        except ParseError as e:
+            msg = "Got parser error ({!r}), grabbing its last-seen context {!r}"  # noqa
+            debug(msg.format(e, e.context))
+            contexts = [e.context] if e.context is not None else []
+        # Fall back to core context if no context seen.
+        debug("Parsed invocation, contexts: {!r}".format(contexts))
+        if not contexts or not contexts[-1]:
+            context = initial_context
+        else:
+            context = contexts[-1]
+        debug("Selected context: {!r}".format(context))
+        # Unknown flags (could be e.g. only partially typed out; could be
+        # wholly invalid; doesn't matter) complete with flags.
+        debug("Looking for {!r} in {!r}".format(tail, context.flags))
+        if tail not in context.flags:
+            debug("Not found, completing with flag names")
+            # Long flags - partial or just the dashes - complete w/ long flags
+            if tail.startswith("--"):
+                for name in filter(
+                    lambda x: x.startswith("--"), context.flag_names()
+                ):
+                    print(name)
+            # Just a dash, completes with all flags
+            elif tail == "-":
+                for name in context.flag_names():
+                    print(name)
+            # Otherwise, it's something entirely invalid (a shortflag not
+            # recognized, or a java style flag like -foo) so return nothing
+            # (the shell will still try completing with files, but that doesn't
+            # hurt really.)
+            else:
+                pass
+        # Known flags complete w/ nothing or tasks, depending
+        else:
+            # Flags expecting values: do nothing, to let default (usually
+            # file) shell completion occur (which we actively want in this
+            # case.)
+            if context.flags[tail].takes_value:
+                debug("Found, and it takes a value, so no completion")
+                pass
+            # Not taking values (eg bools): print task names
+            else:
+                debug("Found, takes no value, printing task names")
+                print_task_names(collection)
+    # If not a flag, is either task name or a flag value, so just complete
+    # task names.
+    else:
+        debug("Last token isn't flag-like, just printing task names")
+        print_task_names(collection)
+    raise Exit
+
+
+def print_task_names(collection: "Collection") -> None:
+    for name in sorted(collection.task_names, key=task_name_sort_key):
+        print(name)
+        # Just stick aliases after the thing they're aliased to. Sorting isn't
+        # so important that it's worth bending over backwards here.
+        for alias in collection.task_names[name]:
+            print(alias)
+
+
+def print_completion_script(shell: str, names: List[str]) -> None:
+    # Grab all .completion files in invoke/completion/. (These used to have no
+    # suffix, but surprise, that's super fragile.
+    completions = {
+        os.path.splitext(os.path.basename(x))[0]: x
+        for x in glob.glob(
+            os.path.join(
+                os.path.dirname(os.path.realpath(__file__)), "*.completion"
+            )
+        )
+    }
+    try:
+        path = completions[shell]
+    except KeyError:
+        err = 'Completion for shell "{}" not supported (options are: {}).'
+        raise ParseError(err.format(shell, ", ".join(sorted(completions))))
+    debug("Printing completion script from {}".format(path))
+    # Choose one arbitrary program name for script's own internal invocation
+    # (also used to construct completion function names when necessary)
+    binary = names[0]
+    with open(path, "r") as script:
+        print(
+            script.read().format(binary=binary, spaced_names=" ".join(names))
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/fish.completion b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/fish.completion
new file mode 100644
index 0000000000000000000000000000000000000000..5f479a187045dec2322e451010d8dde965065fd8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/fish.completion
@@ -0,0 +1,10 @@
+# Invoke tab-completion script for the fish shell
+# Copy it to the ~/.config/fish/completions directory
+
+function __complete_{binary}
+    {binary} --complete -- (commandline --tokenize)
+end
+
+# --no-files: Don't complete files unless invoke gives an empty result
+# TODO: find a way to honor all binary_names
+complete --command {binary} --no-files --arguments '(__complete_{binary})'
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/completion/zsh.completion b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/zsh.completion
new file mode 100644
index 0000000000000000000000000000000000000000..2fb7d1253af08ab31040145a1013f200c26eb22e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/completion/zsh.completion
@@ -0,0 +1,33 @@
+# Invoke tab-completion script to be sourced with the Z shell.
+# Known to work on zsh 5.0.x, probably works on later 4.x releases as well (as
+# it uses the older compctl completion system).
+
+_complete_{binary}() {{
+    # `words` contains the entire command string up til now (including
+    # program name).
+    #
+    # We hand it to Invoke so it can figure out the current context: spit back
+    # core options, task names, the current task's options, or some combo.
+    #
+    # Before doing so, we attempt to tease out any collection flag+arg so we
+    # can ensure it is applied correctly.
+    collection_arg=''
+    if [[ "${{words}}" =~ "(-c|--collection) [^ ]+" ]]; then
+        collection_arg=$MATCH
+    fi
+    # `reply` is the array of valid completions handed back to `compctl`.
+    # Use ${{=...}} to force whitespace splitting in expansion of
+    # $collection_arg
+    reply=( $({binary} ${{=collection_arg}} --complete -- ${{words}}) )
+}}
+
+
+# Tell shell builtin to use the above for completing our given binary name(s).
+# * -K: use given function name to generate completions.
+# * +: specifies 'alternative' completion, where options after the '+' are only
+#   used if the completion from the options before the '+' result in no matches.
+# * -f: when function generates no results, use filenames.
+# * positional args: program names to complete for.
+compctl -K _complete_{binary} + -f {spaced_names}
+
+# vim: set ft=sh :
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/config.py b/TP03/TP03/lib/python3.9/site-packages/invoke/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..64e38469d451665bb2b05a5009a68c4dd843fdf9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/config.py
@@ -0,0 +1,1283 @@
+import copy
+import json
+import os
+import types
+from importlib.util import spec_from_loader
+from os import PathLike
+from os.path import join, splitext, expanduser
+from types import ModuleType
+from typing import Any, Dict, Iterator, Optional, Tuple, Type, Union
+
+from .env import Environment
+from .exceptions import UnknownFileType, UnpicklableConfigMember
+from .runners import Local
+from .terminals import WINDOWS
+from .util import debug, yaml
+
+
+try:
+    from importlib.machinery import SourceFileLoader
+except ImportError:  # PyPy3
+    from importlib._bootstrap import (  # type: ignore[no-redef]
+        _SourceFileLoader as SourceFileLoader,
+    )
+
+
+def load_source(name: str, path: str) -> Dict[str, Any]:
+    if not os.path.exists(path):
+        return {}
+    loader = SourceFileLoader("mod", path)
+    mod = ModuleType("mod")
+    mod.__spec__ = spec_from_loader("mod", loader)
+    loader.exec_module(mod)
+    return vars(mod)
+
+
+class DataProxy:
+    """
+    Helper class implementing nested dict+attr access for `.Config`.
+
+    Specifically, is used both for `.Config` itself, and to wrap any other
+    dicts assigned as config values (recursively).
+
+    .. warning::
+        All methods (of this object or in subclasses) must take care to
+        initialize new attributes via ``self._set(name='value')``, or they'll
+        run into recursion errors!
+
+    .. versionadded:: 1.0
+    """
+
+    # Attributes which get proxied through to inner merged-dict config obj.
+    _proxies = (
+        tuple(
+            """
+        get
+        has_key
+        items
+        iteritems
+        iterkeys
+        itervalues
+        keys
+        values
+    """.split()
+        )
+        + tuple(
+            "__{}__".format(x)
+            for x in """
+        cmp
+        contains
+        iter
+        sizeof
+    """.split()
+        )
+    )
+
+    @classmethod
+    def from_data(
+        cls,
+        data: Dict[str, Any],
+        root: Optional["DataProxy"] = None,
+        keypath: Tuple[str, ...] = tuple(),
+    ) -> "DataProxy":
+        """
+        Alternate constructor for 'baby' DataProxies used as sub-dict values.
+
+        Allows creating standalone DataProxy objects while also letting
+        subclasses like `.Config` define their own ``__init__`` without
+        muddling the two.
+
+        :param dict data:
+            This particular DataProxy's personal data. Required, it's the Data
+            being Proxied.
+
+        :param root:
+            Optional handle on a root DataProxy/Config which needs notification
+            on data updates.
+
+        :param tuple keypath:
+            Optional tuple describing the path of keys leading to this
+            DataProxy's location inside the ``root`` structure. Required if
+            ``root`` was given (and vice versa.)
+
+        .. versionadded:: 1.0
+        """
+        obj = cls()
+        obj._set(_config=data)
+        obj._set(_root=root)
+        obj._set(_keypath=keypath)
+        return obj
+
+    def __getattr__(self, key: str) -> Any:
+        # NOTE: due to default Python attribute-lookup semantics, "real"
+        # attributes will always be yielded on attribute access and this method
+        # is skipped. That behavior is good for us (it's more intuitive than
+        # having a config key accidentally shadow a real attribute or method).
+        try:
+            return self._get(key)
+        except KeyError:
+            # Proxy most special vars to config for dict procotol.
+            if key in self._proxies:
+                return getattr(self._config, key)
+            # Otherwise, raise useful AttributeError to follow getattr proto.
+            err = "No attribute or config key found for {!r}".format(key)
+            attrs = [x for x in dir(self.__class__) if not x.startswith("_")]
+            err += "\n\nValid keys: {!r}".format(
+                sorted(list(self._config.keys()))
+            )
+            err += "\n\nValid real attributes: {!r}".format(attrs)
+            raise AttributeError(err)
+
+    def __setattr__(self, key: str, value: Any) -> None:
+        # Turn attribute-sets into config updates anytime we don't have a real
+        # attribute with the given name/key.
+        has_real_attr = key in dir(self)
+        if not has_real_attr:
+            # Make sure to trigger our own __setitem__ instead of going direct
+            # to our internal dict/cache
+            self[key] = value
+        else:
+            super().__setattr__(key, value)
+
+    def __iter__(self) -> Iterator[Dict[str, Any]]:
+        # For some reason Python is ignoring our __hasattr__ when determining
+        # whether we support __iter__. BOO
+        return iter(self._config)
+
+    def __eq__(self, other: object) -> bool:
+        # NOTE: Can't proxy __eq__ because the RHS will always be an obj of the
+        # current class, not the proxied-to class, and that causes
+        # NotImplemented.
+        # Try comparing to other objects like ourselves, falling back to a not
+        # very comparable value (None) so comparison fails.
+        other_val = getattr(other, "_config", None)
+        # But we can compare to vanilla dicts just fine, since our _config is
+        # itself just a dict.
+        if isinstance(other, dict):
+            other_val = other
+        return bool(self._config == other_val)
+
+    def __len__(self) -> int:
+        return len(self._config)
+
+    def __setitem__(self, key: str, value: str) -> None:
+        self._config[key] = value
+        self._track_modification_of(key, value)
+
+    def __getitem__(self, key: str) -> Any:
+        return self._get(key)
+
+    def _get(self, key: str) -> Any:
+        # Short-circuit if pickling/copying mechanisms are asking if we've got
+        # __setstate__ etc; they'll ask this w/o calling our __init__ first, so
+        # we'd be in a RecursionError-causing catch-22 otherwise.
+        if key in ("__setstate__",):
+            raise AttributeError(key)
+        # At this point we should be able to assume a self._config...
+        value = self._config[key]
+        if isinstance(value, dict):
+            # New object's keypath is simply the key, prepended with our own
+            # keypath if we've got one.
+            keypath = (key,)
+            if hasattr(self, "_keypath"):
+                keypath = self._keypath + keypath
+            # If we have no _root, we must be the root, so it's us. Otherwise,
+            # pass along our handle on the root.
+            root = getattr(self, "_root", self)
+            value = DataProxy.from_data(data=value, root=root, keypath=keypath)
+        return value
+
+    def _set(self, *args: Any, **kwargs: Any) -> None:
+        """
+        Convenience workaround of default 'attrs are config keys' behavior.
+
+        Uses `object.__setattr__` to work around the class' normal proxying
+        behavior, but is less verbose than using that directly.
+
+        Has two modes (which may be combined if you really want):
+
+        - ``self._set('attrname', value)``, just like ``__setattr__``
+        - ``self._set(attname=value)`` (i.e. kwargs), even less typing.
+        """
+        if args:
+            object.__setattr__(self, *args)
+        for key, value in kwargs.items():
+            object.__setattr__(self, key, value)
+
+    def __repr__(self) -> str:
+        return "<{}: {}>".format(self.__class__.__name__, self._config)
+
+    def __contains__(self, key: str) -> bool:
+        return key in self._config
+
+    @property
+    def _is_leaf(self) -> bool:
+        return hasattr(self, "_root")
+
+    @property
+    def _is_root(self) -> bool:
+        return hasattr(self, "_modify")
+
+    def _track_removal_of(self, key: str) -> None:
+        # Grab the root object responsible for tracking removals; either the
+        # referenced root (if we're a leaf) or ourselves (if we're not).
+        # (Intermediate nodes never have anything but __getitem__ called on
+        # them, otherwise they're by definition being treated as a leaf.)
+        target = None
+        if self._is_leaf:
+            target = self._root
+        elif self._is_root:
+            target = self
+        if target is not None:
+            target._remove(getattr(self, "_keypath", tuple()), key)
+
+    def _track_modification_of(self, key: str, value: str) -> None:
+        target = None
+        if self._is_leaf:
+            target = self._root
+        elif self._is_root:
+            target = self
+        if target is not None:
+            target._modify(getattr(self, "_keypath", tuple()), key, value)
+
+    def __delitem__(self, key: str) -> None:
+        del self._config[key]
+        self._track_removal_of(key)
+
+    def __delattr__(self, name: str) -> None:
+        # Make sure we don't screw up true attribute deletion for the
+        # situations that actually want it. (Uncommon, but not rare.)
+        if name in self:
+            del self[name]
+        else:
+            object.__delattr__(self, name)
+
+    def clear(self) -> None:
+        keys = list(self.keys())
+        for key in keys:
+            del self[key]
+
+    def pop(self, *args: Any) -> Any:
+        # Must test this up front before (possibly) mutating self._config
+        key_existed = args and args[0] in self._config
+        # We always have a _config (whether it's a real dict or a cache of
+        # merged levels) so we can fall back to it for all the corner case
+        # handling re: args (arity, handling a default, raising KeyError, etc)
+        ret = self._config.pop(*args)
+        # If it looks like no popping occurred (key wasn't there), presumably
+        # user gave default, so we can short-circuit return here - no need to
+        # track a deletion that did not happen.
+        if not key_existed:
+            return ret
+        # Here, we can assume at least the 1st posarg (key) existed.
+        self._track_removal_of(args[0])
+        # In all cases, return the popped value.
+        return ret
+
+    def popitem(self) -> Any:
+        ret = self._config.popitem()
+        self._track_removal_of(ret[0])
+        return ret
+
+    def setdefault(self, *args: Any) -> Any:
+        # Must test up front whether the key existed beforehand
+        key_existed = args and args[0] in self._config
+        # Run locally
+        ret = self._config.setdefault(*args)
+        # Key already existed -> nothing was mutated, short-circuit
+        if key_existed:
+            return ret
+        # Here, we can assume the key did not exist and thus user must have
+        # supplied a 'default' (if they did not, the real setdefault() above
+        # would have excepted.)
+        key, default = args
+        self._track_modification_of(key, default)
+        return ret
+
+    def update(self, *args: Any, **kwargs: Any) -> None:
+        if kwargs:
+            for key, value in kwargs.items():
+                self[key] = value
+        elif args:
+            # TODO: complain if arity>1
+            arg = args[0]
+            if isinstance(arg, dict):
+                for key in arg:
+                    self[key] = arg[key]
+            else:
+                # TODO: be stricter about input in this case
+                for pair in arg:
+                    self[pair[0]] = pair[1]
+
+
+class Config(DataProxy):
+    """
+    Invoke's primary configuration handling class.
+
+    See :doc:`/concepts/configuration` for details on the configuration system
+    this class implements, including the :ref:`configuration hierarchy
+    <config-hierarchy>`. The rest of this class' documentation assumes
+    familiarity with that document.
+
+    **Access**
+
+    Configuration values may be accessed and/or updated using dict syntax::
+
+        config['foo']
+
+    or attribute syntax::
+
+        config.foo
+
+    Nesting works the same way - dict config values are turned into objects
+    which honor both the dictionary protocol and the attribute-access method::
+
+       config['foo']['bar']
+       config.foo.bar
+
+    **A note about attribute access and methods**
+
+    This class implements the entire dictionary protocol: methods such as
+    ``keys``, ``values``, ``items``, ``pop`` and so forth should all function
+    as they do on regular dicts. It also implements new config-specific methods
+    such as `load_system`, `load_collection`, `merge`, `clone`, etc.
+
+    .. warning::
+        Accordingly, this means that if you have configuration options sharing
+        names with these methods, you **must** use dictionary syntax (e.g.
+        ``myconfig['keys']``) to access the configuration data.
+
+    **Lifecycle**
+
+    At initialization time, `.Config`:
+
+    - creates per-level data structures;
+    - stores any levels supplied to `__init__`, such as defaults or overrides,
+      as well as the various config file paths/filename patterns;
+    - and loads config files, if found (though typically this just means system
+      and user-level files, as project and runtime files need more info before
+      they can be found and loaded.)
+
+        - This step can be skipped by specifying ``lazy=True``.
+
+    At this point, `.Config` is fully usable - and because it pre-emptively
+    loads some config files, those config files can affect anything that
+    comes after, like CLI parsing or loading of task collections.
+
+    In the CLI use case, further processing is done after instantiation, using
+    the ``load_*`` methods such as `load_overrides`, `load_project`, etc:
+
+    - the result of argument/option parsing is applied to the overrides level;
+    - a project-level config file is loaded, as it's dependent on a loaded
+      tasks collection;
+    - a runtime config file is loaded, if its flag was supplied;
+    - then, for each task being executed:
+
+        - per-collection data is loaded (only possible now that we have
+          collection & task in hand);
+        - shell environment data is loaded (must be done at end of process due
+          to using the rest of the config as a guide for interpreting env var
+          names.)
+
+    At this point, the config object is handed to the task being executed, as
+    part of its execution `.Context`.
+
+    Any modifications made directly to the `.Config` itself after this point
+    end up stored in their own (topmost) config level, making it easier to
+    debug final values.
+
+    Finally, any *deletions* made to the `.Config` (e.g. applications of
+    dict-style mutators like ``pop``, ``clear`` etc) are also tracked in their
+    own structure, allowing the config object to honor such method calls
+    without mutating the underlying source data.
+
+    **Special class attributes**
+
+    The following class-level attributes are used for low-level configuration
+    of the config system itself, such as which file paths to load. They are
+    primarily intended for overriding by subclasses.
+
+    - ``prefix``: Supplies the default value for ``file_prefix`` (directly) and
+      ``env_prefix`` (uppercased). See their descriptions for details. Its
+      default value is ``"invoke"``.
+    - ``file_prefix``: The config file 'basename' default (though it is not a
+      literal basename; it can contain path parts if desired) which is appended
+      to the configured values of ``system_prefix``, ``user_prefix``, etc, to
+      arrive at the final (pre-extension) file paths.
+
+      Thus, by default, a system-level config file path concatenates the
+      ``system_prefix`` of ``/etc/`` with the ``file_prefix`` of ``invoke`` to
+      arrive at paths like ``/etc/invoke.json``.
+
+      Defaults to ``None``, meaning to use the value of ``prefix``.
+
+    - ``env_prefix``: A prefix used (along with a joining underscore) to
+      determine which environment variables are loaded as the env var
+      configuration level. Since its default is the value of ``prefix``
+      capitalized, this means env vars like ``INVOKE_RUN_ECHO`` are sought by
+      default.
+
+      Defaults to ``None``, meaning to use the value of ``prefix``.
+
+    .. versionadded:: 1.0
+    """
+
+    prefix = "invoke"
+    file_prefix = None
+    env_prefix = None
+
+    @staticmethod
+    def global_defaults() -> Dict[str, Any]:
+        """
+        Return the core default settings for Invoke.
+
+        Generally only for use by `.Config` internals. For descriptions of
+        these values, see :ref:`default-values`.
+
+        Subclasses may choose to override this method, calling
+        ``Config.global_defaults`` and applying `.merge_dicts` to the result,
+        to add to or modify these values.
+
+        .. versionadded:: 1.0
+        """
+        # On Windows, which won't have /bin/bash, check for a set COMSPEC env
+        # var (https://en.wikipedia.org/wiki/COMSPEC) or fallback to an
+        # unqualified cmd.exe otherwise.
+        if WINDOWS:
+            shell = os.environ.get("COMSPEC", "cmd.exe")
+        # Else, assume Unix, most distros of which have /bin/bash available.
+        # TODO: consider an automatic fallback to /bin/sh for systems lacking
+        # /bin/bash; however users may configure run.shell quite easily, so...
+        else:
+            shell = "/bin/bash"
+
+        return {
+            # TODO: we document 'debug' but it's not truly implemented outside
+            # of env var and CLI flag. If we honor it, we have to go around and
+            # figure out at what points we might want to call
+            # `util.enable_logging`:
+            # - just using it as a fallback default for arg parsing isn't much
+            # use, as at that point the config holds nothing but defaults & CLI
+            # flag values
+            # - doing it at file load time might be somewhat useful, though
+            # where this happens may be subject to change soon
+            # - doing it at env var load time seems a bit silly given the
+            # existing support for at-startup testing for INVOKE_DEBUG
+            # 'debug': False,
+            # TODO: I feel like we want these to be more consistent re: default
+            # values stored here vs 'stored' as logic where they are
+            # referenced, there are probably some bits that are all "if None ->
+            # default" that could go here. Alternately, make _more_ of these
+            # default to None?
+            "run": {
+                "asynchronous": False,
+                "disown": False,
+                "dry": False,
+                "echo": False,
+                "echo_stdin": None,
+                "encoding": None,
+                "env": {},
+                "err_stream": None,
+                "fallback": True,
+                "hide": None,
+                "in_stream": None,
+                "out_stream": None,
+                "echo_format": "\033[1;37m{command}\033[0m",
+                "pty": False,
+                "replace_env": False,
+                "shell": shell,
+                "warn": False,
+                "watchers": [],
+            },
+            # This doesn't live inside the 'run' tree; otherwise it'd make it
+            # somewhat harder to extend/override in Fabric 2 which has a split
+            # local/remote runner situation.
+            "runners": {"local": Local},
+            "sudo": {
+                "password": None,
+                "prompt": "[sudo] password: ",
+                "user": None,
+            },
+            "tasks": {
+                "auto_dash_names": True,
+                "collection_name": "tasks",
+                "dedupe": True,
+                "executor_class": None,
+                "ignore_unknown_help": False,
+                "search_root": None,
+            },
+            "timeouts": {"command": None},
+        }
+
+    def __init__(
+        self,
+        overrides: Optional[Dict[str, Any]] = None,
+        defaults: Optional[Dict[str, Any]] = None,
+        system_prefix: Optional[str] = None,
+        user_prefix: Optional[str] = None,
+        project_location: Optional[PathLike] = None,
+        runtime_path: Optional[PathLike] = None,
+        lazy: bool = False,
+    ):
+        """
+        Creates a new config object.
+
+        :param dict defaults:
+            A dict containing default (lowest level) config data. Default:
+            `global_defaults`.
+
+        :param dict overrides:
+            A dict containing override-level config data. Default: ``{}``.
+
+        :param str system_prefix:
+            Base path for the global config file location; combined with the
+            prefix and file suffixes to arrive at final file path candidates.
+
+            Default: ``/etc/`` (thus e.g. ``/etc/invoke.yaml`` or
+            ``/etc/invoke.json``).
+
+        :param str user_prefix:
+            Like ``system_prefix`` but for the per-user config file. These
+            variables are joined as strings, not via path-style joins, so they
+            may contain partial file paths; for the per-user config file this
+            often means a leading dot, to make the final result a hidden file
+            on most systems.
+
+            Default: ``~/.`` (e.g. ``~/.invoke.yaml``).
+
+        :param str project_location:
+            Optional directory path of the currently loaded `.Collection` (as
+            loaded by `.Loader`). When non-empty, will trigger seeking of
+            per-project config files in this directory.
+
+        :param str runtime_path:
+            Optional file path to a runtime configuration file.
+
+            Used to fill the penultimate slot in the config hierarchy. Should
+            be a full file path to an existing file, not a directory path or a
+            prefix.
+
+        :param bool lazy:
+            Whether to automatically load some of the lower config levels.
+
+            By default (``lazy=False``), ``__init__`` automatically calls
+            `load_system` and `load_user` to load system and user config files,
+            respectively.
+
+            For more control over what is loaded when, you can say
+            ``lazy=True``, and no automatic loading is done.
+
+            .. note::
+                If you give ``defaults`` and/or ``overrides`` as ``__init__``
+                kwargs instead of waiting to use `load_defaults` or
+                `load_overrides` afterwards, those *will* still end up 'loaded'
+                immediately.
+        """
+        # Technically an implementation detail - do not expose in public API.
+        # Stores merged configs and is accessed via DataProxy.
+        self._set(_config={})
+
+        # Config file suffixes to search, in preference order.
+        self._set(_file_suffixes=("yaml", "yml", "json", "py"))
+
+        # Default configuration values, typically a copy of `global_defaults`.
+        if defaults is None:
+            defaults = copy_dict(self.global_defaults())
+        self._set(_defaults=defaults)
+
+        # Collection-driven config data, gathered from the collection tree
+        # containing the currently executing task.
+        self._set(_collection={})
+
+        # Path prefix searched for the system config file.
+        # NOTE: There is no default system prefix on Windows.
+        if system_prefix is None and not WINDOWS:
+            system_prefix = "/etc/"
+        self._set(_system_prefix=system_prefix)
+        # Path to loaded system config file, if any.
+        self._set(_system_path=None)
+        # Whether the system config file has been loaded or not (or ``None`` if
+        # no loading has been attempted yet.)
+        self._set(_system_found=None)
+        # Data loaded from the system config file.
+        self._set(_system={})
+
+        # Path prefix searched for per-user config files.
+        if user_prefix is None:
+            user_prefix = "~/."
+        self._set(_user_prefix=user_prefix)
+        # Path to loaded user config file, if any.
+        self._set(_user_path=None)
+        # Whether the user config file has been loaded or not (or ``None`` if
+        # no loading has been attempted yet.)
+        self._set(_user_found=None)
+        # Data loaded from the per-user config file.
+        self._set(_user={})
+
+        # As it may want to be set post-init, project conf file related attrs
+        # get initialized or overwritten via a specific method.
+        self.set_project_location(project_location)
+
+        # Environment variable name prefix
+        env_prefix = self.env_prefix
+        if env_prefix is None:
+            env_prefix = self.prefix
+        env_prefix = "{}_".format(env_prefix.upper())
+        self._set(_env_prefix=env_prefix)
+        # Config data loaded from the shell environment.
+        self._set(_env={})
+
+        # As it may want to be set post-init, runtime conf file related attrs
+        # get initialized or overwritten via a specific method.
+        self.set_runtime_path(runtime_path)
+
+        # Overrides - highest normal config level. Typically filled in from
+        # command-line flags.
+        if overrides is None:
+            overrides = {}
+        self._set(_overrides=overrides)
+
+        # Absolute highest level: user modifications.
+        self._set(_modifications={})
+        # And its sibling: user deletions. (stored as a flat dict of keypath
+        # keys and dummy values, for constant-time membership testing/removal
+        # w/ no messy recursion. TODO: maybe redo _everything_ that way? in
+        # _modifications and other levels, the values would of course be
+        # valuable and not just None)
+        self._set(_deletions={})
+
+        # Convenience loading of user and system files, since those require no
+        # other levels in order to function.
+        if not lazy:
+            self.load_base_conf_files()
+        # Always merge, otherwise defaults, etc are not usable until creator or
+        # a subroutine does so.
+        self.merge()
+
+    def load_base_conf_files(self) -> None:
+        # Just a refactor of something done in unlazy init or in clone()
+        self.load_system(merge=False)
+        self.load_user(merge=False)
+
+    def load_defaults(self, data: Dict[str, Any], merge: bool = True) -> None:
+        """
+        Set or replace the 'defaults' configuration level, from ``data``.
+
+        :param dict data: The config data to load as the defaults level.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._set(_defaults=data)
+        if merge:
+            self.merge()
+
+    def load_overrides(self, data: Dict[str, Any], merge: bool = True) -> None:
+        """
+        Set or replace the 'overrides' configuration level, from ``data``.
+
+        :param dict data: The config data to load as the overrides level.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._set(_overrides=data)
+        if merge:
+            self.merge()
+
+    def load_system(self, merge: bool = True) -> None:
+        """
+        Load a system-level config file, if possible.
+
+        Checks the configured ``_system_prefix`` path, which defaults to
+        ``/etc``, and will thus load files like ``/etc/invoke.yml``.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._load_file(prefix="system", merge=merge)
+
+    def load_user(self, merge: bool = True) -> None:
+        """
+        Load a user-level config file, if possible.
+
+        Checks the configured ``_user_prefix`` path, which defaults to ``~/.``,
+        and will thus load files like ``~/.invoke.yml``.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._load_file(prefix="user", merge=merge)
+
+    def load_project(self, merge: bool = True) -> None:
+        """
+        Load a project-level config file, if possible.
+
+        Checks the configured ``_project_prefix`` value derived from the path
+        given to `set_project_location`, which is typically set to the
+        directory containing the loaded task collection.
+
+        Thus, if one were to run the CLI tool against a tasks collection
+        ``/home/myuser/code/tasks.py``, `load_project` would seek out files
+        like ``/home/myuser/code/invoke.yml``.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._load_file(prefix="project", merge=merge)
+
+    def set_runtime_path(self, path: Optional[PathLike]) -> None:
+        """
+        Set the runtime config file path.
+
+        .. versionadded:: 1.0
+        """
+        # Path to the user-specified runtime config file.
+        self._set(_runtime_path=path)
+        # Data loaded from the runtime config file.
+        self._set(_runtime={})
+        # Whether the runtime config file has been loaded or not (or ``None``
+        # if no loading has been attempted yet.)
+        self._set(_runtime_found=None)
+
+    def load_runtime(self, merge: bool = True) -> None:
+        """
+        Load a runtime-level config file, if one was specified.
+
+        When the CLI framework creates a `Config`, it sets ``_runtime_path``,
+        which is a full path to the requested config file. This method attempts
+        to load that file.
+
+        :param bool merge:
+            Whether to merge the loaded data into the central config. Default:
+            ``True``.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._load_file(prefix="runtime", absolute=True, merge=merge)
+
+    def load_shell_env(self) -> None:
+        """
+        Load values from the shell environment.
+
+        `.load_shell_env` is intended for execution late in a `.Config`
+        object's lifecycle, once all other sources (such as a runtime config
+        file or per-collection configurations) have been loaded. Loading from
+        the shell is not terrifically expensive, but must be done at a specific
+        point in time to ensure the "only known config keys are loaded from the
+        env" behavior works correctly.
+
+        See :ref:`env-vars` for details on this design decision and other info
+        re: how environment variables are scanned and loaded.
+
+        .. versionadded:: 1.0
+        """
+        # Force merge of existing data to ensure we have an up to date picture
+        debug("Running pre-merge for shell env loading...")
+        self.merge()
+        debug("Done with pre-merge.")
+        loader = Environment(config=self._config, prefix=self._env_prefix)
+        self._set(_env=loader.load())
+        debug("Loaded shell environment, triggering final merge")
+        self.merge()
+
+    def load_collection(
+        self, data: Dict[str, Any], merge: bool = True
+    ) -> None:
+        """
+        Update collection-driven config data.
+
+        `.load_collection` is intended for use by the core task execution
+        machinery, which is responsible for obtaining collection-driven data.
+        See :ref:`collection-configuration` for details.
+
+        .. versionadded:: 1.0
+        """
+        debug("Loading collection configuration")
+        self._set(_collection=data)
+        if merge:
+            self.merge()
+
+    def set_project_location(self, path: Union[PathLike, str, None]) -> None:
+        """
+        Set the directory path where a project-level config file may be found.
+
+        Does not do any file loading on its own; for that, see `load_project`.
+
+        .. versionadded:: 1.0
+        """
+        # 'Prefix' to match the other sets of attrs
+        project_prefix = None
+        if path is not None:
+            # Ensure the prefix is normalized to a directory-like path string
+            project_prefix = join(path, "")
+        self._set(_project_prefix=project_prefix)
+        # Path to loaded per-project config file, if any.
+        self._set(_project_path=None)
+        # Whether the project config file has been loaded or not (or ``None``
+        # if no loading has been attempted yet.)
+        self._set(_project_found=None)
+        # Data loaded from the per-project config file.
+        self._set(_project={})
+
+    def _load_file(
+        self, prefix: str, absolute: bool = False, merge: bool = True
+    ) -> None:
+        # Setup
+        found = "_{}_found".format(prefix)
+        path = "_{}_path".format(prefix)
+        data = "_{}".format(prefix)
+        midfix = self.file_prefix
+        if midfix is None:
+            midfix = self.prefix
+        # Short-circuit if loading appears to have occurred already
+        if getattr(self, found) is not None:
+            return
+        # Moar setup
+        if absolute:
+            absolute_path = getattr(self, path)
+            # None -> expected absolute path but none set, short circuit
+            if absolute_path is None:
+                return
+            paths = [absolute_path]
+        else:
+            path_prefix = getattr(self, "_{}_prefix".format(prefix))
+            # Short circuit if loading seems unnecessary (eg for project config
+            # files when not running out of a project)
+            if path_prefix is None:
+                return
+            paths = [
+                ".".join((path_prefix + midfix, x))
+                for x in self._file_suffixes
+            ]
+        # Poke 'em
+        for filepath in paths:
+            # Normalize
+            filepath = expanduser(filepath)
+            try:
+                try:
+                    type_ = splitext(filepath)[1].lstrip(".")
+                    loader = getattr(self, "_load_{}".format(type_))
+                except AttributeError:
+                    msg = "Config files of type {!r} (from file {!r}) are not supported! Please use one of: {!r}"  # noqa
+                    raise UnknownFileType(
+                        msg.format(type_, filepath, self._file_suffixes)
+                    )
+                # Store data, the path it was found at, and fact that it was
+                # found
+                self._set(data, loader(filepath))
+                self._set(path, filepath)
+                self._set(found, True)
+                break
+            # Typically means 'no such file', so just note & skip past.
+            except IOError as e:
+                if e.errno == 2:
+                    err = "Didn't see any {}, skipping."
+                    debug(err.format(filepath))
+                else:
+                    raise
+        # Still None -> no suffixed paths were found, record this fact
+        if getattr(self, path) is None:
+            self._set(found, False)
+        # Merge loaded data in if any was found
+        elif merge:
+            self.merge()
+
+    def _load_yaml(self, path: PathLike) -> Any:
+        with open(path) as fd:
+            return yaml.safe_load(fd)
+
+    _load_yml = _load_yaml
+
+    def _load_json(self, path: PathLike) -> Any:
+        with open(path) as fd:
+            return json.load(fd)
+
+    def _load_py(self, path: str) -> Dict[str, Any]:
+        data = {}
+        for key, value in (load_source("mod", path)).items():
+            # Strip special members, as these are always going to be builtins
+            # and other special things a user will not want in their config.
+            if key.startswith("__"):
+                continue
+            # Raise exceptions on module values; they are unpicklable.
+            # TODO: suck it up and reimplement copy() without pickling? Then
+            # again, a user trying to stuff a module into their config is
+            # probably doing something better done in runtime/library level
+            # code and not in a "config file"...right?
+            if isinstance(value, types.ModuleType):
+                err = "'{}' is a module, which can't be used as a config value. (Are you perhaps giving a tasks file instead of a config file by mistake?)"  # noqa
+                raise UnpicklableConfigMember(err.format(key))
+            data[key] = value
+        return data
+
+    def merge(self) -> None:
+        """
+        Merge all config sources, in order.
+
+        .. versionadded:: 1.0
+        """
+        debug("Merging config sources in order onto new empty _config...")
+        self._set(_config={})
+        debug("Defaults: {!r}".format(self._defaults))
+        merge_dicts(self._config, self._defaults)
+        debug("Collection-driven: {!r}".format(self._collection))
+        merge_dicts(self._config, self._collection)
+        self._merge_file("system", "System-wide")
+        self._merge_file("user", "Per-user")
+        self._merge_file("project", "Per-project")
+        debug("Environment variable config: {!r}".format(self._env))
+        merge_dicts(self._config, self._env)
+        self._merge_file("runtime", "Runtime")
+        debug("Overrides: {!r}".format(self._overrides))
+        merge_dicts(self._config, self._overrides)
+        debug("Modifications: {!r}".format(self._modifications))
+        merge_dicts(self._config, self._modifications)
+        debug("Deletions: {!r}".format(self._deletions))
+        obliterate(self._config, self._deletions)
+
+    def _merge_file(self, name: str, desc: str) -> None:
+        # Setup
+        desc += " config file"  # yup
+        found = getattr(self, "_{}_found".format(name))
+        path = getattr(self, "_{}_path".format(name))
+        data = getattr(self, "_{}".format(name))
+        # None -> no loading occurred yet
+        if found is None:
+            debug("{} has not been loaded yet, skipping".format(desc))
+        # True -> hooray
+        elif found:
+            debug("{} ({}): {!r}".format(desc, path, data))
+            merge_dicts(self._config, data)
+        # False -> did try, did not succeed
+        else:
+            # TODO: how to preserve what was tried for each case but only for
+            # the negative? Just a branch here based on 'name'?
+            debug("{} not found, skipping".format(desc))
+
+    def clone(self, into: Optional[Type["Config"]] = None) -> "Config":
+        """
+        Return a copy of this configuration object.
+
+        The new object will be identical in terms of configured sources and any
+        loaded (or user-manipulated) data, but will be a distinct object with
+        as little shared mutable state as possible.
+
+        Specifically, all `dict` values within the config are recursively
+        recreated, with non-dict leaf values subjected to `copy.copy` (note:
+        *not* `copy.deepcopy`, as this can cause issues with various objects
+        such as compiled regexen or threading locks, often found buried deep
+        within rich aggregates like API or DB clients).
+
+        The only remaining config values that may end up shared between a
+        config and its clone are thus those 'rich' objects that do not
+        `copy.copy` cleanly, or compound non-dict objects (such as lists or
+        tuples).
+
+        :param into:
+            A `.Config` subclass that the new clone should be "upgraded" to.
+
+            Used by client libraries which have their own `.Config` subclasses
+            that e.g. define additional defaults; cloning "into" one of these
+            subclasses ensures that any new keys/subtrees are added gracefully,
+            without overwriting anything that may have been pre-defined.
+
+            Default: ``None`` (just clone into another regular `.Config`).
+
+        :returns:
+            A `.Config`, or an instance of the class given to ``into``.
+
+        .. versionadded:: 1.0
+        """
+        # Construct new object
+        klass = self.__class__ if into is None else into
+        # Also allow arbitrary constructor kwargs, for subclasses where passing
+        # (some) data in at init time is desired (vs post-init copying)
+        # TODO: probably want to pivot the whole class this way eventually...?
+        # No longer recall exactly why we went with the 'fresh init + attribute
+        # setting' approach originally...tho there's clearly some impedance
+        # mismatch going on between "I want stuff to happen in my config's
+        # instantiation" and "I want cloning to not trigger certain things like
+        # external data source loading".
+        # NOTE: this will include lazy=True, see end of method
+        new = klass(**self._clone_init_kwargs(into=into))
+        # Copy/merge/etc all 'private' data sources and attributes
+        for name in """
+            collection
+            system_prefix
+            system_path
+            system_found
+            system
+            user_prefix
+            user_path
+            user_found
+            user
+            project_prefix
+            project_path
+            project_found
+            project
+            env_prefix
+            env
+            runtime_path
+            runtime_found
+            runtime
+            overrides
+            modifications
+        """.split():
+            name = "_{}".format(name)
+            my_data = getattr(self, name)
+            # Non-dict data gets carried over straight (via a copy())
+            # NOTE: presumably someone could really screw up and change these
+            # values' types, but at that point it's on them...
+            if not isinstance(my_data, dict):
+                new._set(name, copy.copy(my_data))
+            # Dict data gets merged (which also involves a copy.copy
+            # eventually)
+            else:
+                merge_dicts(getattr(new, name), my_data)
+        # Do what __init__ would've done if not lazy, i.e. load user/system
+        # conf files.
+        new.load_base_conf_files()
+        # Finally, merge() for reals (_load_base_conf_files doesn't do so
+        # internally, so that data wouldn't otherwise show up.)
+        new.merge()
+        return new
+
+    def _clone_init_kwargs(
+        self, into: Optional[Type["Config"]] = None
+    ) -> Dict[str, Any]:
+        """
+        Supply kwargs suitable for initializing a new clone of this object.
+
+        Note that most of the `.clone` process involves copying data between
+        two instances instead of passing init kwargs; however, sometimes you
+        really do want init kwargs, which is why this method exists.
+
+        :param into: The value of ``into`` as passed to the calling `.clone`.
+
+        :returns: A `dict`.
+        """
+        # NOTE: must pass in defaults fresh or otherwise global_defaults() gets
+        # used instead. Except when 'into' is in play, in which case we truly
+        # want the union of the two.
+        new_defaults = copy_dict(self._defaults)
+        if into is not None:
+            merge_dicts(new_defaults, into.global_defaults())
+        # The kwargs.
+        return dict(
+            defaults=new_defaults,
+            # TODO: consider making this 'hardcoded' on the calling end (ie
+            # inside clone()) to make sure nobody accidentally nukes it via
+            # subclassing?
+            lazy=True,
+        )
+
+    def _modify(self, keypath: Tuple[str, ...], key: str, value: str) -> None:
+        """
+        Update our user-modifications config level with new data.
+
+        :param tuple keypath:
+            The key path identifying the sub-dict being updated. May be an
+            empty tuple if the update is occurring at the topmost level.
+
+        :param str key:
+            The actual key receiving an update.
+
+        :param value:
+            The value being written.
+        """
+        # First, ensure we wipe the keypath from _deletions, in case it was
+        # previously deleted.
+        excise(self._deletions, keypath + (key,))
+        # Now we can add it to the modifications structure.
+        data = self._modifications
+        keypath_list = list(keypath)
+        while keypath_list:
+            subkey = keypath_list.pop(0)
+            # TODO: could use defaultdict here, but...meh?
+            if subkey not in data:
+                # TODO: generify this and the subsequent 3 lines...
+                data[subkey] = {}
+            data = data[subkey]
+        data[key] = value
+        self.merge()
+
+    def _remove(self, keypath: Tuple[str, ...], key: str) -> None:
+        """
+        Like `._modify`, but for removal.
+        """
+        # NOTE: because deletions are processed in merge() last, we do not need
+        # to remove things from _modifications on removal; but we *do* do the
+        # inverse - remove from _deletions on modification.
+        # TODO: may be sane to push this step up to callers?
+        data = self._deletions
+        keypath_list = list(keypath)
+        while keypath_list:
+            subkey = keypath_list.pop(0)
+            if subkey in data:
+                data = data[subkey]
+                # If we encounter None, it means something higher up than our
+                # requested keypath is already marked as deleted; so we don't
+                # have to do anything or go further.
+                if data is None:
+                    return
+                # Otherwise it's presumably another dict, so keep looping...
+            else:
+                # Key not found -> nobody's marked anything along this part of
+                # the path for deletion, so we'll start building it out.
+                data[subkey] = {}
+                # Then prep for next iteration
+                data = data[subkey]
+        # Exited loop -> data must be the leafmost dict, so we can now set our
+        # deleted key to None
+        data[key] = None
+        self.merge()
+
+
+class AmbiguousMergeError(ValueError):
+    pass
+
+
+def merge_dicts(
+    base: Dict[str, Any], updates: Dict[str, Any]
+) -> Dict[str, Any]:
+    """
+    Recursively merge dict ``updates`` into dict ``base`` (mutating ``base``.)
+
+    * Values which are themselves dicts will be recursed into.
+    * Values which are a dict in one input and *not* a dict in the other input
+      (e.g. if our inputs were ``{'foo': 5}`` and ``{'foo': {'bar': 5}}``) are
+      irreconciliable and will generate an exception.
+    * Non-dict leaf values are run through `copy.copy` to avoid state bleed.
+
+    .. note::
+        This is effectively a lightweight `copy.deepcopy` which offers
+        protection from mismatched types (dict vs non-dict) and avoids some
+        core deepcopy problems (such as how it explodes on certain object
+        types).
+
+    :returns:
+        The value of ``base``, which is mostly useful for wrapper functions
+        like `copy_dict`.
+
+    .. versionadded:: 1.0
+    """
+    # TODO: for chrissakes just make it return instead of mutating?
+    for key, value in (updates or {}).items():
+        # Dict values whose keys also exist in 'base' -> recurse
+        # (But only if both types are dicts.)
+        if key in base:
+            if isinstance(value, dict):
+                if isinstance(base[key], dict):
+                    merge_dicts(base[key], value)
+                else:
+                    raise _merge_error(base[key], value)
+            else:
+                if isinstance(base[key], dict):
+                    raise _merge_error(base[key], value)
+                # Fileno-bearing objects are probably 'real' files which do not
+                # copy well & must be passed by reference. Meh.
+                elif hasattr(value, "fileno"):
+                    base[key] = value
+                else:
+                    base[key] = copy.copy(value)
+        # New values get set anew
+        else:
+            # Dict values get reconstructed to avoid being references to the
+            # updates dict, which can lead to nasty state-bleed bugs otherwise
+            if isinstance(value, dict):
+                base[key] = copy_dict(value)
+            # Fileno-bearing objects are probably 'real' files which do not
+            # copy well & must be passed by reference. Meh.
+            elif hasattr(value, "fileno"):
+                base[key] = value
+            # Non-dict values just get set straight
+            else:
+                base[key] = copy.copy(value)
+    return base
+
+
+def _merge_error(orig: object, new: object) -> AmbiguousMergeError:
+    return AmbiguousMergeError(
+        "Can't cleanly merge {} with {}".format(
+            _format_mismatch(orig), _format_mismatch(new)
+        )
+    )
+
+
+def _format_mismatch(x: object) -> str:
+    return "{} ({!r})".format(type(x), x)
+
+
+def copy_dict(source: Dict[str, Any]) -> Dict[str, Any]:
+    """
+    Return a fresh copy of ``source`` with as little shared state as possible.
+
+    Uses `merge_dicts` under the hood, with an empty ``base`` dict; see its
+    documentation for details on behavior.
+
+    .. versionadded:: 1.0
+    """
+    return merge_dicts({}, source)
+
+
+def excise(dict_: Dict[str, Any], keypath: Tuple[str, ...]) -> None:
+    """
+    Remove key pointed at by ``keypath`` from nested dict ``dict_``, if exists.
+
+    .. versionadded:: 1.0
+    """
+    data = dict_
+    keypath_list = list(keypath)
+    leaf_key = keypath_list.pop()
+    while keypath_list:
+        key = keypath_list.pop(0)
+        if key not in data:
+            # Not there, nothing to excise
+            return
+        data = data[key]
+    if leaf_key in data:
+        del data[leaf_key]
+
+
+def obliterate(base: Dict[str, Any], deletions: Dict[str, Any]) -> None:
+    """
+    Remove all (nested) keys mentioned in ``deletions``, from ``base``.
+
+    .. versionadded:: 1.0
+    """
+    for key, value in deletions.items():
+        if isinstance(value, dict):
+            # NOTE: not testing for whether base[key] exists; if something's
+            # listed in a deletions structure, it must exist in some source
+            # somewhere, and thus also in the cache being obliterated.
+            obliterate(base[key], deletions[key])
+        else:  # implicitly None
+            del base[key]
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/context.py b/TP03/TP03/lib/python3.9/site-packages/invoke/context.py
new file mode 100644
index 0000000000000000000000000000000000000000..e9beaf4d13fc56783f39eafcb071081c1efb8147
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/context.py
@@ -0,0 +1,602 @@
+import os
+import re
+from contextlib import contextmanager
+from itertools import cycle
+from os import PathLike
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Generator,
+    Iterator,
+    List,
+    Optional,
+    Union,
+)
+from unittest.mock import Mock
+
+from .config import Config, DataProxy
+from .exceptions import Failure, AuthFailure, ResponseNotAccepted
+from .runners import Result
+from .watchers import FailingResponder
+
+if TYPE_CHECKING:
+    from invoke.runners import Runner
+
+
+class Context(DataProxy):
+    """
+    Context-aware API wrapper & state-passing object.
+
+    `.Context` objects are created during command-line parsing (or, if desired,
+    by hand) and used to share parser and configuration state with executed
+    tasks (see :ref:`why-context`).
+
+    Specifically, the class offers wrappers for core API calls (such as `.run`)
+    which take into account CLI parser flags, configuration files, and/or
+    changes made at runtime. It also acts as a proxy for its `~.Context.config`
+    attribute - see that attribute's documentation for details.
+
+    Instances of `.Context` may be shared between tasks when executing
+    sub-tasks - either the same context the caller was given, or an altered
+    copy thereof (or, theoretically, a brand new one).
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, config: Optional[Config] = None) -> None:
+        """
+        :param config:
+            `.Config` object to use as the base configuration.
+
+            Defaults to an anonymous/default `.Config` instance.
+        """
+        #: The fully merged `.Config` object appropriate for this context.
+        #:
+        #: `.Config` settings (see their documentation for details) may be
+        #: accessed like dictionary keys (``c.config['foo']``) or object
+        #: attributes (``c.config.foo``).
+        #:
+        #: As a convenience shorthand, the `.Context` object proxies to its
+        #: ``config`` attribute in the same way - e.g. ``c['foo']`` or
+        #: ``c.foo`` returns the same value as ``c.config['foo']``.
+        config = config if config is not None else Config()
+        self._set(_config=config)
+        #: A list of commands to run (via "&&") before the main argument to any
+        #: `run` or `sudo` calls. Note that the primary API for manipulating
+        #: this list is `prefix`; see its docs for details.
+        command_prefixes: List[str] = list()
+        self._set(command_prefixes=command_prefixes)
+        #: A list of directories to 'cd' into before running commands with
+        #: `run` or `sudo`; intended for management via `cd`, please see its
+        #: docs for details.
+        command_cwds: List[str] = list()
+        self._set(command_cwds=command_cwds)
+
+    @property
+    def config(self) -> Config:
+        # Allows Context to expose a .config attribute even though DataProxy
+        # otherwise considers it a config key.
+        return self._config
+
+    @config.setter
+    def config(self, value: Config) -> None:
+        # NOTE: mostly used by client libraries needing to tweak a Context's
+        # config at execution time; i.e. a Context subclass that bears its own
+        # unique data may want to be stood up when parameterizing/expanding a
+        # call list at start of a session, with the final config filled in at
+        # runtime.
+        self._set(_config=value)
+
+    def run(self, command: str, **kwargs: Any) -> Optional[Result]:
+        """
+        Execute a local shell command, honoring config options.
+
+        Specifically, this method instantiates a `.Runner` subclass (according
+        to the ``runner`` config option; default is `.Local`) and calls its
+        ``.run`` method with ``command`` and ``kwargs``.
+
+        See `.Runner.run` for details on ``command`` and the available keyword
+        arguments.
+
+        .. versionadded:: 1.0
+        """
+        runner = self.config.runners.local(self)
+        return self._run(runner, command, **kwargs)
+
+    # NOTE: broken out of run() to allow for runner class injection in
+    # Fabric/etc, which needs to juggle multiple runner class types (local and
+    # remote).
+    def _run(
+        self, runner: "Runner", command: str, **kwargs: Any
+    ) -> Optional[Result]:
+        command = self._prefix_commands(command)
+        return runner.run(command, **kwargs)
+
+    def sudo(self, command: str, **kwargs: Any) -> Optional[Result]:
+        """
+        Execute a shell command via ``sudo`` with password auto-response.
+
+        **Basics**
+
+        This method is identical to `run` but adds a handful of
+        convenient behaviors around invoking the ``sudo`` program. It doesn't
+        do anything users could not do themselves by wrapping `run`, but the
+        use case is too common to make users reinvent these wheels themselves.
+
+        .. note::
+            If you intend to respond to sudo's password prompt by hand, just
+            use ``run("sudo command")`` instead! The autoresponding features in
+            this method will just get in your way.
+
+        Specifically, `sudo`:
+
+        * Places a `.FailingResponder` into the ``watchers`` kwarg (see
+          :doc:`/concepts/watchers`) which:
+
+            * searches for the configured ``sudo`` password prompt;
+            * responds with the configured sudo password (``sudo.password``
+              from the :doc:`configuration </concepts/configuration>`);
+            * can tell when that response causes an authentication failure
+              (e.g. if the system requires a password and one was not
+              configured), and raises `.AuthFailure` if so.
+
+        * Builds a ``sudo`` command string using the supplied ``command``
+          argument, prefixed by various flags (see below);
+        * Executes that command via a call to `run`, returning the result.
+
+        **Flags used**
+
+        ``sudo`` flags used under the hood include:
+
+        - ``-S`` to allow auto-responding of password via stdin;
+        - ``-p <prompt>`` to explicitly state the prompt to use, so we can be
+          sure our auto-responder knows what to look for;
+        - ``-u <user>`` if ``user`` is not ``None``, to execute the command as
+          a user other than ``root``;
+        - When ``-u`` is present, ``-H`` is also added, to ensure the
+          subprocess has the requested user's ``$HOME`` set properly.
+
+        **Configuring behavior**
+
+        There are a couple of ways to change how this method behaves:
+
+        - Because it wraps `run`, it honors all `run` config parameters and
+          keyword arguments, in the same way that `run` does.
+
+            - Thus, invocations such as ``c.sudo('command', echo=True)`` are
+              possible, and if a config layer (such as a config file or env
+              var) specifies that e.g. ``run.warn = True``, that too will take
+              effect under `sudo`.
+
+        - `sudo` has its own set of keyword arguments (see below) and they are
+          also all controllable via the configuration system, under the
+          ``sudo.*`` tree.
+
+            - Thus you could, for example, pre-set a sudo user in a config
+              file; such as an ``invoke.json`` containing ``{"sudo": {"user":
+              "someuser"}}``.
+
+        :param str password: Runtime override for ``sudo.password``.
+        :param str user: Runtime override for ``sudo.user``.
+
+        .. versionadded:: 1.0
+        """
+        runner = self.config.runners.local(self)
+        return self._sudo(runner, command, **kwargs)
+
+    # NOTE: this is for runner injection; see NOTE above _run().
+    def _sudo(
+        self, runner: "Runner", command: str, **kwargs: Any
+    ) -> Optional[Result]:
+        prompt = self.config.sudo.prompt
+        password = kwargs.pop("password", self.config.sudo.password)
+        user = kwargs.pop("user", self.config.sudo.user)
+        env = kwargs.get("env", {})
+        # TODO: allow subclassing for 'get the password' so users who REALLY
+        # want lazy runtime prompting can have it easily implemented.
+        # TODO: want to print a "cleaner" echo with just 'sudo <command>'; but
+        # hard to do as-is, obtaining config data from outside a Runner one
+        # holds is currently messy (could fix that), if instead we manually
+        # inspect the config ourselves that duplicates logic. NOTE: once we
+        # figure that out, there is an existing, would-fail-if-not-skipped test
+        # for this behavior in test/context.py.
+        # TODO: once that is done, though: how to handle "full debug" output
+        # exactly (display of actual, real full sudo command w/ -S and -p), in
+        # terms of API/config? Impl is easy, just go back to passing echo
+        # through to 'run'...
+        user_flags = ""
+        if user is not None:
+            user_flags = "-H -u {} ".format(user)
+        env_flags = ""
+        if env:
+            env_flags = "--preserve-env='{}' ".format(",".join(env.keys()))
+        command = self._prefix_commands(command)
+        cmd_str = "sudo -S -p '{}' {}{}{}".format(
+            prompt, env_flags, user_flags, command
+        )
+        watcher = FailingResponder(
+            pattern=re.escape(prompt),
+            response="{}\n".format(password),
+            sentinel="Sorry, try again.\n",
+        )
+        # Ensure we merge any user-specified watchers with our own.
+        # NOTE: If there are config-driven watchers, we pull those up to the
+        # kwarg level; that lets us merge cleanly without needing complex
+        # config-driven "override vs merge" semantics.
+        # TODO: if/when those semantics are implemented, use them instead.
+        # NOTE: config value for watchers defaults to an empty list; and we
+        # want to clone it to avoid actually mutating the config.
+        watchers = kwargs.pop("watchers", list(self.config.run.watchers))
+        watchers.append(watcher)
+        try:
+            return runner.run(cmd_str, watchers=watchers, **kwargs)
+        except Failure as failure:
+            # Transmute failures driven by our FailingResponder, into auth
+            # failures - the command never even ran.
+            # TODO: wants to be a hook here for users that desire "override a
+            # bad config value for sudo.password" manual input
+            # NOTE: as noted in #294 comments, we MAY in future want to update
+            # this so run() is given ability to raise AuthFailure on its own.
+            # For now that has been judged unnecessary complexity.
+            if isinstance(failure.reason, ResponseNotAccepted):
+                # NOTE: not bothering with 'reason' here, it's pointless.
+                error = AuthFailure(result=failure.result, prompt=prompt)
+                raise error
+            # Reraise for any other error so it bubbles up normally.
+            else:
+                raise
+
+    # TODO: wonder if it makes sense to move this part of things inside Runner,
+    # which would grow a `prefixes` and `cwd` init kwargs or similar. The less
+    # that's stuffed into Context, probably the better.
+    def _prefix_commands(self, command: str) -> str:
+        """
+        Prefixes ``command`` with all prefixes found in ``command_prefixes``.
+
+        ``command_prefixes`` is a list of strings which is modified by the
+        `prefix` context manager.
+        """
+        prefixes = list(self.command_prefixes)
+        current_directory = self.cwd
+        if current_directory:
+            prefixes.insert(0, "cd {}".format(current_directory))
+
+        return " && ".join(prefixes + [command])
+
+    @contextmanager
+    def prefix(self, command: str) -> Generator[None, None, None]:
+        """
+        Prefix all nested `run`/`sudo` commands with given command plus ``&&``.
+
+        Most of the time, you'll want to be using this alongside a shell script
+        which alters shell state, such as ones which export or alter shell
+        environment variables.
+
+        For example, one of the most common uses of this tool is with the
+        ``workon`` command from `virtualenvwrapper
+        <https://virtualenvwrapper.readthedocs.io/en/latest/>`_::
+
+            with c.prefix('workon myvenv'):
+                c.run('./manage.py migrate')
+
+        In the above snippet, the actual shell command run would be this::
+
+            $ workon myvenv && ./manage.py migrate
+
+        This context manager is compatible with `cd`, so if your virtualenv
+        doesn't ``cd`` in its ``postactivate`` script, you could do the
+        following::
+
+            with c.cd('/path/to/app'):
+                with c.prefix('workon myvenv'):
+                    c.run('./manage.py migrate')
+                    c.run('./manage.py loaddata fixture')
+
+        Which would result in executions like so::
+
+            $ cd /path/to/app && workon myvenv && ./manage.py migrate
+            $ cd /path/to/app && workon myvenv && ./manage.py loaddata fixture
+
+        Finally, as alluded to above, `prefix` may be nested if desired, e.g.::
+
+            with c.prefix('workon myenv'):
+                c.run('ls')
+                with c.prefix('source /some/script'):
+                    c.run('touch a_file')
+
+        The result::
+
+            $ workon myenv && ls
+            $ workon myenv && source /some/script && touch a_file
+
+        Contrived, but hopefully illustrative.
+
+        .. versionadded:: 1.0
+        """
+        self.command_prefixes.append(command)
+        try:
+            yield
+        finally:
+            self.command_prefixes.pop()
+
+    @property
+    def cwd(self) -> str:
+        """
+        Return the current working directory, accounting for uses of `cd`.
+
+        .. versionadded:: 1.0
+        """
+        if not self.command_cwds:
+            # TODO: should this be None? Feels cleaner, though there may be
+            # benefits to it being an empty string, such as relying on a no-arg
+            # `cd` typically being shorthand for "go to user's $HOME".
+            return ""
+
+        # get the index for the subset of paths starting with the last / or ~
+        for i, path in reversed(list(enumerate(self.command_cwds))):
+            if path.startswith("~") or path.startswith("/"):
+                break
+
+        # TODO: see if there's a stronger "escape this path" function somewhere
+        # we can reuse. e.g., escaping tildes or slashes in filenames.
+        paths = [path.replace(" ", r"\ ") for path in self.command_cwds[i:]]
+        return str(os.path.join(*paths))
+
+    @contextmanager
+    def cd(self, path: Union[PathLike, str]) -> Generator[None, None, None]:
+        """
+        Context manager that keeps directory state when executing commands.
+
+        Any calls to `run`, `sudo`, within the wrapped block will implicitly
+        have a string similar to ``"cd <path> && "`` prefixed in order to give
+        the sense that there is actually statefulness involved.
+
+        Because use of `cd` affects all such invocations, any code making use
+        of the `cwd` property will also be affected by use of `cd`.
+
+        Like the actual 'cd' shell builtin, `cd` may be called with relative
+        paths (keep in mind that your default starting directory is your user's
+        ``$HOME``) and may be nested as well.
+
+        Below is a "normal" attempt at using the shell 'cd', which doesn't work
+        since all commands are executed in individual subprocesses -- state is
+        **not** kept between invocations of `run` or `sudo`::
+
+            c.run('cd /var/www')
+            c.run('ls')
+
+        The above snippet will list the contents of the user's ``$HOME``
+        instead of ``/var/www``. With `cd`, however, it will work as expected::
+
+            with c.cd('/var/www'):
+                c.run('ls')  # Turns into "cd /var/www && ls"
+
+        Finally, a demonstration (see inline comments) of nesting::
+
+            with c.cd('/var/www'):
+                c.run('ls') # cd /var/www && ls
+                with c.cd('website1'):
+                    c.run('ls')  # cd /var/www/website1 && ls
+
+        .. note::
+            Space characters will be escaped automatically to make dealing with
+            such directory names easier.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 1.5
+            Explicitly cast the ``path`` argument (the only argument) to a
+            string; this allows any object defining ``__str__`` to be handed in
+            (such as the various ``Path`` objects out there), and not just
+            string literals.
+        """
+        path = str(path)
+        self.command_cwds.append(path)
+        try:
+            yield
+        finally:
+            self.command_cwds.pop()
+
+
+class MockContext(Context):
+    """
+    A `.Context` whose methods' return values can be predetermined.
+
+    Primarily useful for testing Invoke-using codebases.
+
+    .. note::
+        This class wraps its ``run``, etc methods in `unittest.mock.Mock`
+        objects. This allows you to easily assert that the methods (still
+        returning the values you prepare them with) were actually called.
+
+    .. note::
+        Methods not given `Results <.Result>` to yield will raise
+        ``NotImplementedError`` if called (since the alternative is to call the
+        real underlying method - typically undesirable when mocking.)
+
+    .. versionadded:: 1.0
+    .. versionchanged:: 1.5
+        Added ``Mock`` wrapping of ``run`` and ``sudo``.
+    """
+
+    def __init__(self, config: Optional[Config] = None, **kwargs: Any) -> None:
+        """
+        Create a ``Context``-like object whose methods yield `.Result` objects.
+
+        :param config:
+            A Configuration object to use. Identical in behavior to `.Context`.
+
+        :param run:
+            A data structure indicating what `.Result` objects to return from
+            calls to the instantiated object's `~.Context.run` method (instead
+            of actually executing the requested shell command).
+
+            Specifically, this kwarg accepts:
+
+            - A single `.Result` object.
+            - A boolean; if True, yields a `.Result` whose ``exited`` is ``0``,
+              and if False, ``1``.
+            - An iterable of the above values, which will be returned on each
+              subsequent call to ``.run`` (the first item on the first call,
+              the second on the second call, etc).
+            - A dict mapping command strings or compiled regexen to the above
+              values (including an iterable), allowing specific
+              call-and-response semantics instead of assuming a call order.
+
+        :param sudo:
+            Identical to ``run``, but whose values are yielded from calls to
+            `~.Context.sudo`.
+
+        :param bool repeat:
+            A flag determining whether results yielded by this class' methods
+            repeat or are consumed.
+
+            For example, when a single result is indicated, it will normally
+            only be returned once, causing ``NotImplementedError`` afterwards.
+            But when ``repeat=True`` is given, that result is returned on
+            every call, forever.
+
+            Similarly, iterable results are normally exhausted once, but when
+            this setting is enabled, they are wrapped in `itertools.cycle`.
+
+            Default: ``True``.
+
+        :raises:
+            ``TypeError``, if the values given to ``run`` or other kwargs
+            aren't of the expected types.
+
+        .. versionchanged:: 1.5
+            Added support for boolean and string result values.
+        .. versionchanged:: 1.5
+            Added support for regex dict keys.
+        .. versionchanged:: 1.5
+            Added the ``repeat`` keyword argument.
+        .. versionchanged:: 2.0
+            Changed ``repeat`` default value from ``False`` to ``True``.
+        """
+        # Set up like any other Context would, with the config
+        super().__init__(config)
+        # Pull out behavioral kwargs
+        self._set("__repeat", kwargs.pop("repeat", True))
+        # The rest must be things like run/sudo - mock Context method info
+        for method, results in kwargs.items():
+            # For each possible value type, normalize to iterable of Result
+            # objects (possibly repeating).
+            singletons = (Result, bool, str)
+            if isinstance(results, dict):
+                for key, value in results.items():
+                    results[key] = self._normalize(value)
+            elif isinstance(results, singletons) or hasattr(
+                results, "__iter__"
+            ):
+                results = self._normalize(results)
+            # Unknown input value: cry
+            else:
+                err = "Not sure how to yield results from a {!r}"
+                raise TypeError(err.format(type(results)))
+            # Save results for use by the method
+            self._set("__{}".format(method), results)
+            # Wrap the method in a Mock
+            self._set(method, Mock(wraps=getattr(self, method)))
+
+    def _normalize(self, value: Any) -> Iterator[Any]:
+        # First turn everything into an iterable
+        if not hasattr(value, "__iter__") or isinstance(value, str):
+            value = [value]
+        # Then turn everything within into a Result
+        results = []
+        for obj in value:
+            if isinstance(obj, bool):
+                obj = Result(exited=0 if obj else 1)
+            elif isinstance(obj, str):
+                obj = Result(obj)
+            results.append(obj)
+        # Finally, turn that iterable into an iteratOR, depending on repeat
+        return cycle(results) if getattr(self, "__repeat") else iter(results)
+
+    # TODO: _maybe_ make this more metaprogrammy/flexible (using __call__ etc)?
+    # Pretty worried it'd cause more hard-to-debug issues than it's presently
+    # worth. Maybe in situations where Context grows a _lot_ of methods (e.g.
+    # in Fabric 2; though Fabric could do its own sub-subclass in that case...)
+
+    def _yield_result(self, attname: str, command: str) -> Result:
+        try:
+            obj = getattr(self, attname)
+            # Dicts need to try direct lookup or regex matching
+            if isinstance(obj, dict):
+                try:
+                    obj = obj[command]
+                except KeyError:
+                    # TODO: could optimize by skipping this if not any regex
+                    # objects in keys()?
+                    for key, value in obj.items():
+                        if hasattr(key, "match") and key.match(command):
+                            obj = value
+                            break
+                    else:
+                        # Nope, nothing did match.
+                        raise KeyError
+            # Here, the value was either never a dict or has been extracted
+            # from one, so we can assume it's an iterable of Result objects due
+            # to work done by __init__.
+            result: Result = next(obj)
+            # Populate Result's command string with what matched unless
+            # explicitly given
+            if not result.command:
+                result.command = command
+            return result
+        except (AttributeError, IndexError, KeyError, StopIteration):
+            # raise_from(NotImplementedError(command), None)
+            raise NotImplementedError(command)
+
+    def run(self, command: str, *args: Any, **kwargs: Any) -> Result:
+        # TODO: perform more convenience stuff associating args/kwargs with the
+        # result? E.g. filling in .command, etc? Possibly useful for debugging
+        # if one hits unexpected-order problems with what they passed in to
+        # __init__.
+        return self._yield_result("__run", command)
+
+    def sudo(self, command: str, *args: Any, **kwargs: Any) -> Result:
+        # TODO: this completely nukes the top-level behavior of sudo(), which
+        # could be good or bad, depending. Most of the time I think it's good.
+        # No need to supply dummy password config, etc.
+        # TODO: see the TODO from run() re: injecting arg/kwarg values
+        return self._yield_result("__sudo", command)
+
+    def set_result_for(
+        self, attname: str, command: str, result: Result
+    ) -> None:
+        """
+        Modify the stored mock results for given ``attname`` (e.g. ``run``).
+
+        This is similar to how one instantiates `MockContext` with a ``run`` or
+        ``sudo`` dict kwarg. For example, this::
+
+            mc = MockContext(run={'mycommand': Result("mystdout")})
+            assert mc.run('mycommand').stdout == "mystdout"
+
+        is functionally equivalent to this::
+
+            mc = MockContext()
+            mc.set_result_for('run', 'mycommand', Result("mystdout"))
+            assert mc.run('mycommand').stdout == "mystdout"
+
+        `set_result_for` is mostly useful for modifying an already-instantiated
+        `MockContext`, such as one created by test setup or helper methods.
+
+        .. versionadded:: 1.0
+        """
+        attname = "__{}".format(attname)
+        heck = TypeError(
+            "Can't update results for non-dict or nonexistent mock results!"
+        )
+        # Get value & complain if it's not a dict.
+        # TODO: should we allow this to set non-dict values too? Seems vaguely
+        # pointless, at that point, just make a new MockContext eh?
+        try:
+            value = getattr(self, attname)
+        except AttributeError:
+            raise heck
+        if not isinstance(value, dict):
+            raise heck
+        # OK, we're good to modify, so do so.
+        value[command] = self._normalize(result)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/env.py b/TP03/TP03/lib/python3.9/site-packages/invoke/env.py
new file mode 100644
index 0000000000000000000000000000000000000000..2c7aaa6924a6718d79354702905024df34c19552
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/env.py
@@ -0,0 +1,123 @@
+"""
+Environment variable configuration loading class.
+
+Using a class here doesn't really model anything but makes state passing (in a
+situation requiring it) more convenient.
+
+This module is currently considered private/an implementation detail and should
+not be included in the Sphinx API documentation.
+"""
+
+import os
+from typing import TYPE_CHECKING, Any, Dict, Iterable, List, Mapping, Sequence
+
+from .exceptions import UncastableEnvVar, AmbiguousEnvVar
+from .util import debug
+
+if TYPE_CHECKING:
+    from .config import Config
+
+
+class Environment:
+    def __init__(self, config: "Config", prefix: str) -> None:
+        self._config = config
+        self._prefix = prefix
+        self.data: Dict[str, Any] = {}  # Accumulator
+
+    def load(self) -> Dict[str, Any]:
+        """
+        Return a nested dict containing values from `os.environ`.
+
+        Specifically, values whose keys map to already-known configuration
+        settings, allowing us to perform basic typecasting.
+
+        See :ref:`env-vars` for details.
+        """
+        # Obtain allowed env var -> existing value map
+        env_vars = self._crawl(key_path=[], env_vars={})
+        m = "Scanning for env vars according to prefix: {!r}, mapping: {!r}"
+        debug(m.format(self._prefix, env_vars))
+        # Check for actual env var (honoring prefix) and try to set
+        for env_var, key_path in env_vars.items():
+            real_var = (self._prefix or "") + env_var
+            if real_var in os.environ:
+                self._path_set(key_path, os.environ[real_var])
+        debug("Obtained env var config: {!r}".format(self.data))
+        return self.data
+
+    def _crawl(
+        self, key_path: List[str], env_vars: Mapping[str, Sequence[str]]
+    ) -> Dict[str, Any]:
+        """
+        Examine config at location ``key_path`` & return potential env vars.
+
+        Uses ``env_vars`` dict to determine if a conflict exists, and raises an
+        exception if so. This dict is of the following form::
+
+            {
+                'EXPECTED_ENV_VAR_HERE': ['actual', 'nested', 'key_path'],
+                ...
+            }
+
+        Returns another dictionary of new keypairs as per above.
+        """
+        new_vars: Dict[str, List[str]] = {}
+        obj = self._path_get(key_path)
+        # Sub-dict -> recurse
+        if (
+            hasattr(obj, "keys")
+            and callable(obj.keys)
+            and hasattr(obj, "__getitem__")
+        ):
+            for key in obj.keys():
+                merged_vars = dict(env_vars, **new_vars)
+                merged_path = key_path + [key]
+                crawled = self._crawl(merged_path, merged_vars)
+                # Handle conflicts
+                for key in crawled:
+                    if key in new_vars:
+                        err = "Found >1 source for {}"
+                        raise AmbiguousEnvVar(err.format(key))
+                # Merge and continue
+                new_vars.update(crawled)
+        # Other -> is leaf, no recursion
+        else:
+            new_vars[self._to_env_var(key_path)] = key_path
+        return new_vars
+
+    def _to_env_var(self, key_path: Iterable[str]) -> str:
+        return "_".join(key_path).upper()
+
+    def _path_get(self, key_path: Iterable[str]) -> "Config":
+        # Gets are from self._config because that's what determines valid env
+        # vars and/or values for typecasting.
+        obj = self._config
+        for key in key_path:
+            obj = obj[key]
+        return obj
+
+    def _path_set(self, key_path: Sequence[str], value: str) -> None:
+        # Sets are to self.data since that's what we are presenting to the
+        # outer config object and debugging.
+        obj = self.data
+        for key in key_path[:-1]:
+            if key not in obj:
+                obj[key] = {}
+            obj = obj[key]
+        old = self._path_get(key_path)
+        new = self._cast(old, value)
+        obj[key_path[-1]] = new
+
+    def _cast(self, old: Any, new: Any) -> Any:
+        if isinstance(old, bool):
+            return new not in ("0", "")
+        elif isinstance(old, str):
+            return new
+        elif old is None:
+            return new
+        elif isinstance(old, (list, tuple)):
+            err = "Can't adapt an environment string into a {}!"
+            err = err.format(type(old))
+            raise UncastableEnvVar(err)
+        else:
+            return old.__class__(new)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/exceptions.py b/TP03/TP03/lib/python3.9/site-packages/invoke/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..19ca563bcda8048952482b2c7086deed6ea42edf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/exceptions.py
@@ -0,0 +1,425 @@
+"""
+Custom exception classes.
+
+These vary in use case from "we needed a specific data structure layout in
+exceptions used for message-passing" to simply "we needed to express an error
+condition in a way easily told apart from other, truly unexpected errors".
+"""
+
+from pprint import pformat
+from traceback import format_exception
+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple
+
+if TYPE_CHECKING:
+    from .parser import ParserContext
+    from .runners import Result
+    from .util import ExceptionWrapper
+
+
+class CollectionNotFound(Exception):
+    def __init__(self, name: str, start: str) -> None:
+        self.name = name
+        self.start = start
+
+
+class Failure(Exception):
+    """
+    Exception subclass representing failure of a command execution.
+
+    "Failure" may mean the command executed and the shell indicated an unusual
+    result (usually, a non-zero exit code), or it may mean something else, like
+    a ``sudo`` command which was aborted when the supplied password failed
+    authentication.
+
+    Two attributes allow introspection to determine the nature of the problem:
+
+    * ``result``: a `.Result` instance with info about the command being
+      executed and, if it ran to completion, how it exited.
+    * ``reason``: a wrapped exception instance if applicable (e.g. a
+      `.StreamWatcher` raised `WatcherError`) or ``None`` otherwise, in which
+      case, it's probably a `Failure` subclass indicating its own specific
+      nature, such as `UnexpectedExit` or `CommandTimedOut`.
+
+    This class is only rarely raised by itself; most of the time `.Runner.run`
+    (or a wrapper of same, such as `.Context.sudo`) will raise a specific
+    subclass like `UnexpectedExit` or `AuthFailure`.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self, result: "Result", reason: Optional["WatcherError"] = None
+    ) -> None:
+        self.result = result
+        self.reason = reason
+
+    def streams_for_display(self) -> Tuple[str, str]:
+        """
+        Return stdout/err streams as necessary for error display.
+
+        Subject to the following rules:
+
+        - If a given stream was *not* hidden during execution, a placeholder is
+          used instead, to avoid printing it twice.
+        - Only the last 10 lines of stream text is included.
+        - PTY-driven execution will lack stderr, and a specific message to this
+          effect is returned instead of a stderr dump.
+
+        :returns: Two-tuple of stdout, stderr strings.
+
+        .. versionadded:: 1.3
+        """
+        already_printed = " already printed"
+        if "stdout" not in self.result.hide:
+            stdout = already_printed
+        else:
+            stdout = self.result.tail("stdout")
+        if self.result.pty:
+            stderr = " n/a (PTYs have no stderr)"
+        else:
+            if "stderr" not in self.result.hide:
+                stderr = already_printed
+            else:
+                stderr = self.result.tail("stderr")
+        return stdout, stderr
+
+    def __repr__(self) -> str:
+        return self._repr()
+
+    def _repr(self, **kwargs: Any) -> str:
+        """
+        Return ``__repr__``-like value from inner result + any kwargs.
+        """
+        # TODO: expand?
+        # TODO: truncate command?
+        template = "<{}: cmd={!r}{}>"
+        rest = ""
+        if kwargs:
+            rest = " " + " ".join(
+                "{}={}".format(key, value) for key, value in kwargs.items()
+            )
+        return template.format(
+            self.__class__.__name__, self.result.command, rest
+        )
+
+
+class UnexpectedExit(Failure):
+    """
+    A shell command ran to completion but exited with an unexpected exit code.
+
+    Its string representation displays the following:
+
+    - Command executed;
+    - Exit code;
+    - The last 10 lines of stdout, if it was hidden;
+    - The last 10 lines of stderr, if it was hidden and non-empty (e.g.
+      pty=False; when pty=True, stderr never happens.)
+
+    .. versionadded:: 1.0
+    """
+
+    def __str__(self) -> str:
+        stdout, stderr = self.streams_for_display()
+        command = self.result.command
+        exited = self.result.exited
+        template = """Encountered a bad command exit code!
+
+Command: {!r}
+
+Exit code: {}
+
+Stdout:{}
+
+Stderr:{}
+
+"""
+        return template.format(command, exited, stdout, stderr)
+
+    def _repr(self, **kwargs: Any) -> str:
+        kwargs.setdefault("exited", self.result.exited)
+        return super()._repr(**kwargs)
+
+
+class CommandTimedOut(Failure):
+    """
+    Raised when a subprocess did not exit within a desired timeframe.
+    """
+
+    def __init__(self, result: "Result", timeout: int) -> None:
+        super().__init__(result)
+        self.timeout = timeout
+
+    def __repr__(self) -> str:
+        return self._repr(timeout=self.timeout)
+
+    def __str__(self) -> str:
+        stdout, stderr = self.streams_for_display()
+        command = self.result.command
+        template = """Command did not complete within {} seconds!
+
+Command: {!r}
+
+Stdout:{}
+
+Stderr:{}
+
+"""
+        return template.format(self.timeout, command, stdout, stderr)
+
+
+class AuthFailure(Failure):
+    """
+    An authentication failure, e.g. due to an incorrect ``sudo`` password.
+
+    .. note::
+        `.Result` objects attached to these exceptions typically lack exit code
+        information, since the command was never fully executed - the exception
+        was raised instead.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, result: "Result", prompt: str) -> None:
+        self.result = result
+        self.prompt = prompt
+
+    def __str__(self) -> str:
+        err = "The password submitted to prompt {!r} was rejected."
+        return err.format(self.prompt)
+
+
+class ParseError(Exception):
+    """
+    An error arising from the parsing of command-line flags/arguments.
+
+    Ambiguous input, invalid task names, invalid flags, etc.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self, msg: str, context: Optional["ParserContext"] = None
+    ) -> None:
+        super().__init__(msg)
+        self.context = context
+
+
+class Exit(Exception):
+    """
+    Simple custom stand-in for SystemExit.
+
+    Replaces scattered sys.exit calls, improves testability, allows one to
+    catch an exit request without intercepting real SystemExits (typically an
+    unfriendly thing to do, as most users calling `sys.exit` rather expect it
+    to truly exit.)
+
+    Defaults to a non-printing, exit-0 friendly termination behavior if the
+    exception is uncaught.
+
+    If ``code`` (an int) given, that code is used to exit.
+
+    If ``message`` (a string) given, it is printed to standard error, and the
+    program exits with code ``1`` by default (unless overridden by also giving
+    ``code`` explicitly.)
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self, message: Optional[str] = None, code: Optional[int] = None
+    ) -> None:
+        self.message = message
+        self._code = code
+
+    @property
+    def code(self) -> int:
+        if self._code is not None:
+            return self._code
+        return 1 if self.message else 0
+
+
+class PlatformError(Exception):
+    """
+    Raised when an illegal operation occurs for the current platform.
+
+    E.g. Windows users trying to use functionality requiring the ``pty``
+    module.
+
+    Typically used to present a clearer error message to the user.
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class AmbiguousEnvVar(Exception):
+    """
+    Raised when loading env var config keys has an ambiguous target.
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class UncastableEnvVar(Exception):
+    """
+    Raised on attempted env var loads whose default values are too rich.
+
+    E.g. trying to stuff ``MY_VAR="foo"`` into ``{'my_var': ['uh', 'oh']}``
+    doesn't make any sense until/if we implement some sort of transform option.
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class UnknownFileType(Exception):
+    """
+    A config file of an unknown type was specified and cannot be loaded.
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class UnpicklableConfigMember(Exception):
+    """
+    A config file contained module objects, which can't be pickled/copied.
+
+    We raise this more easily catchable exception instead of letting the
+    (unclearly phrased) TypeError bubble out of the pickle module. (However, to
+    avoid our own fragile catching of that error, we head it off by explicitly
+    testing for module members.)
+
+    .. versionadded:: 1.0.2
+    """
+
+    pass
+
+
+def _printable_kwargs(kwargs: Any) -> Dict[str, Any]:
+    """
+    Return print-friendly version of a thread-related ``kwargs`` dict.
+
+    Extra care is taken with ``args`` members which are very long iterables -
+    those need truncating to be useful.
+    """
+    printable = {}
+    for key, value in kwargs.items():
+        item = value
+        if key == "args":
+            item = []
+            for arg in value:
+                new_arg = arg
+                if hasattr(arg, "__len__") and len(arg) > 10:
+                    msg = "<... remainder truncated during error display ...>"
+                    new_arg = arg[:10] + [msg]
+                item.append(new_arg)
+        printable[key] = item
+    return printable
+
+
+class ThreadException(Exception):
+    """
+    One or more exceptions were raised within background threads.
+
+    The real underlying exceptions are stored in the `exceptions` attribute;
+    see its documentation for data structure details.
+
+    .. note::
+        Threads which did not encounter an exception, do not contribute to this
+        exception object and thus are not present inside `exceptions`.
+
+    .. versionadded:: 1.0
+    """
+
+    #: A tuple of `ExceptionWrappers <invoke.util.ExceptionWrapper>` containing
+    #: the initial thread constructor kwargs (because `threading.Thread`
+    #: subclasses should always be called with kwargs) and the caught exception
+    #: for that thread as seen by `sys.exc_info` (so: type, value, traceback).
+    #:
+    #: .. note::
+    #:     The ordering of this attribute is not well-defined.
+    #:
+    #: .. note::
+    #:     Thread kwargs which appear to be very long (e.g. IO
+    #:     buffers) will be truncated when printed, to avoid huge
+    #:     unreadable error display.
+    exceptions: Tuple["ExceptionWrapper", ...] = tuple()
+
+    def __init__(self, exceptions: List["ExceptionWrapper"]) -> None:
+        self.exceptions = tuple(exceptions)
+
+    def __str__(self) -> str:
+        details = []
+        for x in self.exceptions:
+            # Build useful display
+            detail = "Thread args: {}\n\n{}"
+            details.append(
+                detail.format(
+                    pformat(_printable_kwargs(x.kwargs)),
+                    "\n".join(format_exception(x.type, x.value, x.traceback)),
+                )
+            )
+        args = (
+            len(self.exceptions),
+            ", ".join(x.type.__name__ for x in self.exceptions),
+            "\n\n".join(details),
+        )
+        return """
+Saw {} exceptions within threads ({}):
+
+
+{}
+""".format(
+            *args
+        )
+
+
+class WatcherError(Exception):
+    """
+    Generic parent exception class for `.StreamWatcher`-related errors.
+
+    Typically, one of these exceptions indicates a `.StreamWatcher` noticed
+    something anomalous in an output stream, such as an authentication response
+    failure.
+
+    `.Runner` catches these and attaches them to `.Failure` exceptions so they
+    can be referenced by intermediate code and/or act as extra info for end
+    users.
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class ResponseNotAccepted(WatcherError):
+    """
+    A responder/watcher class noticed a 'bad' response to its submission.
+
+    Mostly used by `.FailingResponder` and subclasses, e.g. "oh dear I
+    autosubmitted a sudo password and it was incorrect."
+
+    .. versionadded:: 1.0
+    """
+
+    pass
+
+
+class SubprocessPipeError(Exception):
+    """
+    Some problem was encountered handling subprocess pipes (stdout/err/in).
+
+    Typically only for corner cases; most of the time, errors in this area are
+    raised by the interpreter or the operating system, and end up wrapped in a
+    `.ThreadException`.
+
+    .. versionadded:: 1.3
+    """
+
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/executor.py b/TP03/TP03/lib/python3.9/site-packages/invoke/executor.py
new file mode 100644
index 0000000000000000000000000000000000000000..08aa74e31fb4e175538d79c163af4dc1edb5c31f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/executor.py
@@ -0,0 +1,229 @@
+from typing import TYPE_CHECKING, Any, Dict, List, Optional, Tuple, Union
+
+from .config import Config
+from .parser import ParserContext
+from .util import debug
+from .tasks import Call, Task
+
+if TYPE_CHECKING:
+    from .collection import Collection
+    from .runners import Result
+    from .parser import ParseResult
+
+
+class Executor:
+    """
+    An execution strategy for Task objects.
+
+    Subclasses may override various extension points to change, add or remove
+    behavior.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self,
+        collection: "Collection",
+        config: Optional["Config"] = None,
+        core: Optional["ParseResult"] = None,
+    ) -> None:
+        """
+        Initialize executor with handles to necessary data structures.
+
+        :param collection:
+            A `.Collection` used to look up requested tasks (and their default
+            config data, if any) by name during execution.
+
+        :param config:
+            An optional `.Config` holding configuration state. Defaults to an
+            empty `.Config` if not given.
+
+        :param core:
+            An optional `.ParseResult` holding parsed core program arguments.
+            Defaults to ``None``.
+        """
+        self.collection = collection
+        self.config = config if config is not None else Config()
+        self.core = core
+
+    def execute(
+        self, *tasks: Union[str, Tuple[str, Dict[str, Any]], ParserContext]
+    ) -> Dict["Task", "Result"]:
+        """
+        Execute one or more ``tasks`` in sequence.
+
+        :param tasks:
+            An all-purpose iterable of "tasks to execute", each member of which
+            may take one of the following forms:
+
+            **A string** naming a task from the Executor's `.Collection`. This
+            name may contain dotted syntax appropriate for calling namespaced
+            tasks, e.g. ``subcollection.taskname``. Such tasks are executed
+            without arguments.
+
+            **A two-tuple** whose first element is a task name string (as
+            above) and whose second element is a dict suitable for use as
+            ``**kwargs`` when calling the named task. E.g.::
+
+                [
+                    ('task1', {}),
+                    ('task2', {'arg1': 'val1'}),
+                    ...
+                ]
+
+            is equivalent, roughly, to::
+
+                task1()
+                task2(arg1='val1')
+
+            **A `.ParserContext`** instance, whose ``.name`` attribute is used
+            as the task name and whose ``.as_kwargs`` attribute is used as the
+            task kwargs (again following the above specifications).
+
+            .. note::
+                When called without any arguments at all (i.e. when ``*tasks``
+                is empty), the default task from ``self.collection`` is used
+                instead, if defined.
+
+        :returns:
+            A dict mapping task objects to their return values.
+
+            This dict may include pre- and post-tasks if any were executed. For
+            example, in a collection with a ``build`` task depending on another
+            task named ``setup``, executing ``build`` will result in a dict
+            with two keys, one for ``build`` and one for ``setup``.
+
+        .. versionadded:: 1.0
+        """
+        # Normalize input
+        debug("Examining top level tasks {!r}".format([x for x in tasks]))
+        calls = self.normalize(tasks)
+        debug("Tasks (now Calls) with kwargs: {!r}".format(calls))
+        # Obtain copy of directly-given tasks since they should sometimes
+        # behave differently
+        direct = list(calls)
+        # Expand pre/post tasks
+        # TODO: may make sense to bundle expansion & deduping now eh?
+        expanded = self.expand_calls(calls)
+        # Get some good value for dedupe option, even if config doesn't have
+        # the tree we expect. (This is a concession to testing.)
+        try:
+            dedupe = self.config.tasks.dedupe
+        except AttributeError:
+            dedupe = True
+        # Dedupe across entire run now that we know about all calls in order
+        calls = self.dedupe(expanded) if dedupe else expanded
+        # Execute
+        results = {}
+        # TODO: maybe clone initial config here? Probably not necessary,
+        # especially given Executor is not designed to execute() >1 time at the
+        # moment...
+        for call in calls:
+            autoprint = call in direct and call.autoprint
+            debug("Executing {!r}".format(call))
+            # Hand in reference to our config, which will preserve user
+            # modifications across the lifetime of the session.
+            config = self.config
+            # But make sure we reset its task-sensitive levels each time
+            # (collection & shell env)
+            # TODO: load_collection needs to be skipped if task is anonymous
+            # (Fabric 2 or other subclassing libs only)
+            collection_config = self.collection.configuration(call.called_as)
+            config.load_collection(collection_config)
+            config.load_shell_env()
+            debug("Finished loading collection & shell env configs")
+            # Get final context from the Call (which will know how to generate
+            # an appropriate one; e.g. subclasses might use extra data from
+            # being parameterized), handing in this config for use there.
+            context = call.make_context(config)
+            args = (context, *call.args)
+            result = call.task(*args, **call.kwargs)
+            if autoprint:
+                print(result)
+            # TODO: handle the non-dedupe case / the same-task-different-args
+            # case, wherein one task obj maps to >1 result.
+            results[call.task] = result
+        return results
+
+    def normalize(
+        self,
+        tasks: Tuple[
+            Union[str, Tuple[str, Dict[str, Any]], ParserContext], ...
+        ],
+    ) -> List["Call"]:
+        """
+        Transform arbitrary task list w/ various types, into `.Call` objects.
+
+        See docstring for `~.Executor.execute` for details.
+
+        .. versionadded:: 1.0
+        """
+        calls = []
+        for task in tasks:
+            name: Optional[str]
+            if isinstance(task, str):
+                name = task
+                kwargs = {}
+            elif isinstance(task, ParserContext):
+                name = task.name
+                kwargs = task.as_kwargs
+            else:
+                name, kwargs = task
+            c = Call(self.collection[name], kwargs=kwargs, called_as=name)
+            calls.append(c)
+        if not tasks and self.collection.default is not None:
+            calls = [Call(self.collection[self.collection.default])]
+        return calls
+
+    def dedupe(self, calls: List["Call"]) -> List["Call"]:
+        """
+        Deduplicate a list of `tasks <.Call>`.
+
+        :param calls: An iterable of `.Call` objects representing tasks.
+
+        :returns: A list of `.Call` objects.
+
+        .. versionadded:: 1.0
+        """
+        deduped = []
+        debug("Deduplicating tasks...")
+        for call in calls:
+            if call not in deduped:
+                debug("{!r}: no duplicates found, ok".format(call))
+                deduped.append(call)
+            else:
+                debug("{!r}: found in list already, skipping".format(call))
+        return deduped
+
+    def expand_calls(self, calls: List["Call"]) -> List["Call"]:
+        """
+        Expand a list of `.Call` objects into a near-final list of same.
+
+        The default implementation of this method simply adds a task's
+        pre/post-task list before/after the task itself, as necessary.
+
+        Subclasses may wish to do other things in addition (or instead of) the
+        above, such as multiplying the `calls <.Call>` by argument vectors or
+        similar.
+
+        .. versionadded:: 1.0
+        """
+        ret = []
+        for call in calls:
+            # Normalize to Call (this method is sometimes called with pre/post
+            # task lists, which may contain 'raw' Task objects)
+            if isinstance(call, Task):
+                call = Call(call)
+            debug("Expanding task-call {!r}".format(call))
+            # TODO: this is where we _used_ to call Executor.config_for(call,
+            # config)...
+            # TODO: now we may need to preserve more info like where the call
+            # came from, etc, but I feel like that shit should go _on the call
+            # itself_ right???
+            # TODO: we _probably_ don't even want the config in here anymore,
+            # we want this to _just_ be about the recursion across pre/post
+            # tasks or parameterization...?
+            ret.extend(self.expand_calls(call.pre))
+            ret.append(call)
+            ret.extend(self.expand_calls(call.post))
+        return ret
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/loader.py b/TP03/TP03/lib/python3.9/site-packages/invoke/loader.py
new file mode 100644
index 0000000000000000000000000000000000000000..801d1633325114e6e1ec392d9712de68049f6205
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/loader.py
@@ -0,0 +1,154 @@
+import os
+import sys
+from importlib.machinery import ModuleSpec
+from importlib.util import module_from_spec, spec_from_file_location
+from pathlib import Path
+from types import ModuleType
+from typing import Any, Optional, Tuple
+
+from . import Config
+from .exceptions import CollectionNotFound
+from .util import debug
+
+
+class Loader:
+    """
+    Abstract class defining how to find/import a session's base `.Collection`.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, config: Optional["Config"] = None) -> None:
+        """
+        Set up a new loader with some `.Config`.
+
+        :param config:
+            An explicit `.Config` to use; it is referenced for loading-related
+            config options. Defaults to an anonymous ``Config()`` if none is
+            given.
+        """
+        if config is None:
+            config = Config()
+        self.config = config
+
+    def find(self, name: str) -> Optional[ModuleSpec]:
+        """
+        Implementation-specific finder method seeking collection ``name``.
+
+        Must return a ModuleSpec valid for use by `importlib`, which is
+        typically a name string followed by the contents of the 3-tuple
+        returned by `importlib.module_from_spec` (``name``, ``loader``,
+        ``origin``.)
+
+        For a sample implementation, see `.FilesystemLoader`.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def load(self, name: Optional[str] = None) -> Tuple[ModuleType, str]:
+        """
+        Load and return collection module identified by ``name``.
+
+        This method requires a working implementation of `.find` in order to
+        function.
+
+        In addition to importing the named module, it will add the module's
+        parent directory to the front of `sys.path` to provide normal Python
+        import behavior (i.e. so the loaded module may load local-to-it modules
+        or packages.)
+
+        :returns:
+            Two-tuple of ``(module, directory)`` where ``module`` is the
+            collection-containing Python module object, and ``directory`` is
+            the string path to the directory the module was found in.
+
+        .. versionadded:: 1.0
+        """
+        if name is None:
+            name = self.config.tasks.collection_name
+        spec = self.find(name)
+        if spec and spec.loader and spec.origin:
+            # Typically either tasks.py or tasks/__init__.py
+            source_file = Path(spec.origin)
+            # Will be 'the dir tasks.py is in', or 'tasks/', in both cases this
+            # is what wants to be in sys.path for "from . import sibling"
+            enclosing_dir = source_file.parent
+            # Will be "the directory above the spot that 'import tasks' found",
+            # namely the parent of "your task tree", i.e. "where project level
+            # config files are looked for". So, same as enclosing_dir for
+            # tasks.py, but one more level up for tasks/__init__.py...
+            module_parent = enclosing_dir
+            if spec.parent:  # it's a package, so we have to go up again
+                module_parent = module_parent.parent
+            # Get the enclosing dir on the path
+            enclosing_str = str(enclosing_dir)
+            if enclosing_str not in sys.path:
+                sys.path.insert(0, enclosing_str)
+            # Actual import
+            module = module_from_spec(spec)
+            sys.modules[spec.name] = module  # so 'from . import xxx' works
+            spec.loader.exec_module(module)
+            # Return the module and the folder it was found in
+            return module, str(module_parent)
+        msg = "ImportError loading {!r}, raising ImportError"
+        debug(msg.format(name))
+        raise ImportError
+
+
+class FilesystemLoader(Loader):
+    """
+    Loads Python files from the filesystem (e.g. ``tasks.py``.)
+
+    Searches recursively towards filesystem root from a given start point.
+
+    .. versionadded:: 1.0
+    """
+
+    # TODO: could introduce config obj here for transmission to Collection
+    # TODO: otherwise Loader has to know about specific bits to transmit, such
+    # as auto-dashes, and has to grow one of those for every bit Collection
+    # ever needs to know
+    def __init__(self, start: Optional[str] = None, **kwargs: Any) -> None:
+        super().__init__(**kwargs)
+        if start is None:
+            start = self.config.tasks.search_root
+        self._start = start
+
+    @property
+    def start(self) -> str:
+        # Lazily determine default CWD if configured value is falsey
+        return self._start or os.getcwd()
+
+    def find(self, name: str) -> Optional[ModuleSpec]:
+        debug("FilesystemLoader find starting at {!r}".format(self.start))
+        spec = None
+        module = "{}.py".format(name)
+        paths = self.start.split(os.sep)
+        try:
+            # walk the path upwards to check for dynamic import
+            for x in reversed(range(len(paths) + 1)):
+                path = os.sep.join(paths[0:x])
+                if module in os.listdir(path):
+                    spec = spec_from_file_location(
+                        name, os.path.join(path, module)
+                    )
+                    break
+                elif name in os.listdir(path) and os.path.exists(
+                    os.path.join(path, name, "__init__.py")
+                ):
+                    basepath = os.path.join(path, name)
+                    spec = spec_from_file_location(
+                        name,
+                        os.path.join(basepath, "__init__.py"),
+                        submodule_search_locations=[basepath],
+                    )
+                    break
+            if spec:
+                debug("Found module: {!r}".format(spec))
+                return spec
+        except (FileNotFoundError, ModuleNotFoundError):
+            msg = "ImportError loading {!r}, raising CollectionNotFound"
+            debug(msg.format(name))
+            raise CollectionNotFound(name=name, start=self.start)
+        return None
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/main.py b/TP03/TP03/lib/python3.9/site-packages/invoke/main.py
new file mode 100644
index 0000000000000000000000000000000000000000..3576b5a5fc1d8ad1c25d96dd9da4f9eb4b6d9813
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/main.py
@@ -0,0 +1,14 @@
+"""
+Invoke's own 'binary' entrypoint.
+
+Dogfoods the `program` module.
+"""
+
+from . import __version__, Program
+
+program = Program(
+    name="Invoke",
+    binary="inv[oke]",
+    binary_names=["invoke", "inv"],
+    version=__version__,
+)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..02aa026223b92589ce70bcb3e6d5708fff4d8ddf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__init__.py
@@ -0,0 +1,5 @@
+# flake8: noqa
+from .parser import *
+from .context import ParserContext
+from .context import ParserContext as Context, to_flag, translate_underscores
+from .argument import Argument
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a0f914ebd9fdf4f7445bd5ae4be008cd0b95c7bc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/argument.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/argument.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2ded9bbde7b06566d3fad68dc6d459aec72b3675
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/argument.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/context.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/context.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd226c1c0c649caf904f01bf0539372e7f0dc385
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/context.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/parser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/parser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..06f988a6149284888eb3b2cd7d9b7784cd3c39c6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/__pycache__/parser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/argument.py b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/argument.py
new file mode 100644
index 0000000000000000000000000000000000000000..761eb60219d6cf7ee8adedb70e54cb3060e95a81
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/argument.py
@@ -0,0 +1,178 @@
+from typing import Any, Iterable, Optional, Tuple
+
+# TODO: dynamic type for kind
+# T = TypeVar('T')
+
+
+class Argument:
+    """
+    A command-line argument/flag.
+
+    :param name:
+        Syntactic sugar for ``names=[<name>]``. Giving both ``name`` and
+        ``names`` is invalid.
+    :param names:
+        List of valid identifiers for this argument. For example, a "help"
+        argument may be defined with a name list of ``['-h', '--help']``.
+    :param kind:
+        Type factory & parser hint. E.g. ``int`` will turn the default text
+        value parsed, into a Python integer; and ``bool`` will tell the
+        parser not to expect an actual value but to treat the argument as a
+        toggle/flag.
+    :param default:
+        Default value made available to the parser if no value is given on the
+        command line.
+    :param help:
+        Help text, intended for use with ``--help``.
+    :param positional:
+        Whether or not this argument's value may be given positionally. When
+        ``False`` (default) arguments must be explicitly named.
+    :param optional:
+        Whether or not this (non-``bool``) argument requires a value.
+    :param incrementable:
+        Whether or not this (``int``) argument is to be incremented instead of
+        overwritten/assigned to.
+    :param attr_name:
+        A Python identifier/attribute friendly name, typically filled in with
+        the underscored version when ``name``/``names`` contain dashes.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self,
+        name: Optional[str] = None,
+        names: Iterable[str] = (),
+        kind: Any = str,
+        default: Optional[Any] = None,
+        help: Optional[str] = None,
+        positional: bool = False,
+        optional: bool = False,
+        incrementable: bool = False,
+        attr_name: Optional[str] = None,
+    ) -> None:
+        if name and names:
+            raise TypeError(
+                "Cannot give both 'name' and 'names' arguments! Pick one."
+            )
+        if not (name or names):
+            raise TypeError("An Argument must have at least one name.")
+        if names:
+            self.names = tuple(names)
+        elif name and not names:
+            self.names = (name,)
+        self.kind = kind
+        initial_value: Optional[Any] = None
+        # Special case: list-type args start out as empty list, not None.
+        if kind is list:
+            initial_value = []
+        # Another: incrementable args start out as their default value.
+        if incrementable:
+            initial_value = default
+        self.raw_value = self._value = initial_value
+        self.default = default
+        self.help = help
+        self.positional = positional
+        self.optional = optional
+        self.incrementable = incrementable
+        self.attr_name = attr_name
+
+    def __repr__(self) -> str:
+        nicks = ""
+        if self.nicknames:
+            nicks = " ({})".format(", ".join(self.nicknames))
+        flags = ""
+        if self.positional or self.optional:
+            flags = " "
+        if self.positional:
+            flags += "*"
+        if self.optional:
+            flags += "?"
+        # TODO: store this default value somewhere other than signature of
+        # Argument.__init__?
+        kind = ""
+        if self.kind != str:
+            kind = " [{}]".format(self.kind.__name__)
+        return "<{}: {}{}{}{}>".format(
+            self.__class__.__name__, self.name, nicks, kind, flags
+        )
+
+    @property
+    def name(self) -> Optional[str]:
+        """
+        The canonical attribute-friendly name for this argument.
+
+        Will be ``attr_name`` (if given to constructor) or the first name in
+        ``names`` otherwise.
+
+        .. versionadded:: 1.0
+        """
+        return self.attr_name or self.names[0]
+
+    @property
+    def nicknames(self) -> Tuple[str, ...]:
+        return self.names[1:]
+
+    @property
+    def takes_value(self) -> bool:
+        if self.kind is bool:
+            return False
+        if self.incrementable:
+            return False
+        return True
+
+    @property
+    def value(self) -> Any:
+        # TODO: should probably be optional instead
+        return self._value if self._value is not None else self.default
+
+    @value.setter
+    def value(self, arg: str) -> None:
+        self.set_value(arg, cast=True)
+
+    def set_value(self, value: Any, cast: bool = True) -> None:
+        """
+        Actual explicit value-setting API call.
+
+        Sets ``self.raw_value`` to ``value`` directly.
+
+        Sets ``self.value`` to ``self.kind(value)``, unless:
+
+        - ``cast=False``, in which case the raw value is also used.
+        - ``self.kind==list``, in which case the value is appended to
+          ``self.value`` instead of cast & overwritten.
+        - ``self.incrementable==True``, in which case the value is ignored and
+          the current (assumed int) value is simply incremented.
+
+        .. versionadded:: 1.0
+        """
+        self.raw_value = value
+        # Default to do-nothing/identity function
+        func = lambda x: x
+        # If cast, set to self.kind, which should be str/int/etc
+        if cast:
+            func = self.kind
+        # If self.kind is a list, append instead of using cast func.
+        if self.kind is list:
+            func = lambda x: self.value + [x]
+        # If incrementable, just increment.
+        if self.incrementable:
+            # TODO: explode nicely if self.value was not an int to start
+            # with
+            func = lambda x: self.value + 1
+        self._value = func(value)
+
+    @property
+    def got_value(self) -> bool:
+        """
+        Returns whether the argument was ever given a (non-default) value.
+
+        For most argument kinds, this simply checks whether the internally
+        stored value is non-``None``; for others, such as ``list`` kinds,
+        different checks may be used.
+
+        .. versionadded:: 1.3
+        """
+        if self.kind is list:
+            return bool(self._value)
+        return self._value is not None
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/context.py b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/context.py
new file mode 100644
index 0000000000000000000000000000000000000000..359e9f9e2f34ce84e9ec2527dcb54ce340b6a616
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/context.py
@@ -0,0 +1,266 @@
+import itertools
+from typing import Any, Dict, List, Iterable, Optional, Tuple, Union
+
+try:
+    from ..vendor.lexicon import Lexicon
+except ImportError:
+    from lexicon import Lexicon  # type: ignore[no-redef]
+
+from .argument import Argument
+
+
+def translate_underscores(name: str) -> str:
+    return name.lstrip("_").rstrip("_").replace("_", "-")
+
+
+def to_flag(name: str) -> str:
+    name = translate_underscores(name)
+    if len(name) == 1:
+        return "-" + name
+    return "--" + name
+
+
+def sort_candidate(arg: Argument) -> str:
+    names = arg.names
+    # TODO: is there no "split into two buckets on predicate" builtin?
+    shorts = {x for x in names if len(x.strip("-")) == 1}
+    longs = {x for x in names if x not in shorts}
+    return str(sorted(shorts if shorts else longs)[0])
+
+
+def flag_key(arg: Argument) -> List[Union[int, str]]:
+    """
+    Obtain useful key list-of-ints for sorting CLI flags.
+
+    .. versionadded:: 1.0
+    """
+    # Setup
+    ret: List[Union[int, str]] = []
+    x = sort_candidate(arg)
+    # Long-style flags win over short-style ones, so the first item of
+    # comparison is simply whether the flag is a single character long (with
+    # non-length-1 flags coming "first" [lower number])
+    ret.append(1 if len(x) == 1 else 0)
+    # Next item of comparison is simply the strings themselves,
+    # case-insensitive. They will compare alphabetically if compared at this
+    # stage.
+    ret.append(x.lower())
+    # Finally, if the case-insensitive test also matched, compare
+    # case-sensitive, but inverse (with lowercase letters coming first)
+    inversed = ""
+    for char in x:
+        inversed += char.lower() if char.isupper() else char.upper()
+    ret.append(inversed)
+    return ret
+
+
+# Named slightly more verbose so Sphinx references can be unambiguous.
+# Got real sick of fully qualified paths.
+class ParserContext:
+    """
+    Parsing context with knowledge of flags & their format.
+
+    Generally associated with the core program or a task.
+
+    When run through a parser, will also hold runtime values filled in by the
+    parser.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self,
+        name: Optional[str] = None,
+        aliases: Iterable[str] = (),
+        args: Iterable[Argument] = (),
+    ) -> None:
+        """
+        Create a new ``ParserContext`` named ``name``, with ``aliases``.
+
+        ``name`` is optional, and should be a string if given. It's used to
+        tell ParserContext objects apart, and for use in a Parser when
+        determining what chunk of input might belong to a given ParserContext.
+
+        ``aliases`` is also optional and should be an iterable containing
+        strings. Parsing will honor any aliases when trying to "find" a given
+        context in its input.
+
+        May give one or more ``args``, which is a quick alternative to calling
+        ``for arg in args: self.add_arg(arg)`` after initialization.
+        """
+        self.args = Lexicon()
+        self.positional_args: List[Argument] = []
+        self.flags = Lexicon()
+        self.inverse_flags: Dict[str, str] = {}  # No need for Lexicon here
+        self.name = name
+        self.aliases = aliases
+        for arg in args:
+            self.add_arg(arg)
+
+    def __repr__(self) -> str:
+        aliases = ""
+        if self.aliases:
+            aliases = " ({})".format(", ".join(self.aliases))
+        name = (" {!r}{}".format(self.name, aliases)) if self.name else ""
+        args = (": {!r}".format(self.args)) if self.args else ""
+        return "<parser/Context{}{}>".format(name, args)
+
+    def add_arg(self, *args: Any, **kwargs: Any) -> None:
+        """
+        Adds given ``Argument`` (or constructor args for one) to this context.
+
+        The Argument in question is added to the following dict attributes:
+
+        * ``args``: "normal" access, i.e. the given names are directly exposed
+          as keys.
+        * ``flags``: "flaglike" access, i.e. the given names are translated
+          into CLI flags, e.g. ``"foo"`` is accessible via ``flags['--foo']``.
+        * ``inverse_flags``: similar to ``flags`` but containing only the
+          "inverse" versions of boolean flags which default to True. This
+          allows the parser to track e.g. ``--no-myflag`` and turn it into a
+          False value for the ``myflag`` Argument.
+
+        .. versionadded:: 1.0
+        """
+        # Normalize
+        if len(args) == 1 and isinstance(args[0], Argument):
+            arg = args[0]
+        else:
+            arg = Argument(*args, **kwargs)
+        # Uniqueness constraint: no name collisions
+        for name in arg.names:
+            if name in self.args:
+                msg = "Tried to add an argument named {!r} but one already exists!"  # noqa
+                raise ValueError(msg.format(name))
+        # First name used as "main" name for purposes of aliasing
+        main = arg.names[0]  # NOT arg.name
+        self.args[main] = arg
+        # Note positionals in distinct, ordered list attribute
+        if arg.positional:
+            self.positional_args.append(arg)
+        # Add names & nicknames to flags, args
+        self.flags[to_flag(main)] = arg
+        for name in arg.nicknames:
+            self.args.alias(name, to=main)
+            self.flags.alias(to_flag(name), to=to_flag(main))
+        # Add attr_name to args, but not flags
+        if arg.attr_name:
+            self.args.alias(arg.attr_name, to=main)
+        # Add to inverse_flags if required
+        if arg.kind == bool and arg.default is True:
+            # Invert the 'main' flag name here, which will be a dashed version
+            # of the primary argument name if underscore-to-dash transformation
+            # occurred.
+            inverse_name = to_flag("no-{}".format(main))
+            self.inverse_flags[inverse_name] = to_flag(main)
+
+    @property
+    def missing_positional_args(self) -> List[Argument]:
+        return [x for x in self.positional_args if x.value is None]
+
+    @property
+    def as_kwargs(self) -> Dict[str, Any]:
+        """
+        This context's arguments' values keyed by their ``.name`` attribute.
+
+        Results in a dict suitable for use in Python contexts, where e.g. an
+        arg named ``foo-bar`` becomes accessible as ``foo_bar``.
+
+        .. versionadded:: 1.0
+        """
+        ret = {}
+        for arg in self.args.values():
+            ret[arg.name] = arg.value
+        return ret
+
+    def names_for(self, flag: str) -> List[str]:
+        # TODO: should probably be a method on Lexicon/AliasDict
+        return list(set([flag] + self.flags.aliases_of(flag)))
+
+    def help_for(self, flag: str) -> Tuple[str, str]:
+        """
+        Return 2-tuple of ``(flag-spec, help-string)`` for given ``flag``.
+
+        .. versionadded:: 1.0
+        """
+        # Obtain arg obj
+        if flag not in self.flags:
+            err = "{!r} is not a valid flag for this context! Valid flags are: {!r}"  # noqa
+            raise ValueError(err.format(flag, self.flags.keys()))
+        arg = self.flags[flag]
+        # Determine expected value type, if any
+        value = {str: "STRING", int: "INT"}.get(arg.kind)
+        # Format & go
+        full_names = []
+        for name in self.names_for(flag):
+            if value:
+                # Short flags are -f VAL, long are --foo=VAL
+                # When optional, also, -f [VAL] and --foo[=VAL]
+                if len(name.strip("-")) == 1:
+                    value_ = ("[{}]".format(value)) if arg.optional else value
+                    valuestr = " {}".format(value_)
+                else:
+                    valuestr = "={}".format(value)
+                    if arg.optional:
+                        valuestr = "[{}]".format(valuestr)
+            else:
+                # no value => boolean
+                # check for inverse
+                if name in self.inverse_flags.values():
+                    name = "--[no-]{}".format(name[2:])
+
+                valuestr = ""
+            # Tack together
+            full_names.append(name + valuestr)
+        namestr = ", ".join(sorted(full_names, key=len))
+        helpstr = arg.help or ""
+        return namestr, helpstr
+
+    def help_tuples(self) -> List[Tuple[str, Optional[str]]]:
+        """
+        Return sorted iterable of help tuples for all member Arguments.
+
+        Sorts like so:
+
+        * General sort is alphanumerically
+        * Short flags win over long flags
+        * Arguments with *only* long flags and *no* short flags will come
+          first.
+        * When an Argument has multiple long or short flags, it will sort using
+          the most favorable (lowest alphabetically) candidate.
+
+        This will result in a help list like so::
+
+            --alpha, --zeta # 'alpha' wins
+            --beta
+            -a, --query # short flag wins
+            -b, --argh
+            -c
+
+        .. versionadded:: 1.0
+        """
+        # TODO: argument/flag API must change :(
+        # having to call to_flag on 1st name of an Argument is just dumb.
+        # To pass in an Argument object to help_for may require moderate
+        # changes?
+        return list(
+            map(
+                lambda x: self.help_for(to_flag(x.name)),
+                sorted(self.flags.values(), key=flag_key),
+            )
+        )
+
+    def flag_names(self) -> Tuple[str, ...]:
+        """
+        Similar to `help_tuples` but returns flag names only, no helpstrs.
+
+        Specifically, all flag names, flattened, in rough order.
+
+        .. versionadded:: 1.0
+        """
+        # Regular flag names
+        flags = sorted(self.flags.values(), key=flag_key)
+        names = [self.names_for(to_flag(x.name)) for x in flags]
+        # Inverse flag names sold separately
+        names.append(list(self.inverse_flags.keys()))
+        return tuple(itertools.chain.from_iterable(names))
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/parser/parser.py b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..43e95df047ce1758ab81df2ab8e7fe09520f2339
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/parser/parser.py
@@ -0,0 +1,455 @@
+import copy
+from typing import TYPE_CHECKING, Any, Iterable, List, Optional
+
+try:
+    from ..vendor.lexicon import Lexicon
+    from ..vendor.fluidity import StateMachine, state, transition
+except ImportError:
+    from lexicon import Lexicon  # type: ignore[no-redef]
+    from fluidity import (  # type: ignore[no-redef]
+        StateMachine,
+        state,
+        transition,
+    )
+
+from ..exceptions import ParseError
+from ..util import debug
+
+if TYPE_CHECKING:
+    from .context import ParserContext
+
+
+def is_flag(value: str) -> bool:
+    return value.startswith("-")
+
+
+def is_long_flag(value: str) -> bool:
+    return value.startswith("--")
+
+
+class ParseResult(List["ParserContext"]):
+    """
+    List-like object with some extra parse-related attributes.
+
+    Specifically, a ``.remainder`` attribute, which is the string found after a
+    ``--`` in any parsed argv list; and an ``.unparsed`` attribute, a list of
+    tokens that were unable to be parsed.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, *args: Any, **kwargs: Any) -> None:
+        super().__init__(*args, **kwargs)
+        self.remainder = ""
+        self.unparsed: List[str] = []
+
+
+class Parser:
+    """
+    Create parser conscious of ``contexts`` and optional ``initial`` context.
+
+    ``contexts`` should be an iterable of ``Context`` instances which will be
+    searched when new context names are encountered during a parse. These
+    Contexts determine what flags may follow them, as well as whether given
+    flags take values.
+
+    ``initial`` is optional and will be used to determine validity of "core"
+    options/flags at the start of the parse run, if any are encountered.
+
+    ``ignore_unknown`` determines what to do when contexts are found which do
+    not map to any members of ``contexts``. By default it is ``False``, meaning
+    any unknown contexts result in a parse error exception. If ``True``,
+    encountering an unknown context halts parsing and populates the return
+    value's ``.unparsed`` attribute with the remaining parse tokens.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self,
+        contexts: Iterable["ParserContext"] = (),
+        initial: Optional["ParserContext"] = None,
+        ignore_unknown: bool = False,
+    ) -> None:
+        self.initial = initial
+        self.contexts = Lexicon()
+        self.ignore_unknown = ignore_unknown
+        for context in contexts:
+            debug("Adding {}".format(context))
+            if not context.name:
+                raise ValueError("Non-initial contexts must have names.")
+            exists = "A context named/aliased {!r} is already in this parser!"
+            if context.name in self.contexts:
+                raise ValueError(exists.format(context.name))
+            self.contexts[context.name] = context
+            for alias in context.aliases:
+                if alias in self.contexts:
+                    raise ValueError(exists.format(alias))
+                self.contexts.alias(alias, to=context.name)
+
+    def parse_argv(self, argv: List[str]) -> ParseResult:
+        """
+        Parse an argv-style token list ``argv``.
+
+        Returns a list (actually a subclass, `.ParseResult`) of
+        `.ParserContext` objects matching the order they were found in the
+        ``argv`` and containing `.Argument` objects with updated values based
+        on any flags given.
+
+        Assumes any program name has already been stripped out. Good::
+
+            Parser(...).parse_argv(['--core-opt', 'task', '--task-opt'])
+
+        Bad::
+
+            Parser(...).parse_argv(['invoke', '--core-opt', ...])
+
+        :param argv: List of argument string tokens.
+        :returns:
+            A `.ParseResult` (a ``list`` subclass containing some number of
+            `.ParserContext` objects).
+
+        .. versionadded:: 1.0
+        """
+        machine = ParseMachine(
+            # FIXME: initial should not be none
+            initial=self.initial,  # type: ignore[arg-type]
+            contexts=self.contexts,
+            ignore_unknown=self.ignore_unknown,
+        )
+        # FIXME: Why isn't there str.partition for lists? There must be a
+        # better way to do this. Split argv around the double-dash remainder
+        # sentinel.
+        debug("Starting argv: {!r}".format(argv))
+        try:
+            ddash = argv.index("--")
+        except ValueError:
+            ddash = len(argv)  # No remainder == body gets all
+        body = argv[:ddash]
+        remainder = argv[ddash:][1:]  # [1:] to strip off remainder itself
+        if remainder:
+            debug(
+                "Remainder: argv[{!r}:][1:] => {!r}".format(ddash, remainder)
+            )
+        for index, token in enumerate(body):
+            # Handle non-space-delimited forms, if not currently expecting a
+            # flag value and still in valid parsing territory (i.e. not in
+            # "unknown" state which implies store-only)
+            # NOTE: we do this in a few steps so we can
+            # split-then-check-validity; necessary for things like when the
+            # previously seen flag optionally takes a value.
+            mutations = []
+            orig = token
+            if is_flag(token) and not machine.result.unparsed:
+                # Equals-sign-delimited flags, eg --foo=bar or -f=bar
+                if "=" in token:
+                    token, _, value = token.partition("=")
+                    msg = "Splitting x=y expr {!r} into tokens {!r} and {!r}"
+                    debug(msg.format(orig, token, value))
+                    mutations.append((index + 1, value))
+                # Contiguous boolean short flags, e.g. -qv
+                elif not is_long_flag(token) and len(token) > 2:
+                    full_token = token[:]
+                    rest, token = token[2:], token[:2]
+                    err = "Splitting {!r} into token {!r} and rest {!r}"
+                    debug(err.format(full_token, token, rest))
+                    # Handle boolean flag block vs short-flag + value. Make
+                    # sure not to test the token as a context flag if we've
+                    # passed into 'storing unknown stuff' territory (e.g. on a
+                    # core-args pass, handling what are going to be task args)
+                    have_flag = (
+                        token in machine.context.flags
+                        and machine.current_state != "unknown"
+                    )
+                    if have_flag and machine.context.flags[token].takes_value:
+                        msg = "{!r} is a flag for current context & it takes a value, giving it {!r}"  # noqa
+                        debug(msg.format(token, rest))
+                        mutations.append((index + 1, rest))
+                    else:
+                        _rest = ["-{}".format(x) for x in rest]
+                        msg = "Splitting multi-flag glob {!r} into {!r} and {!r}"  # noqa
+                        debug(msg.format(orig, token, _rest))
+                        for item in reversed(_rest):
+                            mutations.append((index + 1, item))
+            # Here, we've got some possible mutations queued up, and 'token'
+            # may have been overwritten as well. Whether we apply those and
+            # continue as-is, or roll it back, depends:
+            # - If the parser wasn't waiting for a flag value, we're already on
+            # the right track, so apply mutations and move along to the
+            # handle() step.
+            # - If we ARE waiting for a value, and the flag expecting it ALWAYS
+            # wants a value (it's not optional), we go back to using the
+            # original token. (TODO: could reorganize this to avoid the
+            # sub-parsing in this case, but optimizing for human-facing
+            # execution isn't critical.)
+            # - Finally, if we are waiting for a value AND it's optional, we
+            # inspect the first sub-token/mutation to see if it would otherwise
+            # have been a valid flag, and let that determine what we do (if
+            # valid, we apply the mutations; if invalid, we reinstate the
+            # original token.)
+            if machine.waiting_for_flag_value:
+                optional = machine.flag and machine.flag.optional
+                subtoken_is_valid_flag = token in machine.context.flags
+                if not (optional and subtoken_is_valid_flag):
+                    token = orig
+                    mutations = []
+            for index, value in mutations:
+                body.insert(index, value)
+            machine.handle(token)
+        machine.finish()
+        result = machine.result
+        result.remainder = " ".join(remainder)
+        return result
+
+
+class ParseMachine(StateMachine):
+    initial_state = "context"
+
+    state("context", enter=["complete_flag", "complete_context"])
+    state("unknown", enter=["complete_flag", "complete_context"])
+    state("end", enter=["complete_flag", "complete_context"])
+
+    transition(from_=("context", "unknown"), event="finish", to="end")
+    transition(
+        from_="context",
+        event="see_context",
+        action="switch_to_context",
+        to="context",
+    )
+    transition(
+        from_=("context", "unknown"),
+        event="see_unknown",
+        action="store_only",
+        to="unknown",
+    )
+
+    def changing_state(self, from_: str, to: str) -> None:
+        debug("ParseMachine: {!r} => {!r}".format(from_, to))
+
+    def __init__(
+        self,
+        initial: "ParserContext",
+        contexts: Lexicon,
+        ignore_unknown: bool,
+    ) -> None:
+        # Initialize
+        self.ignore_unknown = ignore_unknown
+        self.initial = self.context = copy.deepcopy(initial)
+        debug("Initialized with context: {!r}".format(self.context))
+        self.flag = None
+        self.flag_got_value = False
+        self.result = ParseResult()
+        self.contexts = copy.deepcopy(contexts)
+        debug("Available contexts: {!r}".format(self.contexts))
+        # In case StateMachine does anything in __init__
+        super().__init__()
+
+    @property
+    def waiting_for_flag_value(self) -> bool:
+        # Do we have a current flag, and does it expect a value (vs being a
+        # bool/toggle)?
+        takes_value = self.flag and self.flag.takes_value
+        if not takes_value:
+            return False
+        # OK, this flag is one that takes values.
+        # Is it a list type (which has only just been switched to)? Then it'll
+        # always accept more values.
+        # TODO: how to handle somebody wanting it to be some other iterable
+        # like tuple or custom class? Or do we just say unsupported?
+        if self.flag.kind is list and not self.flag_got_value:
+            return True
+        # Not a list, okay. Does it already have a value?
+        has_value = self.flag.raw_value is not None
+        # If it doesn't have one, we're waiting for one (which tells the parser
+        # how to proceed and typically to store the next token.)
+        # TODO: in the negative case here, we should do something else instead:
+        # - Except, "hey you screwed up, you already gave that flag!"
+        # - Overwrite, "oh you changed your mind?" - which requires more work
+        # elsewhere too, unfortunately. (Perhaps additional properties on
+        # Argument that can be queried, e.g. "arg.is_iterable"?)
+        return not has_value
+
+    def handle(self, token: str) -> None:
+        debug("Handling token: {!r}".format(token))
+        # Handle unknown state at the top: we don't care about even
+        # possibly-valid input if we've encountered unknown input.
+        if self.current_state == "unknown":
+            debug("Top-of-handle() see_unknown({!r})".format(token))
+            self.see_unknown(token)
+            return
+        # Flag
+        if self.context and token in self.context.flags:
+            debug("Saw flag {!r}".format(token))
+            self.switch_to_flag(token)
+        elif self.context and token in self.context.inverse_flags:
+            debug("Saw inverse flag {!r}".format(token))
+            self.switch_to_flag(token, inverse=True)
+        # Value for current flag
+        elif self.waiting_for_flag_value:
+            debug(
+                "We're waiting for a flag value so {!r} must be it?".format(
+                    token
+                )
+            )  # noqa
+            self.see_value(token)
+        # Positional args (must come above context-name check in case we still
+        # need a posarg and the user legitimately wants to give it a value that
+        # just happens to be a valid context name.)
+        elif self.context and self.context.missing_positional_args:
+            msg = "Context {!r} requires positional args, eating {!r}"
+            debug(msg.format(self.context, token))
+            self.see_positional_arg(token)
+        # New context
+        elif token in self.contexts:
+            self.see_context(token)
+        # Initial-context flag being given as per-task flag (e.g. --help)
+        elif self.initial and token in self.initial.flags:
+            debug("Saw (initial-context) flag {!r}".format(token))
+            flag = self.initial.flags[token]
+            # Special-case for core --help flag: context name is used as value.
+            if flag.name == "help":
+                flag.value = self.context.name
+                msg = "Saw --help in a per-task context, setting task name ({!r}) as its value"  # noqa
+                debug(msg.format(flag.value))
+            # All others: just enter the 'switch to flag' parser state
+            else:
+                # TODO: handle inverse core flags too? There are none at the
+                # moment (e.g. --no-dedupe is actually 'no_dedupe', not a
+                # default-False 'dedupe') and it's up to us whether we actually
+                # put any in place.
+                self.switch_to_flag(token)
+        # Unknown
+        else:
+            if not self.ignore_unknown:
+                debug("Can't find context named {!r}, erroring".format(token))
+                self.error("No idea what {!r} is!".format(token))
+            else:
+                debug("Bottom-of-handle() see_unknown({!r})".format(token))
+                self.see_unknown(token)
+
+    def store_only(self, token: str) -> None:
+        # Start off the unparsed list
+        debug("Storing unknown token {!r}".format(token))
+        self.result.unparsed.append(token)
+
+    def complete_context(self) -> None:
+        debug(
+            "Wrapping up context {!r}".format(
+                self.context.name if self.context else self.context
+            )
+        )
+        # Ensure all of context's positional args have been given.
+        if self.context and self.context.missing_positional_args:
+            err = "'{}' did not receive required positional arguments: {}"
+            names = ", ".join(
+                "'{}'".format(x.name)
+                for x in self.context.missing_positional_args
+            )
+            self.error(err.format(self.context.name, names))
+        if self.context and self.context not in self.result:
+            self.result.append(self.context)
+
+    def switch_to_context(self, name: str) -> None:
+        self.context = copy.deepcopy(self.contexts[name])
+        debug("Moving to context {!r}".format(name))
+        debug("Context args: {!r}".format(self.context.args))
+        debug("Context flags: {!r}".format(self.context.flags))
+        debug("Context inverse_flags: {!r}".format(self.context.inverse_flags))
+
+    def complete_flag(self) -> None:
+        if self.flag:
+            msg = "Completing current flag {} before moving on"
+            debug(msg.format(self.flag))
+        # Barf if we needed a value and didn't get one
+        if (
+            self.flag
+            and self.flag.takes_value
+            and self.flag.raw_value is None
+            and not self.flag.optional
+        ):
+            err = "Flag {!r} needed value and was not given one!"
+            self.error(err.format(self.flag))
+        # Handle optional-value flags; at this point they were not given an
+        # explicit value, but they were seen, ergo they should get treated like
+        # bools.
+        if self.flag and self.flag.raw_value is None and self.flag.optional:
+            msg = "Saw optional flag {!r} go by w/ no value; setting to True"
+            debug(msg.format(self.flag.name))
+            # Skip casting so the bool gets preserved
+            self.flag.set_value(True, cast=False)
+
+    def check_ambiguity(self, value: Any) -> bool:
+        """
+        Guard against ambiguity when current flag takes an optional value.
+
+        .. versionadded:: 1.0
+        """
+        # No flag is currently being examined, or one is but it doesn't take an
+        # optional value? Ambiguity isn't possible.
+        if not (self.flag and self.flag.optional):
+            return False
+        # We *are* dealing with an optional-value flag, but it's already
+        # received a value? There can't be ambiguity here either.
+        if self.flag.raw_value is not None:
+            return False
+        # Otherwise, there *may* be ambiguity if 1 or more of the below tests
+        # fail.
+        tests = []
+        # Unfilled posargs still exist?
+        tests.append(self.context and self.context.missing_positional_args)
+        # Value matches another valid task/context name?
+        tests.append(value in self.contexts)
+        if any(tests):
+            msg = "{!r} is ambiguous when given after an optional-value flag"
+            raise ParseError(msg.format(value))
+
+    def switch_to_flag(self, flag: str, inverse: bool = False) -> None:
+        # Sanity check for ambiguity w/ prior optional-value flag
+        self.check_ambiguity(flag)
+        # Also tie it off, in case prior had optional value or etc. Seems to be
+        # harmless for other kinds of flags. (TODO: this is a serious indicator
+        # that we need to move some of this flag-by-flag bookkeeping into the
+        # state machine bits, if possible - as-is it was REAL confusing re: why
+        # this was manually required!)
+        self.complete_flag()
+        # Set flag/arg obj
+        flag = self.context.inverse_flags[flag] if inverse else flag
+        # Update state
+        try:
+            self.flag = self.context.flags[flag]
+        except KeyError as e:
+            # Try fallback to initial/core flag
+            try:
+                self.flag = self.initial.flags[flag]
+            except KeyError:
+                # If it wasn't in either, raise the original context's
+                # exception, as that's more useful / correct.
+                raise e
+        debug("Moving to flag {!r}".format(self.flag))
+        # Bookkeeping for iterable-type flags (where the typical 'value
+        # non-empty/nondefault -> clearly it got its value already' test is
+        # insufficient)
+        self.flag_got_value = False
+        # Handle boolean flags (which can immediately be updated)
+        if self.flag and not self.flag.takes_value:
+            val = not inverse
+            debug("Marking seen flag {!r} as {}".format(self.flag, val))
+            self.flag.value = val
+
+    def see_value(self, value: Any) -> None:
+        self.check_ambiguity(value)
+        if self.flag and self.flag.takes_value:
+            debug("Setting flag {!r} to value {!r}".format(self.flag, value))
+            self.flag.value = value
+            self.flag_got_value = True
+        else:
+            self.error("Flag {!r} doesn't take any value!".format(self.flag))
+
+    def see_positional_arg(self, value: Any) -> None:
+        for arg in self.context.positional_args:
+            if arg.value is None:
+                arg.value = value
+                break
+
+    def error(self, msg: str) -> None:
+        raise ParseError(msg, self.context)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/program.py b/TP03/TP03/lib/python3.9/site-packages/invoke/program.py
new file mode 100644
index 0000000000000000000000000000000000000000..c7e5cd0042f1b4018fcfac47b2171a197e5c148d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/program.py
@@ -0,0 +1,987 @@
+import getpass
+import inspect
+import json
+import os
+import sys
+import textwrap
+from importlib import import_module  # buffalo buffalo
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Dict,
+    List,
+    Optional,
+    Sequence,
+    Tuple,
+    Type,
+)
+
+from . import Collection, Config, Executor, FilesystemLoader
+from .completion.complete import complete, print_completion_script
+from .parser import Parser, ParserContext, Argument
+from .exceptions import UnexpectedExit, CollectionNotFound, ParseError, Exit
+from .terminals import pty_size
+from .util import debug, enable_logging, helpline
+
+if TYPE_CHECKING:
+    from .loader import Loader
+    from .parser import ParseResult
+    from .util import Lexicon
+
+
+class Program:
+    """
+    Manages top-level CLI invocation, typically via ``setup.py`` entrypoints.
+
+    Designed for distributing Invoke task collections as standalone programs,
+    but also used internally to implement the ``invoke`` program itself.
+
+    .. seealso::
+        :ref:`reusing-as-a-binary` for a tutorial/walkthrough of this
+        functionality.
+
+    .. versionadded:: 1.0
+    """
+
+    core: "ParseResult"
+
+    def core_args(self) -> List["Argument"]:
+        """
+        Return default core `.Argument` objects, as a list.
+
+        .. versionadded:: 1.0
+        """
+        # Arguments present always, even when wrapped as a different binary
+        return [
+            Argument(
+                names=("command-timeout", "T"),
+                kind=int,
+                help="Specify a global command execution timeout, in seconds.",
+            ),
+            Argument(
+                names=("complete",),
+                kind=bool,
+                default=False,
+                help="Print tab-completion candidates for given parse remainder.",  # noqa
+            ),
+            Argument(
+                names=("config", "f"),
+                help="Runtime configuration file to use.",
+            ),
+            Argument(
+                names=("debug", "d"),
+                kind=bool,
+                default=False,
+                help="Enable debug output.",
+            ),
+            Argument(
+                names=("dry", "R"),
+                kind=bool,
+                default=False,
+                help="Echo commands instead of running.",
+            ),
+            Argument(
+                names=("echo", "e"),
+                kind=bool,
+                default=False,
+                help="Echo executed commands before running.",
+            ),
+            Argument(
+                names=("help", "h"),
+                optional=True,
+                help="Show core or per-task help and exit.",
+            ),
+            Argument(
+                names=("hide",),
+                help="Set default value of run()'s 'hide' kwarg.",
+            ),
+            Argument(
+                names=("list", "l"),
+                optional=True,
+                help="List available tasks, optionally limited to a namespace.",  # noqa
+            ),
+            Argument(
+                names=("list-depth", "D"),
+                kind=int,
+                default=0,
+                help="When listing tasks, only show the first INT levels.",
+            ),
+            Argument(
+                names=("list-format", "F"),
+                help="Change the display format used when listing tasks. Should be one of: flat (default), nested, json.",  # noqa
+                default="flat",
+            ),
+            Argument(
+                names=("print-completion-script",),
+                kind=str,
+                default="",
+                help="Print the tab-completion script for your preferred shell (bash|zsh|fish).",  # noqa
+            ),
+            Argument(
+                names=("prompt-for-sudo-password",),
+                kind=bool,
+                default=False,
+                help="Prompt user at start of session for the sudo.password config value.",  # noqa
+            ),
+            Argument(
+                names=("pty", "p"),
+                kind=bool,
+                default=False,
+                help="Use a pty when executing shell commands.",
+            ),
+            Argument(
+                names=("version", "V"),
+                kind=bool,
+                default=False,
+                help="Show version and exit.",
+            ),
+            Argument(
+                names=("warn-only", "w"),
+                kind=bool,
+                default=False,
+                help="Warn, instead of failing, when shell commands fail.",
+            ),
+            Argument(
+                names=("write-pyc",),
+                kind=bool,
+                default=False,
+                help="Enable creation of .pyc files.",
+            ),
+        ]
+
+    def task_args(self) -> List["Argument"]:
+        """
+        Return default task-related `.Argument` objects, as a list.
+
+        These are only added to the core args in "task runner" mode (the
+        default for ``invoke`` itself) - they are omitted when the constructor
+        is given a non-empty ``namespace`` argument ("bundled namespace" mode).
+
+        .. versionadded:: 1.0
+        """
+        # Arguments pertaining specifically to invocation as 'invoke' itself
+        # (or as other arbitrary-task-executing programs, like 'fab')
+        return [
+            Argument(
+                names=("collection", "c"),
+                help="Specify collection name to load.",
+            ),
+            Argument(
+                names=("no-dedupe",),
+                kind=bool,
+                default=False,
+                help="Disable task deduplication.",
+            ),
+            Argument(
+                names=("search-root", "r"),
+                help="Change root directory used for finding task modules.",
+            ),
+        ]
+
+    argv: List[str]
+    # Other class-level global variables a subclass might override sometime
+    # maybe?
+    leading_indent_width = 2
+    leading_indent = " " * leading_indent_width
+    indent_width = 4
+    indent = " " * indent_width
+    col_padding = 3
+
+    def __init__(
+        self,
+        version: Optional[str] = None,
+        namespace: Optional["Collection"] = None,
+        name: Optional[str] = None,
+        binary: Optional[str] = None,
+        loader_class: Optional[Type["Loader"]] = None,
+        executor_class: Optional[Type["Executor"]] = None,
+        config_class: Optional[Type["Config"]] = None,
+        binary_names: Optional[List[str]] = None,
+    ) -> None:
+        """
+        Create a new, parameterized `.Program` instance.
+
+        :param str version:
+            The program's version, e.g. ``"0.1.0"``. Defaults to ``"unknown"``.
+
+        :param namespace:
+            A `.Collection` to use as this program's subcommands.
+
+            If ``None`` (the default), the program will behave like ``invoke``,
+            seeking a nearby task namespace with a `.Loader` and exposing
+            arguments such as :option:`--list` and :option:`--collection` for
+            inspecting or selecting specific namespaces.
+
+            If given a `.Collection` object, will use it as if it had been
+            handed to :option:`--collection`. Will also update the parser to
+            remove references to tasks and task-related options, and display
+            the subcommands in ``--help`` output. The result will be a program
+            that has a static set of subcommands.
+
+        :param str name:
+            The program's name, as displayed in ``--version`` output.
+
+            If ``None`` (default), is a capitalized version of the first word
+            in the ``argv`` handed to `.run`. For example, when invoked from a
+            binstub installed as ``foobar``, it will default to ``Foobar``.
+
+        :param str binary:
+            Descriptive lowercase binary name string used in help text.
+
+            For example, Invoke's own internal value for this is ``inv[oke]``,
+            denoting that it is installed as both ``inv`` and ``invoke``. As
+            this is purely text intended for help display, it may be in any
+            format you wish, though it should match whatever you've put into
+            your ``setup.py``'s ``console_scripts`` entry.
+
+            If ``None`` (default), uses the first word in ``argv`` verbatim (as
+            with ``name`` above, except not capitalized).
+
+        :param binary_names:
+            List of binary name strings, for use in completion scripts.
+
+            This list ensures that the shell completion scripts generated by
+            :option:`--print-completion-script` instruct the shell to use
+            that completion for all of this program's installed names.
+
+            For example, Invoke's internal default for this is ``["inv",
+            "invoke"]``.
+
+            If ``None`` (the default), the first word in ``argv`` (in the
+            invocation of :option:`--print-completion-script`) is used in a
+            single-item list.
+
+        :param loader_class:
+            The `.Loader` subclass to use when loading task collections.
+
+            Defaults to `.FilesystemLoader`.
+
+        :param executor_class:
+            The `.Executor` subclass to use when executing tasks.
+
+            Defaults to `.Executor`; may also be overridden at runtime by the
+            :ref:`configuration system <default-values>` and its
+            ``tasks.executor_class`` setting (anytime that setting is not
+            ``None``).
+
+        :param config_class:
+            The `.Config` subclass to use for the base config object.
+
+            Defaults to `.Config`.
+
+        .. versionchanged:: 1.2
+            Added the ``binary_names`` argument.
+        """
+        self.version = "unknown" if version is None else version
+        self.namespace = namespace
+        self._name = name
+        # TODO 3.0: rename binary to binary_help_name or similar. (Or write
+        # code to autogenerate it from binary_names.)
+        self._binary = binary
+        self._binary_names = binary_names
+        self.argv = []
+        self.loader_class = loader_class or FilesystemLoader
+        self.executor_class = executor_class or Executor
+        self.config_class = config_class or Config
+
+    def create_config(self) -> None:
+        """
+        Instantiate a `.Config` (or subclass, depending) for use in task exec.
+
+        This Config is fully usable but will lack runtime-derived data like
+        project & runtime config files, CLI arg overrides, etc. That data is
+        added later in `update_config`. See `.Config` docstring for lifecycle
+        details.
+
+        :returns: ``None``; sets ``self.config`` instead.
+
+        .. versionadded:: 1.0
+        """
+        self.config = self.config_class()
+
+    def update_config(self, merge: bool = True) -> None:
+        """
+        Update the previously instantiated `.Config` with parsed data.
+
+        For example, this is how ``--echo`` is able to override the default
+        config value for ``run.echo``.
+
+        :param bool merge:
+            Whether to merge at the end, or defer. Primarily useful for
+            subclassers. Default: ``True``.
+
+        .. versionadded:: 1.0
+        """
+        # Now that we have parse results handy, we can grab the remaining
+        # config bits:
+        # - runtime config, as it is dependent on the runtime flag/env var
+        # - the overrides config level, as it is composed of runtime flag data
+        # NOTE: only fill in values that would alter behavior, otherwise we
+        # want the defaults to come through.
+        run = {}
+        if self.args["warn-only"].value:
+            run["warn"] = True
+        if self.args.pty.value:
+            run["pty"] = True
+        if self.args.hide.value:
+            run["hide"] = self.args.hide.value
+        if self.args.echo.value:
+            run["echo"] = True
+        if self.args.dry.value:
+            run["dry"] = True
+        tasks = {}
+        if "no-dedupe" in self.args and self.args["no-dedupe"].value:
+            tasks["dedupe"] = False
+        timeouts = {}
+        command = self.args["command-timeout"].value
+        if command:
+            timeouts["command"] = command
+        # Handle "fill in config values at start of runtime", which for now is
+        # just sudo password
+        sudo = {}
+        if self.args["prompt-for-sudo-password"].value:
+            prompt = "Desired 'sudo.password' config value: "
+            sudo["password"] = getpass.getpass(prompt)
+        overrides = dict(run=run, tasks=tasks, sudo=sudo, timeouts=timeouts)
+        self.config.load_overrides(overrides, merge=False)
+        runtime_path = self.args.config.value
+        if runtime_path is None:
+            runtime_path = os.environ.get("INVOKE_RUNTIME_CONFIG", None)
+        self.config.set_runtime_path(runtime_path)
+        self.config.load_runtime(merge=False)
+        if merge:
+            self.config.merge()
+
+    def run(self, argv: Optional[List[str]] = None, exit: bool = True) -> None:
+        """
+        Execute main CLI logic, based on ``argv``.
+
+        :param argv:
+            The arguments to execute against. May be ``None``, a list of
+            strings, or a string. See `.normalize_argv` for details.
+
+        :param bool exit:
+            When ``False`` (default: ``True``), will ignore `.ParseError`,
+            `.Exit` and `.Failure` exceptions, which otherwise trigger calls to
+            `sys.exit`.
+
+            .. note::
+                This is mostly a concession to testing. If you're setting this
+                to ``False`` in a production setting, you should probably be
+                using `.Executor` and friends directly instead!
+
+        .. versionadded:: 1.0
+        """
+        try:
+            # Create an initial config, which will hold defaults & values from
+            # most config file locations (all but runtime.) Used to inform
+            # loading & parsing behavior.
+            self.create_config()
+            # Parse the given ARGV with our CLI parsing machinery, resulting in
+            # things like self.args (core args/flags), self.collection (the
+            # loaded namespace, which may be affected by the core flags) and
+            # self.tasks (the tasks requested for exec and their own
+            # args/flags)
+            self.parse_core(argv)
+            # Handle collection concerns including project config
+            self.parse_collection()
+            # Parse remainder of argv as task-related input
+            self.parse_tasks()
+            # End of parsing (typically bailout stuff like --list, --help)
+            self.parse_cleanup()
+            # Update the earlier Config with new values from the parse step -
+            # runtime config file contents and flag-derived overrides (e.g. for
+            # run()'s echo, warn, etc options.)
+            self.update_config()
+            # Create an Executor, passing in the data resulting from the prior
+            # steps, then tell it to execute the tasks.
+            self.execute()
+        except (UnexpectedExit, Exit, ParseError) as e:
+            debug("Received a possibly-skippable exception: {!r}".format(e))
+            # Print error messages from parser, runner, etc if necessary;
+            # prevents messy traceback but still clues interactive user into
+            # problems.
+            if isinstance(e, ParseError):
+                print(e, file=sys.stderr)
+            if isinstance(e, Exit) and e.message:
+                print(e.message, file=sys.stderr)
+            if isinstance(e, UnexpectedExit) and e.result.hide:
+                print(e, file=sys.stderr, end="")
+            # Terminate execution unless we were told not to.
+            if exit:
+                if isinstance(e, UnexpectedExit):
+                    code = e.result.exited
+                elif isinstance(e, Exit):
+                    code = e.code
+                elif isinstance(e, ParseError):
+                    code = 1
+                sys.exit(code)
+            else:
+                debug("Invoked as run(..., exit=False), ignoring exception")
+        except KeyboardInterrupt:
+            sys.exit(1)  # Same behavior as Python itself outside of REPL
+
+    def parse_core(self, argv: Optional[List[str]]) -> None:
+        debug("argv given to Program.run: {!r}".format(argv))
+        self.normalize_argv(argv)
+
+        # Obtain core args (sets self.core)
+        self.parse_core_args()
+        debug("Finished parsing core args")
+
+        # Set interpreter bytecode-writing flag
+        sys.dont_write_bytecode = not self.args["write-pyc"].value
+
+        # Enable debugging from here on out, if debug flag was given.
+        # (Prior to this point, debugging requires setting INVOKE_DEBUG).
+        if self.args.debug.value:
+            enable_logging()
+
+        # Short-circuit if --version
+        if self.args.version.value:
+            debug("Saw --version, printing version & exiting")
+            self.print_version()
+            raise Exit
+
+        # Print (dynamic, no tasks required) completion script if requested
+        if self.args["print-completion-script"].value:
+            print_completion_script(
+                shell=self.args["print-completion-script"].value,
+                names=self.binary_names,
+            )
+            raise Exit
+
+    def parse_collection(self) -> None:
+        """
+        Load a tasks collection & project-level config.
+
+        .. versionadded:: 1.0
+        """
+        # Load a collection of tasks unless one was already set.
+        if self.namespace is not None:
+            debug(
+                "Program was given default namespace, not loading collection"
+            )
+            self.collection = self.namespace
+        else:
+            debug(
+                "No default namespace provided, trying to load one from disk"
+            )  # noqa
+            # If no bundled namespace & --help was given, just print it and
+            # exit. (If we did have a bundled namespace, core --help will be
+            # handled *after* the collection is loaded & parsing is done.)
+            if self.args.help.value is True:
+                debug(
+                    "No bundled namespace & bare --help given; printing help."
+                )
+                self.print_help()
+                raise Exit
+            self.load_collection()
+        # Set these up for potential use later when listing tasks
+        # TODO: be nice if these came from the config...! Users would love to
+        # say they default to nested for example. Easy 2.x feature-add.
+        self.list_root: Optional[str] = None
+        self.list_depth: Optional[int] = None
+        self.list_format = "flat"
+        self.scoped_collection = self.collection
+
+        # TODO: load project conf, if possible, gracefully
+
+    def parse_cleanup(self) -> None:
+        """
+        Post-parsing, pre-execution steps such as --help, --list, etc.
+
+        .. versionadded:: 1.0
+        """
+        halp = self.args.help.value
+
+        # Core (no value given) --help output (only when bundled namespace)
+        if halp is True:
+            debug("Saw bare --help, printing help & exiting")
+            self.print_help()
+            raise Exit
+
+        # Print per-task help, if necessary
+        if halp:
+            if halp in self.parser.contexts:
+                msg = "Saw --help <taskname>, printing per-task help & exiting"
+                debug(msg)
+                self.print_task_help(halp)
+                raise Exit
+            else:
+                # TODO: feels real dumb to factor this out of Parser, but...we
+                # should?
+                raise ParseError("No idea what '{}' is!".format(halp))
+
+        # Print discovered tasks if necessary
+        list_root = self.args.list.value  # will be True or string
+        self.list_format = self.args["list-format"].value
+        self.list_depth = self.args["list-depth"].value
+        if list_root:
+            # Not just --list, but --list some-root - do moar work
+            if isinstance(list_root, str):
+                self.list_root = list_root
+                try:
+                    sub = self.collection.subcollection_from_path(list_root)
+                    self.scoped_collection = sub
+                except KeyError:
+                    msg = "Sub-collection '{}' not found!"
+                    raise Exit(msg.format(list_root))
+            self.list_tasks()
+            raise Exit
+
+        # Print completion helpers if necessary
+        if self.args.complete.value:
+            complete(
+                names=self.binary_names,
+                core=self.core,
+                initial_context=self.initial_context,
+                collection=self.collection,
+                # NOTE: can't reuse self.parser as it has likely been mutated
+                # between when it was set and now.
+                parser=self._make_parser(),
+            )
+
+        # Fallback behavior if no tasks were given & no default specified
+        # (mostly a subroutine for overriding purposes)
+        # NOTE: when there is a default task, Executor will select it when no
+        # tasks were found in CLI parsing.
+        if not self.tasks and not self.collection.default:
+            self.no_tasks_given()
+
+    def no_tasks_given(self) -> None:
+        debug(
+            "No tasks specified for execution and no default task; printing global help as fallback"  # noqa
+        )
+        self.print_help()
+        raise Exit
+
+    def execute(self) -> None:
+        """
+        Hand off data & tasks-to-execute specification to an `.Executor`.
+
+        .. note::
+            Client code just wanting a different `.Executor` subclass can just
+            set ``executor_class`` in `.__init__`, or override
+            ``tasks.executor_class`` anywhere in the :ref:`config system
+            <default-values>` (which may allow you to avoid using a custom
+            Program entirely).
+
+        .. versionadded:: 1.0
+        """
+        klass = self.executor_class
+        config_path = self.config.tasks.executor_class
+        if config_path is not None:
+            # TODO: why the heck is this not builtin to importlib?
+            module_path, _, class_name = config_path.rpartition(".")
+            # TODO: worth trying to wrap both of these and raising ImportError
+            # for cases where module exists but class name does not? More
+            # "normal" but also its own possible source of bugs/confusion...
+            module = import_module(module_path)
+            klass = getattr(module, class_name)
+        executor = klass(self.collection, self.config, self.core)
+        executor.execute(*self.tasks)
+
+    def normalize_argv(self, argv: Optional[List[str]]) -> None:
+        """
+        Massages ``argv`` into a useful list of strings.
+
+        **If None** (the default), uses `sys.argv`.
+
+        **If a non-string iterable**, uses that in place of `sys.argv`.
+
+        **If a string**, performs a `str.split` and then executes with the
+        result. (This is mostly a convenience; when in doubt, use a list.)
+
+        Sets ``self.argv`` to the result.
+
+        .. versionadded:: 1.0
+        """
+        if argv is None:
+            argv = sys.argv
+            debug("argv was None; using sys.argv: {!r}".format(argv))
+        elif isinstance(argv, str):
+            argv = argv.split()
+            debug("argv was string-like; splitting: {!r}".format(argv))
+        self.argv = argv
+
+    @property
+    def name(self) -> str:
+        """
+        Derive program's human-readable name based on `.binary`.
+
+        .. versionadded:: 1.0
+        """
+        return self._name or self.binary.capitalize()
+
+    @property
+    def called_as(self) -> str:
+        """
+        Returns the program name we were actually called as.
+
+        Specifically, this is the (Python's os module's concept of a) basename
+        of the first argument in the parsed argument vector.
+
+        .. versionadded:: 1.2
+        """
+        # XXX: defaults to empty string if 'argv' is '[]' or 'None'
+        return os.path.basename(self.argv[0]) if self.argv else ""
+
+    @property
+    def binary(self) -> str:
+        """
+        Derive program's help-oriented binary name(s) from init args & argv.
+
+        .. versionadded:: 1.0
+        """
+        return self._binary or self.called_as
+
+    @property
+    def binary_names(self) -> List[str]:
+        """
+        Derive program's completion-oriented binary name(s) from args & argv.
+
+        .. versionadded:: 1.2
+        """
+        return self._binary_names or [self.called_as]
+
+    # TODO 3.0: ugh rename this or core_args, they are too confusing
+    @property
+    def args(self) -> "Lexicon":
+        """
+        Obtain core program args from ``self.core`` parse result.
+
+        .. versionadded:: 1.0
+        """
+        return self.core[0].args
+
+    @property
+    def initial_context(self) -> ParserContext:
+        """
+        The initial parser context, aka core program flags.
+
+        The specific arguments contained therein will differ depending on
+        whether a bundled namespace was specified in `.__init__`.
+
+        .. versionadded:: 1.0
+        """
+        args = self.core_args()
+        if self.namespace is None:
+            args += self.task_args()
+        return ParserContext(args=args)
+
+    def print_version(self) -> None:
+        print("{} {}".format(self.name, self.version or "unknown"))
+
+    def print_help(self) -> None:
+        usage_suffix = "task1 [--task1-opts] ... taskN [--taskN-opts]"
+        if self.namespace is not None:
+            usage_suffix = "<subcommand> [--subcommand-opts] ..."
+        print("Usage: {} [--core-opts] {}".format(self.binary, usage_suffix))
+        print("")
+        print("Core options:")
+        print("")
+        self.print_columns(self.initial_context.help_tuples())
+        if self.namespace is not None:
+            self.list_tasks()
+
+    def parse_core_args(self) -> None:
+        """
+        Filter out core args, leaving any tasks or their args for later.
+
+        Sets ``self.core`` to the `.ParseResult` from this step.
+
+        .. versionadded:: 1.0
+        """
+        debug("Parsing initial context (core args)")
+        parser = Parser(initial=self.initial_context, ignore_unknown=True)
+        self.core = parser.parse_argv(self.argv[1:])
+        msg = "Core-args parse result: {!r} & unparsed: {!r}"
+        debug(msg.format(self.core, self.core.unparsed))
+
+    def load_collection(self) -> None:
+        """
+        Load a task collection based on parsed core args, or die trying.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: start, coll_name both fall back to configuration values within
+        # Loader (which may, however, get them from our config.)
+        start = self.args["search-root"].value
+        loader = self.loader_class(  # type: ignore
+            config=self.config, start=start
+        )
+        coll_name = self.args.collection.value
+        try:
+            module, parent = loader.load(coll_name)
+            # This is the earliest we can load project config, so we should -
+            # allows project config to affect the task parsing step!
+            # TODO: is it worth merging these set- and load- methods? May
+            # require more tweaking of how things behave in/after __init__.
+            self.config.set_project_location(parent)
+            self.config.load_project()
+            self.collection = Collection.from_module(
+                module,
+                loaded_from=parent,
+                auto_dash_names=self.config.tasks.auto_dash_names,
+            )
+        except CollectionNotFound as e:
+            raise Exit("Can't find any collection named {!r}!".format(e.name))
+
+    def _update_core_context(
+        self, context: ParserContext, new_args: Dict[str, Any]
+    ) -> None:
+        # Update core context w/ core_via_task args, if and only if the
+        # via-task version of the arg was truly given a value.
+        # TODO: push this into an Argument-aware Lexicon subclass and
+        # .update()?
+        for key, arg in new_args.items():
+            if arg.got_value:
+                context.args[key]._value = arg._value
+
+    def _make_parser(self) -> Parser:
+        return Parser(
+            initial=self.initial_context,
+            contexts=self.collection.to_contexts(
+                ignore_unknown_help=self.config.tasks.ignore_unknown_help
+            ),
+        )
+
+    def parse_tasks(self) -> None:
+        """
+        Parse leftover args, which are typically tasks & per-task args.
+
+        Sets ``self.parser`` to the parser used, ``self.tasks`` to the
+        parsed per-task contexts, and ``self.core_via_tasks`` to a context
+        holding any core flags seen within the task contexts.
+
+        Also modifies ``self.core`` to include the data from ``core_via_tasks``
+        (so that it correctly reflects any supplied core flags regardless of
+        where they appeared).
+
+        .. versionadded:: 1.0
+        """
+        self.parser = self._make_parser()
+        debug("Parsing tasks against {!r}".format(self.collection))
+        result = self.parser.parse_argv(self.core.unparsed)
+        self.core_via_tasks = result.pop(0)
+        self._update_core_context(
+            context=self.core[0], new_args=self.core_via_tasks.args
+        )
+        self.tasks = result
+        debug("Resulting task contexts: {!r}".format(self.tasks))
+
+    def print_task_help(self, name: str) -> None:
+        """
+        Print help for a specific task, e.g. ``inv --help <taskname>``.
+
+        .. versionadded:: 1.0
+        """
+        # Setup
+        ctx = self.parser.contexts[name]
+        tuples = ctx.help_tuples()
+        docstring = inspect.getdoc(self.collection[name])
+        header = "Usage: {} [--core-opts] {} {}[other tasks here ...]"
+        opts = "[--options] " if tuples else ""
+        print(header.format(self.binary, name, opts))
+        print("")
+        print("Docstring:")
+        if docstring:
+            # Really wish textwrap worked better for this.
+            for line in docstring.splitlines():
+                if line.strip():
+                    print(self.leading_indent + line)
+                else:
+                    print("")
+            print("")
+        else:
+            print(self.leading_indent + "none")
+            print("")
+        print("Options:")
+        if tuples:
+            self.print_columns(tuples)
+        else:
+            print(self.leading_indent + "none")
+            print("")
+
+    def list_tasks(self) -> None:
+        # Short circuit if no tasks to show (Collection now implements bool)
+        focus = self.scoped_collection
+        if not focus:
+            msg = "No tasks found in collection '{}'!"
+            raise Exit(msg.format(focus.name))
+        # TODO: now that flat/nested are almost 100% unified, maybe rethink
+        # this a bit?
+        getattr(self, "list_{}".format(self.list_format))()
+
+    def list_flat(self) -> None:
+        pairs = self._make_pairs(self.scoped_collection)
+        self.display_with_columns(pairs=pairs)
+
+    def list_nested(self) -> None:
+        pairs = self._make_pairs(self.scoped_collection)
+        extra = "'*' denotes collection defaults"
+        self.display_with_columns(pairs=pairs, extra=extra)
+
+    def _make_pairs(
+        self,
+        coll: "Collection",
+        ancestors: Optional[List[str]] = None,
+    ) -> List[Tuple[str, Optional[str]]]:
+        if ancestors is None:
+            ancestors = []
+        pairs = []
+        indent = len(ancestors) * self.indent
+        ancestor_path = ".".join(x for x in ancestors)
+        for name, task in sorted(coll.tasks.items()):
+            is_default = name == coll.default
+            # Start with just the name and just the aliases, no prefixes or
+            # dots.
+            displayname = name
+            aliases = list(map(coll.transform, sorted(task.aliases)))
+            # If displaying a sub-collection (or if we are displaying a given
+            # namespace/root), tack on some dots to make it clear these names
+            # require dotted paths to invoke.
+            if ancestors or self.list_root:
+                displayname = ".{}".format(displayname)
+                aliases = [".{}".format(x) for x in aliases]
+            # Nested? Indent, and add asterisks to default-tasks.
+            if self.list_format == "nested":
+                prefix = indent
+                if is_default:
+                    displayname += "*"
+            # Flat? Prefix names and aliases with ancestor names to get full
+            # dotted path; and give default-tasks their collection name as the
+            # first alias.
+            if self.list_format == "flat":
+                prefix = ancestor_path
+                # Make sure leading dots are present for subcollections if
+                # scoped display
+                if prefix and self.list_root:
+                    prefix = "." + prefix
+                aliases = [prefix + alias for alias in aliases]
+                if is_default and ancestors:
+                    aliases.insert(0, prefix)
+            # Generate full name and help columns and add to pairs.
+            alias_str = " ({})".format(", ".join(aliases)) if aliases else ""
+            full = prefix + displayname + alias_str
+            pairs.append((full, helpline(task)))
+        # Determine whether we're at max-depth or not
+        truncate = self.list_depth and (len(ancestors) + 1) >= self.list_depth
+        for name, subcoll in sorted(coll.collections.items()):
+            displayname = name
+            if ancestors or self.list_root:
+                displayname = ".{}".format(displayname)
+            if truncate:
+                tallies = [
+                    "{} {}".format(len(getattr(subcoll, attr)), attr)
+                    for attr in ("tasks", "collections")
+                    if getattr(subcoll, attr)
+                ]
+                displayname += " [{}]".format(", ".join(tallies))
+            if self.list_format == "nested":
+                pairs.append((indent + displayname, helpline(subcoll)))
+            elif self.list_format == "flat" and truncate:
+                # NOTE: only adding coll-oriented pair if limiting by depth
+                pairs.append((ancestor_path + displayname, helpline(subcoll)))
+            # Recurse, if not already at max depth
+            if not truncate:
+                recursed_pairs = self._make_pairs(
+                    coll=subcoll, ancestors=ancestors + [name]
+                )
+                pairs.extend(recursed_pairs)
+        return pairs
+
+    def list_json(self) -> None:
+        # Sanity: we can't cleanly honor the --list-depth argument without
+        # changing the data schema or otherwise acting strangely; and it also
+        # doesn't make a ton of sense to limit depth when the output is for a
+        # script to handle. So we just refuse, for now. TODO: find better way
+        if self.list_depth:
+            raise Exit(
+                "The --list-depth option is not supported with JSON format!"
+            )  # noqa
+        # TODO: consider using something more formal re: the format this emits,
+        # eg json-schema or whatever. Would simplify the
+        # relatively-concise-but-only-human docs that currently describe this.
+        coll = self.scoped_collection
+        data = coll.serialized()
+        print(json.dumps(data))
+
+    def task_list_opener(self, extra: str = "") -> str:
+        root = self.list_root
+        depth = self.list_depth
+        specifier = " '{}'".format(root) if root else ""
+        tail = ""
+        if depth or extra:
+            depthstr = "depth={}".format(depth) if depth else ""
+            joiner = "; " if (depth and extra) else ""
+            tail = " ({}{}{})".format(depthstr, joiner, extra)
+        text = "Available{} tasks{}".format(specifier, tail)
+        # TODO: do use cases w/ bundled namespace want to display things like
+        # root and depth too? Leaving off for now...
+        if self.namespace is not None:
+            text = "Subcommands"
+        return text
+
+    def display_with_columns(
+        self, pairs: Sequence[Tuple[str, Optional[str]]], extra: str = ""
+    ) -> None:
+        root = self.list_root
+        print("{}:\n".format(self.task_list_opener(extra=extra)))
+        self.print_columns(pairs)
+        # TODO: worth stripping this out for nested? since it's signified with
+        # asterisk there? ugggh
+        default = self.scoped_collection.default
+        if default:
+            specific = ""
+            if root:
+                specific = " '{}'".format(root)
+                default = ".{}".format(default)
+            # TODO: trim/prefix dots
+            print("Default{} task: {}\n".format(specific, default))
+
+    def print_columns(
+        self, tuples: Sequence[Tuple[str, Optional[str]]]
+    ) -> None:
+        """
+        Print tabbed columns from (name, help) ``tuples``.
+
+        Useful for listing tasks + docstrings, flags + help strings, etc.
+
+        .. versionadded:: 1.0
+        """
+        # Calculate column sizes: don't wrap flag specs, give what's left over
+        # to the descriptions.
+        name_width = max(len(x[0]) for x in tuples)
+        desc_width = (
+            pty_size()[0]
+            - name_width
+            - self.leading_indent_width
+            - self.col_padding
+            - 1
+        )
+        wrapper = textwrap.TextWrapper(width=desc_width)
+        for name, help_str in tuples:
+            if help_str is None:
+                help_str = ""
+            # Wrap descriptions/help text
+            help_chunks = wrapper.wrap(help_str)
+            # Print flag spec + padding
+            name_padding = name_width - len(name)
+            spec = "".join(
+                (
+                    self.leading_indent,
+                    name,
+                    name_padding * " ",
+                    self.col_padding * " ",
+                )
+            )
+            # Print help text as needed
+            if help_chunks:
+                print(spec + help_chunks[0])
+                for chunk in help_chunks[1:]:
+                    print((" " * len(spec)) + chunk)
+            else:
+                print(spec.rstrip())
+        print("")
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/py.typed b/TP03/TP03/lib/python3.9/site-packages/invoke/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/runners.py b/TP03/TP03/lib/python3.9/site-packages/invoke/runners.py
new file mode 100644
index 0000000000000000000000000000000000000000..f1c888f44f82b8b826656e6787583374f78f122c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/runners.py
@@ -0,0 +1,1675 @@
+import errno
+import locale
+import os
+import struct
+import sys
+import threading
+import time
+import signal
+from subprocess import Popen, PIPE
+from types import TracebackType
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    Dict,
+    Generator,
+    IO,
+    List,
+    Optional,
+    Tuple,
+    Type,
+)
+
+# Import some platform-specific things at top level so they can be mocked for
+# tests.
+try:
+    import pty
+except ImportError:
+    pty = None  # type: ignore[assignment]
+try:
+    import fcntl
+except ImportError:
+    fcntl = None  # type: ignore[assignment]
+try:
+    import termios
+except ImportError:
+    termios = None  # type: ignore[assignment]
+
+from .exceptions import (
+    UnexpectedExit,
+    Failure,
+    ThreadException,
+    WatcherError,
+    SubprocessPipeError,
+    CommandTimedOut,
+)
+from .terminals import (
+    WINDOWS,
+    pty_size,
+    character_buffered,
+    ready_for_reading,
+    bytes_to_read,
+)
+from .util import has_fileno, isatty, ExceptionHandlingThread
+
+if TYPE_CHECKING:
+    from .context import Context
+    from .watchers import StreamWatcher
+
+
+class Runner:
+    """
+    Partially-abstract core command-running API.
+
+    This class is not usable by itself and must be subclassed, implementing a
+    number of methods such as `start`, `wait` and `returncode`. For a subclass
+    implementation example, see the source code for `.Local`.
+
+    .. versionadded:: 1.0
+    """
+
+    opts: Dict[str, Any]
+    using_pty: bool
+    read_chunk_size = 1000
+    input_sleep = 0.01
+
+    def __init__(self, context: "Context") -> None:
+        """
+        Create a new runner with a handle on some `.Context`.
+
+        :param context:
+            a `.Context` instance, used to transmit default options and provide
+            access to other contextualized information (e.g. a remote-oriented
+            `.Runner` might want a `.Context` subclass holding info about
+            hostnames and ports.)
+
+            .. note::
+                The `.Context` given to `.Runner` instances **must** contain
+                default config values for the `.Runner` class in question. At a
+                minimum, this means values for each of the default
+                `.Runner.run` keyword arguments such as ``echo`` and ``warn``.
+
+        :raises exceptions.ValueError:
+            if not all expected default values are found in ``context``.
+        """
+        #: The `.Context` given to the same-named argument of `__init__`.
+        self.context = context
+        #: A `threading.Event` signaling program completion.
+        #:
+        #: Typically set after `wait` returns. Some IO mechanisms rely on this
+        #: to know when to exit an infinite read loop.
+        self.program_finished = threading.Event()
+        # I wish Sphinx would organize all class/instance attrs in the same
+        # place. If I don't do this here, it goes 'class vars -> __init__
+        # docstring -> instance vars' :( TODO: consider just merging class and
+        # __init__ docstrings, though that's annoying too.
+        #: How many bytes (at maximum) to read per iteration of stream reads.
+        self.read_chunk_size = self.__class__.read_chunk_size
+        # Ditto re: declaring this in 2 places for doc reasons.
+        #: How many seconds to sleep on each iteration of the stdin read loop
+        #: and other otherwise-fast loops.
+        self.input_sleep = self.__class__.input_sleep
+        #: Whether pty fallback warning has been emitted.
+        self.warned_about_pty_fallback = False
+        #: A list of `.StreamWatcher` instances for use by `respond`. Is filled
+        #: in at runtime by `run`.
+        self.watchers: List["StreamWatcher"] = []
+        # Optional timeout timer placeholder
+        self._timer: Optional[threading.Timer] = None
+        # Async flags (initialized for 'finally' referencing in case something
+        # goes REAL bad during options parsing)
+        self._asynchronous = False
+        self._disowned = False
+
+    def run(self, command: str, **kwargs: Any) -> Optional["Result"]:
+        """
+        Execute ``command``, returning an instance of `Result` once complete.
+
+        By default, this method is synchronous (it only returns once the
+        subprocess has completed), and allows interactive keyboard
+        communication with the subprocess.
+
+        It can instead behave asynchronously (returning early & requiring
+        interaction with the resulting object to manage subprocess lifecycle)
+        if you specify ``asynchronous=True``. Furthermore, you can completely
+        disassociate the subprocess from Invoke's control (allowing it to
+        persist on its own after Python exits) by saying ``disown=True``. See
+        the per-kwarg docs below for details on both of these.
+
+        .. note::
+            All kwargs will default to the values found in this instance's
+            `~.Runner.context` attribute, specifically in its configuration's
+            ``run`` subtree (e.g. ``run.echo`` provides the default value for
+            the ``echo`` keyword, etc). The base default values are described
+            in the parameter list below.
+
+        :param str command: The shell command to execute.
+
+        :param bool asynchronous:
+            When set to ``True`` (default ``False``), enables asynchronous
+            behavior, as follows:
+
+            - Connections to the controlling terminal are disabled, meaning you
+              will not see the subprocess output and it will not respond to
+              your keyboard input - similar to ``hide=True`` and
+              ``in_stream=False`` (though explicitly given
+              ``(out|err|in)_stream`` file-like objects will still be honored
+              as normal).
+            - `.run` returns immediately after starting the subprocess, and its
+              return value becomes an instance of `Promise` instead of
+              `Result`.
+            - `Promise` objects are primarily useful for their `~Promise.join`
+              method, which blocks until the subprocess exits (similar to
+              threading APIs) and either returns a final `~Result` or raises an
+              exception, just as a synchronous ``run`` would.
+
+                - As with threading and similar APIs, users of
+                  ``asynchronous=True`` should make sure to ``join`` their
+                  `Promise` objects to prevent issues with interpreter
+                  shutdown.
+                - One easy way to handle such cleanup is to use the `Promise`
+                  as a context manager - it will automatically ``join`` at the
+                  exit of the context block.
+
+            .. versionadded:: 1.4
+
+        :param bool disown:
+            When set to ``True`` (default ``False``), returns immediately like
+            ``asynchronous=True``, but does not perform any background work
+            related to that subprocess (it is completely ignored). This allows
+            subprocesses using shell backgrounding or similar techniques (e.g.
+            trailing ``&``, ``nohup``) to persist beyond the lifetime of the
+            Python process running Invoke.
+
+            .. note::
+                If you're unsure whether you want this or ``asynchronous``, you
+                probably want ``asynchronous``!
+
+            Specifically, ``disown=True`` has the following behaviors:
+
+            - The return value is ``None`` instead of a `Result` or subclass.
+            - No I/O worker threads are spun up, so you will have no access to
+              the subprocess' stdout/stderr, your stdin will not be forwarded,
+              ``(out|err|in)_stream`` will be ignored, and features like
+              ``watchers`` will not function.
+            - No exit code is checked for, so you will not receive any errors
+              if the subprocess fails to exit cleanly.
+            - ``pty=True`` may not function correctly (subprocesses may not run
+              at all; this seems to be a potential bug in Python's
+              ``pty.fork``) unless your command line includes tools such as
+              ``nohup`` or (the shell builtin) ``disown``.
+
+            .. versionadded:: 1.4
+
+        :param bool dry:
+            Whether to dry-run instead of truly invoking the given command. See
+            :option:`--dry` (which flips this on globally) for details on this
+            behavior.
+
+            .. versionadded:: 1.3
+
+        :param bool echo:
+            Controls whether `.run` prints the command string to local stdout
+            prior to executing it. Default: ``False``.
+
+            .. note::
+                ``hide=True`` will override ``echo=True`` if both are given.
+
+        :param echo_format:
+            A string, which when passed to Python's inbuilt ``.format`` method,
+            will change the format of the output when ``run.echo`` is set to
+            true.
+
+            Currently, only ``{command}`` is supported as a parameter.
+
+            Defaults to printing the full command string in ANSI-escaped bold.
+
+        :param bool echo_stdin:
+            Whether to write data from ``in_stream`` back to ``out_stream``.
+
+            In other words, in normal interactive usage, this parameter
+            controls whether Invoke mirrors what you type back to your
+            terminal.
+
+            By default (when ``None``), this behavior is triggered by the
+            following:
+
+                * Not using a pty to run the subcommand (i.e. ``pty=False``),
+                  as ptys natively echo stdin to stdout on their own;
+                * And when the controlling terminal of Invoke itself (as per
+                  ``in_stream``) appears to be a valid terminal device or TTY.
+                  (Specifically, when `~invoke.util.isatty` yields a ``True``
+                  result when given ``in_stream``.)
+
+                  .. note::
+                      This property tends to be ``False`` when piping another
+                      program's output into an Invoke session, or when running
+                      Invoke within another program (e.g. running Invoke from
+                      itself).
+
+            If both of those properties are true, echoing will occur; if either
+            is false, no echoing will be performed.
+
+            When not ``None``, this parameter will override that auto-detection
+            and force, or disable, echoing.
+
+        :param str encoding:
+            Override auto-detection of which encoding the subprocess is using
+            for its stdout/stderr streams (which defaults to the return value
+            of `default_encoding`).
+
+        :param err_stream:
+            Same as ``out_stream``, except for standard error, and defaulting
+            to ``sys.stderr``.
+
+        :param dict env:
+            By default, subprocesses receive a copy of Invoke's own environment
+            (i.e. ``os.environ``). Supply a dict here to update that child
+            environment.
+
+            For example, ``run('command', env={'PYTHONPATH':
+            '/some/virtual/env/maybe'})`` would modify the ``PYTHONPATH`` env
+            var, with the rest of the child's env looking identical to the
+            parent.
+
+            .. seealso:: ``replace_env`` for changing 'update' to 'replace'.
+
+        :param bool fallback:
+            Controls auto-fallback behavior re: problems offering a pty when
+            ``pty=True``. Whether this has any effect depends on the specific
+            `Runner` subclass being invoked. Default: ``True``.
+
+        :param hide:
+            Allows the caller to disable ``run``'s default behavior of copying
+            the subprocess' stdout and stderr to the controlling terminal.
+            Specify ``hide='out'`` (or ``'stdout'``) to hide only the stdout
+            stream, ``hide='err'`` (or ``'stderr'``) to hide only stderr, or
+            ``hide='both'`` (or ``True``) to hide both streams.
+
+            The default value is ``None``, meaning to print everything;
+            ``False`` will also disable hiding.
+
+            .. note::
+                Stdout and stderr are always captured and stored in the
+                ``Result`` object, regardless of ``hide``'s value.
+
+            .. note::
+                ``hide=True`` will also override ``echo=True`` if both are
+                given (either as kwargs or via config/CLI).
+
+        :param in_stream:
+            A file-like stream object to used as the subprocess' standard
+            input. If ``None`` (the default), ``sys.stdin`` will be used.
+
+            If ``False``, will disable stdin mirroring entirely (though other
+            functionality which writes to the subprocess' stdin, such as
+            autoresponding, will still function.) Disabling stdin mirroring can
+            help when ``sys.stdin`` is a misbehaving non-stream object, such as
+            under test harnesses or headless command runners.
+
+        :param out_stream:
+            A file-like stream object to which the subprocess' standard output
+            should be written. If ``None`` (the default), ``sys.stdout`` will
+            be used.
+
+        :param bool pty:
+            By default, ``run`` connects directly to the invoked process and
+            reads its stdout/stderr streams. Some programs will buffer (or even
+            behave) differently in this situation compared to using an actual
+            terminal or pseudoterminal (pty). To use a pty instead of the
+            default behavior, specify ``pty=True``.
+
+            .. warning::
+                Due to their nature, ptys have a single output stream, so the
+                ability to tell stdout apart from stderr is **not possible**
+                when ``pty=True``. As such, all output will appear on
+                ``out_stream`` (see below) and be captured into the ``stdout``
+                result attribute. ``err_stream`` and ``stderr`` will always be
+                empty when ``pty=True``.
+
+        :param bool replace_env:
+            When ``True``, causes the subprocess to receive the dictionary
+            given to ``env`` as its entire shell environment, instead of
+            updating a copy of ``os.environ`` (which is the default behavior).
+            Default: ``False``.
+
+        :param str shell:
+            Which shell binary to use. Default: ``/bin/bash`` (on Unix;
+            ``COMSPEC`` or ``cmd.exe`` on Windows.)
+
+        :param timeout:
+            Cause the runner to submit an interrupt to the subprocess and raise
+            `.CommandTimedOut`, if the command takes longer than ``timeout``
+            seconds to execute. Defaults to ``None``, meaning no timeout.
+
+            .. versionadded:: 1.3
+
+        :param bool warn:
+            Whether to warn and continue, instead of raising
+            `.UnexpectedExit`, when the executed command exits with a
+            nonzero status. Default: ``False``.
+
+            .. note::
+                This setting has no effect on exceptions, which will still be
+                raised, typically bundled in `.ThreadException` objects if they
+                were raised by the IO worker threads.
+
+                Similarly, `.WatcherError` exceptions raised by
+                `.StreamWatcher` instances will also ignore this setting, and
+                will usually be bundled inside `.Failure` objects (in order to
+                preserve the execution context).
+
+                Ditto `.CommandTimedOut` - basically, anything that prevents a
+                command from actually getting to "exited with an exit code"
+                ignores this flag.
+
+        :param watchers:
+            A list of `.StreamWatcher` instances which will be used to scan the
+            program's ``stdout`` or ``stderr`` and may write into its ``stdin``
+            (typically ``bytes`` objects) in response to patterns or other
+            heuristics.
+
+            See :doc:`/concepts/watchers` for details on this functionality.
+
+            Default: ``[]``.
+
+        :returns:
+            `Result`, or a subclass thereof.
+
+        :raises:
+            `.UnexpectedExit`, if the command exited nonzero and
+            ``warn`` was ``False``.
+
+        :raises:
+            `.Failure`, if the command didn't even exit cleanly, e.g. if a
+            `.StreamWatcher` raised `.WatcherError`.
+
+        :raises:
+            `.ThreadException` (if the background I/O threads encountered
+            exceptions other than `.WatcherError`).
+
+        .. versionadded:: 1.0
+        """
+        try:
+            return self._run_body(command, **kwargs)
+        finally:
+            if not (self._asynchronous or self._disowned):
+                self.stop()
+
+    def echo(self, command: str) -> None:
+        print(self.opts["echo_format"].format(command=command))
+
+    def _setup(self, command: str, kwargs: Any) -> None:
+        """
+        Prepare data on ``self`` so we're ready to start running.
+        """
+        # Normalize kwargs w/ config; sets self.opts, self.streams
+        self._unify_kwargs_with_config(kwargs)
+        # Environment setup
+        self.env = self.generate_env(
+            self.opts["env"], self.opts["replace_env"]
+        )
+        # Arrive at final encoding if neither config nor kwargs had one
+        self.encoding = self.opts["encoding"] or self.default_encoding()
+        # Echo running command (wants to be early to be included in dry-run)
+        if self.opts["echo"]:
+            self.echo(command)
+        # Prepare common result args.
+        # TODO: I hate this. Needs a deeper separate think about tweaking
+        # Runner.generate_result in a way that isn't literally just this same
+        # two-step process, and which also works w/ downstream.
+        self.result_kwargs = dict(
+            command=command,
+            shell=self.opts["shell"],
+            env=self.env,
+            pty=self.using_pty,
+            hide=self.opts["hide"],
+            encoding=self.encoding,
+        )
+
+    def _run_body(self, command: str, **kwargs: Any) -> Optional["Result"]:
+        # Prepare all the bits n bobs.
+        self._setup(command, kwargs)
+        # If dry-run, stop here.
+        if self.opts["dry"]:
+            return self.generate_result(
+                **dict(self.result_kwargs, stdout="", stderr="", exited=0)
+            )
+        # Start executing the actual command (runs in background)
+        self.start(command, self.opts["shell"], self.env)
+        # If disowned, we just stop here - no threads, no timer, no error
+        # checking, nada.
+        if self._disowned:
+            return None
+        # Stand up & kick off IO, timer threads
+        self.start_timer(self.opts["timeout"])
+        self.threads, self.stdout, self.stderr = self.create_io_threads()
+        for thread in self.threads.values():
+            thread.start()
+        # Wrap up or promise that we will, depending
+        return self.make_promise() if self._asynchronous else self._finish()
+
+    def make_promise(self) -> "Promise":
+        """
+        Return a `Promise` allowing async control of the rest of lifecycle.
+
+        .. versionadded:: 1.4
+        """
+        return Promise(self)
+
+    def _finish(self) -> "Result":
+        # Wait for subprocess to run, forwarding signals as we get them.
+        try:
+            while True:
+                try:
+                    self.wait()
+                    break  # done waiting!
+                # Don't locally stop on ^C, only forward it:
+                # - if remote end really stops, we'll naturally stop after
+                # - if remote end does not stop (eg REPL, editor) we don't want
+                # to stop prematurely
+                except KeyboardInterrupt as e:
+                    self.send_interrupt(e)
+                # TODO: honor other signals sent to our own process and
+                # transmit them to the subprocess before handling 'normally'.
+        # Make sure we tie off our worker threads, even if something exploded.
+        # Any exceptions that raised during self.wait() above will appear after
+        # this block.
+        finally:
+            # Inform stdin-mirroring worker to stop its eternal looping
+            self.program_finished.set()
+            # Join threads, storing inner exceptions, & set a timeout if
+            # necessary. (Segregate WatcherErrors as they are "anticipated
+            # errors" that want to show up at the end during creation of
+            # Failure objects.)
+            watcher_errors = []
+            thread_exceptions = []
+            for target, thread in self.threads.items():
+                thread.join(self._thread_join_timeout(target))
+                exception = thread.exception()
+                if exception is not None:
+                    real = exception.value
+                    if isinstance(real, WatcherError):
+                        watcher_errors.append(real)
+                    else:
+                        thread_exceptions.append(exception)
+        # If any exceptions appeared inside the threads, raise them now as an
+        # aggregate exception object.
+        # NOTE: this is kept outside the 'finally' so that main-thread
+        # exceptions are raised before worker-thread exceptions; they're more
+        # likely to be Big Serious Problems.
+        if thread_exceptions:
+            raise ThreadException(thread_exceptions)
+        # Collate stdout/err, calculate exited, and get final result obj
+        result = self._collate_result(watcher_errors)
+        # Any presence of WatcherError from the threads indicates a watcher was
+        # upset and aborted execution; make a generic Failure out of it and
+        # raise that.
+        if watcher_errors:
+            # TODO: ambiguity exists if we somehow get WatcherError in *both*
+            # threads...as unlikely as that would normally be.
+            raise Failure(result, reason=watcher_errors[0])
+        # If a timeout was requested and the subprocess did time out, shout.
+        timeout = self.opts["timeout"]
+        if timeout is not None and self.timed_out:
+            raise CommandTimedOut(result, timeout=timeout)
+        if not (result or self.opts["warn"]):
+            raise UnexpectedExit(result)
+        return result
+
+    def _unify_kwargs_with_config(self, kwargs: Any) -> None:
+        """
+        Unify `run` kwargs with config options to arrive at local options.
+
+        Sets:
+
+        - ``self.opts`` - opts dict
+        - ``self.streams`` - map of stream names to stream target values
+        """
+        opts = {}
+        for key, value in self.context.config.run.items():
+            runtime = kwargs.pop(key, None)
+            opts[key] = value if runtime is None else runtime
+        # Pull in command execution timeout, which stores config elsewhere,
+        # but only use it if it's actually set (backwards compat)
+        config_timeout = self.context.config.timeouts.command
+        opts["timeout"] = kwargs.pop("timeout", config_timeout)
+        # Handle invalid kwarg keys (anything left in kwargs).
+        # Act like a normal function would, i.e. TypeError
+        if kwargs:
+            err = "run() got an unexpected keyword argument '{}'"
+            raise TypeError(err.format(list(kwargs.keys())[0]))
+        # Update disowned, async flags
+        self._asynchronous = opts["asynchronous"]
+        self._disowned = opts["disown"]
+        if self._asynchronous and self._disowned:
+            err = "Cannot give both 'asynchronous' and 'disown' at the same time!"  # noqa
+            raise ValueError(err)
+        # If hide was True, turn off echoing
+        if opts["hide"] is True:
+            opts["echo"] = False
+        # Conversely, ensure echoing is always on when dry-running
+        if opts["dry"] is True:
+            opts["echo"] = True
+        # Always hide if async
+        if self._asynchronous:
+            opts["hide"] = True
+        # Then normalize 'hide' from one of the various valid input values,
+        # into a stream-names tuple. Also account for the streams.
+        out_stream, err_stream = opts["out_stream"], opts["err_stream"]
+        opts["hide"] = normalize_hide(opts["hide"], out_stream, err_stream)
+        # Derive stream objects
+        if out_stream is None:
+            out_stream = sys.stdout
+        if err_stream is None:
+            err_stream = sys.stderr
+        in_stream = opts["in_stream"]
+        if in_stream is None:
+            # If in_stream hasn't been overridden, and we're async, we don't
+            # want to read from sys.stdin (otherwise the default) - so set
+            # False instead.
+            in_stream = False if self._asynchronous else sys.stdin
+        # Determine pty or no
+        self.using_pty = self.should_use_pty(opts["pty"], opts["fallback"])
+        if opts["watchers"]:
+            self.watchers = opts["watchers"]
+        # Set data
+        self.opts = opts
+        self.streams = {"out": out_stream, "err": err_stream, "in": in_stream}
+
+    def _collate_result(self, watcher_errors: List[WatcherError]) -> "Result":
+        # At this point, we had enough success that we want to be returning or
+        # raising detailed info about our execution; so we generate a Result.
+        stdout = "".join(self.stdout)
+        stderr = "".join(self.stderr)
+        if WINDOWS:
+            # "Universal newlines" - replace all standard forms of
+            # newline with \n. This is not technically Windows related
+            # (\r as newline is an old Mac convention) but we only apply
+            # the translation for Windows as that's the only platform
+            # it is likely to matter for these days.
+            stdout = stdout.replace("\r\n", "\n").replace("\r", "\n")
+            stderr = stderr.replace("\r\n", "\n").replace("\r", "\n")
+        # Get return/exit code, unless there were WatcherErrors to handle.
+        # NOTE: In that case, returncode() may block waiting on the process
+        # (which may be waiting for user input). Since most WatcherError
+        # situations lack a useful exit code anyways, skipping this doesn't
+        # really hurt any.
+        exited = None if watcher_errors else self.returncode()
+        # TODO: as noted elsewhere, I kinda hate this. Consider changing
+        # generate_result()'s API in next major rev so we can tidy up.
+        result = self.generate_result(
+            **dict(
+                self.result_kwargs, stdout=stdout, stderr=stderr, exited=exited
+            )
+        )
+        return result
+
+    def _thread_join_timeout(self, target: Callable) -> Optional[int]:
+        # Add a timeout to out/err thread joins when it looks like they're not
+        # dead but their counterpart is dead; this indicates issue #351 (fixed
+        # by #432) where the subproc may hang because its stdout (or stderr) is
+        # no longer being consumed by the dead thread (and a pipe is filling
+        # up.) In that case, the non-dead thread is likely to block forever on
+        # a `recv` unless we add this timeout.
+        if target == self.handle_stdin:
+            return None
+        opposite = self.handle_stderr
+        if target == self.handle_stderr:
+            opposite = self.handle_stdout
+        if opposite in self.threads and self.threads[opposite].is_dead:
+            return 1
+        return None
+
+    def create_io_threads(
+        self,
+    ) -> Tuple[Dict[Callable, ExceptionHandlingThread], List[str], List[str]]:
+        """
+        Create and return a dictionary of IO thread worker objects.
+
+        Caller is expected to handle persisting and/or starting the wrapped
+        threads.
+        """
+        stdout: List[str] = []
+        stderr: List[str] = []
+        # Set up IO thread parameters (format - body_func: {kwargs})
+        thread_args: Dict[Callable, Any] = {
+            self.handle_stdout: {
+                "buffer_": stdout,
+                "hide": "stdout" in self.opts["hide"],
+                "output": self.streams["out"],
+            }
+        }
+        # After opt processing above, in_stream will be a real stream obj or
+        # False, so we can truth-test it. We don't even create a stdin-handling
+        # thread if it's False, meaning user indicated stdin is nonexistent or
+        # problematic.
+        if self.streams["in"]:
+            thread_args[self.handle_stdin] = {
+                "input_": self.streams["in"],
+                "output": self.streams["out"],
+                "echo": self.opts["echo_stdin"],
+            }
+        if not self.using_pty:
+            thread_args[self.handle_stderr] = {
+                "buffer_": stderr,
+                "hide": "stderr" in self.opts["hide"],
+                "output": self.streams["err"],
+            }
+        # Kick off IO threads
+        threads = {}
+        for target, kwargs in thread_args.items():
+            t = ExceptionHandlingThread(target=target, kwargs=kwargs)
+            threads[target] = t
+        return threads, stdout, stderr
+
+    def generate_result(self, **kwargs: Any) -> "Result":
+        """
+        Create & return a suitable `Result` instance from the given ``kwargs``.
+
+        Subclasses may wish to override this in order to manipulate things or
+        generate a `Result` subclass (e.g. ones containing additional metadata
+        besides the default).
+
+        .. versionadded:: 1.0
+        """
+        return Result(**kwargs)
+
+    def read_proc_output(self, reader: Callable) -> Generator[str, None, None]:
+        """
+        Iteratively read & decode bytes from a subprocess' out/err stream.
+
+        :param reader:
+            A literal reader function/partial, wrapping the actual stream
+            object in question, which takes a number of bytes to read, and
+            returns that many bytes (or ``None``).
+
+            ``reader`` should be a reference to either `read_proc_stdout` or
+            `read_proc_stderr`, which perform the actual, platform/library
+            specific read calls.
+
+        :returns:
+            A generator yielding strings.
+
+            Specifically, each resulting string is the result of decoding
+            `read_chunk_size` bytes read from the subprocess' out/err stream.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: Typically, reading from any stdout/err (local, remote or
+        # otherwise) can be thought of as "read until you get nothing back".
+        # This is preferable over "wait until an out-of-band signal claims the
+        # process is done running" because sometimes that signal will appear
+        # before we've actually read all the data in the stream (i.e.: a race
+        # condition).
+        while True:
+            data = reader(self.read_chunk_size)
+            if not data:
+                break
+            yield self.decode(data)
+
+    def write_our_output(self, stream: IO, string: str) -> None:
+        """
+        Write ``string`` to ``stream``.
+
+        Also calls ``.flush()`` on ``stream`` to ensure that real terminal
+        streams don't buffer.
+
+        :param stream:
+            A file-like stream object, mapping to the ``out_stream`` or
+            ``err_stream`` parameters of `run`.
+
+        :param string: A Unicode string object.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        stream.write(string)
+        stream.flush()
+
+    def _handle_output(
+        self,
+        buffer_: List[str],
+        hide: bool,
+        output: IO,
+        reader: Callable,
+    ) -> None:
+        # TODO: store un-decoded/raw bytes somewhere as well...
+        for data in self.read_proc_output(reader):
+            # Echo to local stdout if necessary
+            # TODO: should we rephrase this as "if you want to hide, give me a
+            # dummy output stream, e.g. something like /dev/null"? Otherwise, a
+            # combo of 'hide=stdout' + 'here is an explicit out_stream' means
+            # out_stream is never written to, and that seems...odd.
+            if not hide:
+                self.write_our_output(stream=output, string=data)
+            # Store in shared buffer so main thread can do things with the
+            # result after execution completes.
+            # NOTE: this is threadsafe insofar as no reading occurs until after
+            # the thread is join()'d.
+            buffer_.append(data)
+            # Run our specific buffer through the autoresponder framework
+            self.respond(buffer_)
+
+    def handle_stdout(
+        self, buffer_: List[str], hide: bool, output: IO
+    ) -> None:
+        """
+        Read process' stdout, storing into a buffer & printing/parsing.
+
+        Intended for use as a thread target. Only terminates when all stdout
+        from the subprocess has been read.
+
+        :param buffer_: The capture buffer shared with the main thread.
+        :param bool hide: Whether or not to replay data into ``output``.
+        :param output:
+            Output stream (file-like object) to write data into when not
+            hiding.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self._handle_output(
+            buffer_, hide, output, reader=self.read_proc_stdout
+        )
+
+    def handle_stderr(
+        self, buffer_: List[str], hide: bool, output: IO
+    ) -> None:
+        """
+        Read process' stderr, storing into a buffer & printing/parsing.
+
+        Identical to `handle_stdout` except for the stream read from; see its
+        docstring for API details.
+
+        .. versionadded:: 1.0
+        """
+        self._handle_output(
+            buffer_, hide, output, reader=self.read_proc_stderr
+        )
+
+    def read_our_stdin(self, input_: IO) -> Optional[str]:
+        """
+        Read & decode bytes from a local stdin stream.
+
+        :param input_:
+            Actual stream object to read from. Maps to ``in_stream`` in `run`,
+            so will often be ``sys.stdin``, but might be any stream-like
+            object.
+
+        :returns:
+            A Unicode string, the result of decoding the read bytes (this might
+            be the empty string if the pipe has closed/reached EOF); or
+            ``None`` if stdin wasn't ready for reading yet.
+
+        .. versionadded:: 1.0
+        """
+        # TODO: consider moving the character_buffered contextmanager call in
+        # here? Downside is it would be flipping those switches for every byte
+        # read instead of once per session, which could be costly (?).
+        bytes_ = None
+        if ready_for_reading(input_):
+            try:
+                bytes_ = input_.read(bytes_to_read(input_))
+            except OSError as e:
+                # Assume EBADF in this situation implies running under nohup or
+                # similar, where:
+                # - we cannot reliably detect a bad FD up front
+                # - trying to read it would explode
+                # - user almost surely doesn't care about stdin anyways
+                # and ignore it (but not other OSErrors!)
+                if e.errno != errno.EBADF:
+                    raise
+            # Decode if it appears to be binary-type. (From real terminal
+            # streams, usually yes; from file-like objects, often no.)
+            if bytes_ and isinstance(bytes_, bytes):
+                # TODO: will decoding 1 byte at a time break multibyte
+                # character encodings? How to square interactivity with that?
+                bytes_ = self.decode(bytes_)
+        return bytes_
+
+    def handle_stdin(
+        self,
+        input_: IO,
+        output: IO,
+        echo: bool = False,
+    ) -> None:
+        """
+        Read local stdin, copying into process' stdin as necessary.
+
+        Intended for use as a thread target.
+
+        .. note::
+            Because real terminal stdin streams have no well-defined "end", if
+            such a stream is detected (based on existence of a callable
+            ``.fileno()``) this method will wait until `program_finished` is
+            set, before terminating.
+
+            When the stream doesn't appear to be from a terminal, the same
+            semantics as `handle_stdout` are used - the stream is simply
+            ``read()`` from until it returns an empty value.
+
+        :param input_: Stream (file-like object) from which to read.
+        :param output: Stream (file-like object) to which echoing may occur.
+        :param bool echo: User override option for stdin-stdout echoing.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        # TODO: reinstate lock/whatever thread logic from fab v1 which prevents
+        # reading from stdin while other parts of the code are prompting for
+        # runtime passwords? (search for 'input_enabled')
+        # TODO: fabric#1339 is strongly related to this, if it's not literally
+        # exposing some regression in Fabric 1.x itself.
+        closed_stdin = False
+        with character_buffered(input_):
+            while True:
+                data = self.read_our_stdin(input_)
+                if data:
+                    # Mirror what we just read to process' stdin.
+                    # We encode to ensure bytes, but skip the decode step since
+                    # there's presumably no need (nobody's interacting with
+                    # this data programmatically).
+                    self.write_proc_stdin(data)
+                    # Also echo it back to local stdout (or whatever
+                    # out_stream is set to) when necessary.
+                    if echo is None:
+                        echo = self.should_echo_stdin(input_, output)
+                    if echo:
+                        self.write_our_output(stream=output, string=data)
+                # Empty string/char/byte != None. Can't just use 'else' here.
+                elif data is not None:
+                    # When reading from file-like objects that aren't "real"
+                    # terminal streams, an empty byte signals EOF.
+                    if not self.using_pty and not closed_stdin:
+                        self.close_proc_stdin()
+                        closed_stdin = True
+                # Dual all-done signals: program being executed is done
+                # running, *and* we don't seem to be reading anything out of
+                # stdin. (NOTE: If we only test the former, we may encounter
+                # race conditions re: unread stdin.)
+                if self.program_finished.is_set() and not data:
+                    break
+                # Take a nap so we're not chewing CPU.
+                time.sleep(self.input_sleep)
+
+    def should_echo_stdin(self, input_: IO, output: IO) -> bool:
+        """
+        Determine whether data read from ``input_`` should echo to ``output``.
+
+        Used by `handle_stdin`; tests attributes of ``input_`` and ``output``.
+
+        :param input_: Input stream (file-like object).
+        :param output: Output stream (file-like object).
+        :returns: A ``bool``.
+
+        .. versionadded:: 1.0
+        """
+        return (not self.using_pty) and isatty(input_)
+
+    def respond(self, buffer_: List[str]) -> None:
+        """
+        Write to the program's stdin in response to patterns in ``buffer_``.
+
+        The patterns and responses are driven by the `.StreamWatcher` instances
+        from the ``watchers`` kwarg of `run` - see :doc:`/concepts/watchers`
+        for a conceptual overview.
+
+        :param buffer:
+            The capture buffer for this thread's particular IO stream.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        # Join buffer contents into a single string; without this,
+        # StreamWatcher subclasses can't do things like iteratively scan for
+        # pattern matches.
+        # NOTE: using string.join should be "efficient enough" for now, re:
+        # speed and memory use. Should that become false, consider using
+        # StringIO or cStringIO (tho the latter doesn't do Unicode well?) which
+        # is apparently even more efficient.
+        stream = "".join(buffer_)
+        for watcher in self.watchers:
+            for response in watcher.submit(stream):
+                self.write_proc_stdin(response)
+
+    def generate_env(
+        self, env: Dict[str, Any], replace_env: bool
+    ) -> Dict[str, Any]:
+        """
+        Return a suitable environment dict based on user input & behavior.
+
+        :param dict env: Dict supplying overrides or full env, depending.
+        :param bool replace_env:
+            Whether ``env`` updates, or is used in place of, the value of
+            `os.environ`.
+
+        :returns: A dictionary of shell environment vars.
+
+        .. versionadded:: 1.0
+        """
+        return env if replace_env else dict(os.environ, **env)
+
+    def should_use_pty(self, pty: bool, fallback: bool) -> bool:
+        """
+        Should execution attempt to use a pseudo-terminal?
+
+        :param bool pty:
+            Whether the user explicitly asked for a pty.
+        :param bool fallback:
+            Whether falling back to non-pty execution should be allowed, in
+            situations where ``pty=True`` but a pty could not be allocated.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: fallback not used: no falling back implemented by default.
+        return pty
+
+    @property
+    def has_dead_threads(self) -> bool:
+        """
+        Detect whether any IO threads appear to have terminated unexpectedly.
+
+        Used during process-completion waiting (in `wait`) to ensure we don't
+        deadlock our child process if our IO processing threads have
+        errored/died.
+
+        :returns:
+            ``True`` if any threads appear to have terminated with an
+            exception, ``False`` otherwise.
+
+        .. versionadded:: 1.0
+        """
+        return any(x.is_dead for x in self.threads.values())
+
+    def wait(self) -> None:
+        """
+        Block until the running command appears to have exited.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        while True:
+            proc_finished = self.process_is_finished
+            dead_threads = self.has_dead_threads
+            if proc_finished or dead_threads:
+                break
+            time.sleep(self.input_sleep)
+
+    def write_proc_stdin(self, data: str) -> None:
+        """
+        Write encoded ``data`` to the running process' stdin.
+
+        :param data: A Unicode string.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        # Encode always, then request implementing subclass to perform the
+        # actual write to subprocess' stdin.
+        self._write_proc_stdin(data.encode(self.encoding))
+
+    def decode(self, data: bytes) -> str:
+        """
+        Decode some ``data`` bytes, returning Unicode.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: yes, this is a 1-liner. The point is to make it much harder to
+        # forget to use 'replace' when decoding :)
+        return data.decode(self.encoding, "replace")
+
+    @property
+    def process_is_finished(self) -> bool:
+        """
+        Determine whether our subprocess has terminated.
+
+        .. note::
+            The implementation of this method should be nonblocking, as it is
+            used within a query/poll loop.
+
+        :returns:
+            ``True`` if the subprocess has finished running, ``False``
+            otherwise.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def start(self, command: str, shell: str, env: Dict[str, Any]) -> None:
+        """
+        Initiate execution of ``command`` (via ``shell``, with ``env``).
+
+        Typically this means use of a forked subprocess or requesting start of
+        execution on a remote system.
+
+        In most cases, this method will also set subclass-specific member
+        variables used in other methods such as `wait` and/or `returncode`.
+
+        :param str command:
+            Command string to execute.
+
+        :param str shell:
+            Shell to use when executing ``command``.
+
+        :param dict env:
+            Environment dict used to prep shell environment.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def start_timer(self, timeout: int) -> None:
+        """
+        Start a timer to `kill` our subprocess after ``timeout`` seconds.
+        """
+        if timeout is not None:
+            self._timer = threading.Timer(timeout, self.kill)
+            self._timer.start()
+
+    def read_proc_stdout(self, num_bytes: int) -> Optional[bytes]:
+        """
+        Read ``num_bytes`` from the running process' stdout stream.
+
+        :param int num_bytes: Number of bytes to read at maximum.
+
+        :returns: A string/bytes object.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def read_proc_stderr(self, num_bytes: int) -> Optional[bytes]:
+        """
+        Read ``num_bytes`` from the running process' stderr stream.
+
+        :param int num_bytes: Number of bytes to read at maximum.
+
+        :returns: A string/bytes object.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def _write_proc_stdin(self, data: bytes) -> None:
+        """
+        Write ``data`` to running process' stdin.
+
+        This should never be called directly; it's for subclasses to implement.
+        See `write_proc_stdin` for the public API call.
+
+        :param data: Already-encoded byte data suitable for writing.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def close_proc_stdin(self) -> None:
+        """
+        Close running process' stdin.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.3
+        """
+        raise NotImplementedError
+
+    def default_encoding(self) -> str:
+        """
+        Return a string naming the expected encoding of subprocess streams.
+
+        This return value should be suitable for use by encode/decode methods.
+
+        .. versionadded:: 1.0
+        """
+        # TODO: probably wants to be 2 methods, one for local and one for
+        # subprocess. For now, good enough to assume both are the same.
+        return default_encoding()
+
+    def send_interrupt(self, interrupt: "KeyboardInterrupt") -> None:
+        """
+        Submit an interrupt signal to the running subprocess.
+
+        In almost all implementations, the default behavior is what will be
+        desired: submit ``\x03`` to the subprocess' stdin pipe. However, we
+        leave this as a public method in case this default needs to be
+        augmented or replaced.
+
+        :param interrupt:
+            The locally-sourced ``KeyboardInterrupt`` causing the method call.
+
+        :returns: ``None``.
+
+        .. versionadded:: 1.0
+        """
+        self.write_proc_stdin("\x03")
+
+    def returncode(self) -> Optional[int]:
+        """
+        Return the numeric return/exit code resulting from command execution.
+
+        :returns:
+            `int`, if any reasonable return code could be determined, or
+            ``None`` in corner cases where that was not possible.
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+    def stop(self) -> None:
+        """
+        Perform final cleanup, if necessary.
+
+        This method is called within a ``finally`` clause inside the main `run`
+        method. Depending on the subclass, it may be a no-op, or it may do
+        things such as close network connections or open files.
+
+        :returns: ``None``
+
+        .. versionadded:: 1.0
+        """
+        if self._timer:
+            self._timer.cancel()
+
+    def kill(self) -> None:
+        """
+        Forcibly terminate the subprocess.
+
+        Typically only used by the timeout functionality.
+
+        This is often a "best-effort" attempt, e.g. remote subprocesses often
+        must settle for simply shutting down the local side of the network
+        connection and hoping the remote end eventually gets the message.
+        """
+        raise NotImplementedError
+
+    @property
+    def timed_out(self) -> bool:
+        """
+        Returns ``True`` if the subprocess stopped because it timed out.
+
+        .. versionadded:: 1.3
+        """
+        # Timer expiry implies we did time out. (The timer itself will have
+        # killed the subprocess, allowing us to even get to this point.)
+        return bool(self._timer and not self._timer.is_alive())
+
+
+class Local(Runner):
+    """
+    Execute a command on the local system in a subprocess.
+
+    .. note::
+        When Invoke itself is executed without a controlling terminal (e.g.
+        when ``sys.stdin`` lacks a useful ``fileno``), it's not possible to
+        present a handle on our PTY to local subprocesses. In such situations,
+        `Local` will fallback to behaving as if ``pty=False`` (on the theory
+        that degraded execution is better than none at all) as well as printing
+        a warning to stderr.
+
+        To disable this behavior, say ``fallback=False``.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, context: "Context") -> None:
+        super().__init__(context)
+        # Bookkeeping var for pty use case
+        self.status = 0
+
+    def should_use_pty(self, pty: bool = False, fallback: bool = True) -> bool:
+        use_pty = False
+        if pty:
+            use_pty = True
+            # TODO: pass in & test in_stream, not sys.stdin
+            if not has_fileno(sys.stdin) and fallback:
+                if not self.warned_about_pty_fallback:
+                    err = "WARNING: stdin has no fileno; falling back to non-pty execution!\n"  # noqa
+                    sys.stderr.write(err)
+                    self.warned_about_pty_fallback = True
+                use_pty = False
+        return use_pty
+
+    def read_proc_stdout(self, num_bytes: int) -> Optional[bytes]:
+        # Obtain useful read-some-bytes function
+        if self.using_pty:
+            # Need to handle spurious OSErrors on some Linux platforms.
+            try:
+                data = os.read(self.parent_fd, num_bytes)
+            except OSError as e:
+                # Only eat I/O specific OSErrors so we don't hide others
+                stringified = str(e)
+                io_errors = (
+                    # The typical default
+                    "Input/output error",
+                    # Some less common platforms phrase it this way
+                    "I/O error",
+                )
+                if not any(error in stringified for error in io_errors):
+                    raise
+                # The bad OSErrors happen after all expected output has
+                # appeared, so we return a falsey value, which triggers the
+                # "end of output" logic in code using reader functions.
+                data = None
+        elif self.process and self.process.stdout:
+            data = os.read(self.process.stdout.fileno(), num_bytes)
+        else:
+            data = None
+        return data
+
+    def read_proc_stderr(self, num_bytes: int) -> Optional[bytes]:
+        # NOTE: when using a pty, this will never be called.
+        # TODO: do we ever get those OSErrors on stderr? Feels like we could?
+        if self.process and self.process.stderr:
+            return os.read(self.process.stderr.fileno(), num_bytes)
+        return None
+
+    def _write_proc_stdin(self, data: bytes) -> None:
+        # NOTE: parent_fd from os.fork() is a read/write pipe attached to our
+        # forked process' stdout/stdin, respectively.
+        if self.using_pty:
+            fd = self.parent_fd
+        elif self.process and self.process.stdin:
+            fd = self.process.stdin.fileno()
+        else:
+            raise SubprocessPipeError(
+                "Unable to write to missing subprocess or stdin!"
+            )
+        # Try to write, ignoring broken pipes if encountered (implies child
+        # process exited before the process piping stdin to us finished;
+        # there's nothing we can do about that!)
+        try:
+            os.write(fd, data)
+        except OSError as e:
+            if "Broken pipe" not in str(e):
+                raise
+
+    def close_proc_stdin(self) -> None:
+        if self.using_pty:
+            # there is no working scenario to tell the process that stdin
+            # closed when using pty
+            raise SubprocessPipeError("Cannot close stdin when pty=True")
+        elif self.process and self.process.stdin:
+            self.process.stdin.close()
+        else:
+            raise SubprocessPipeError(
+                "Unable to close missing subprocess or stdin!"
+            )
+
+    def start(self, command: str, shell: str, env: Dict[str, Any]) -> None:
+        if self.using_pty:
+            if pty is None:  # Encountered ImportError
+                err = "You indicated pty=True, but your platform doesn't support the 'pty' module!"  # noqa
+                sys.exit(err)
+            cols, rows = pty_size()
+            self.pid, self.parent_fd = pty.fork()
+            # If we're the child process, load up the actual command in a
+            # shell, just as subprocess does; this replaces our process - whose
+            # pipes are all hooked up to the PTY - with the "real" one.
+            if self.pid == 0:
+                # TODO: both pty.spawn() and pexpect.spawn() do a lot of
+                # setup/teardown involving tty.setraw, getrlimit, signal.
+                # Ostensibly we'll want some of that eventually, but if
+                # possible write tests - integration-level if necessary -
+                # before adding it!
+                #
+                # Set pty window size based on what our own controlling
+                # terminal's window size appears to be.
+                # TODO: make subroutine?
+                winsize = struct.pack("HHHH", rows, cols, 0, 0)
+                fcntl.ioctl(sys.stdout.fileno(), termios.TIOCSWINSZ, winsize)
+                # Use execve for bare-minimum "exec w/ variable # args + env"
+                # behavior. No need for the 'p' (use PATH to find executable)
+                # for now.
+                # NOTE: stdlib subprocess (actually its posix flavor, which is
+                # written in C) uses either execve or execv, depending.
+                os.execve(shell, [shell, "-c", command], env)
+        else:
+            self.process = Popen(
+                command,
+                shell=True,
+                executable=shell,
+                env=env,
+                stdout=PIPE,
+                stderr=PIPE,
+                stdin=PIPE,
+            )
+
+    def kill(self) -> None:
+        pid = self.pid if self.using_pty else self.process.pid
+        try:
+            os.kill(pid, signal.SIGKILL)
+        except ProcessLookupError:
+            # In odd situations where our subprocess is already dead, don't
+            # throw this upwards.
+            pass
+
+    @property
+    def process_is_finished(self) -> bool:
+        if self.using_pty:
+            # NOTE:
+            # https://github.com/pexpect/ptyprocess/blob/4058faa05e2940662ab6da1330aa0586c6f9cd9c/ptyprocess/ptyprocess.py#L680-L687
+            # implies that Linux "requires" use of the blocking, non-WNOHANG
+            # version of this call. Our testing doesn't verify this, however,
+            # so...
+            # NOTE: It does appear to be totally blocking on Windows, so our
+            # issue #351 may be totally unsolvable there. Unclear.
+            pid_val, self.status = os.waitpid(self.pid, os.WNOHANG)
+            return pid_val != 0
+        else:
+            return self.process.poll() is not None
+
+    def returncode(self) -> Optional[int]:
+        if self.using_pty:
+            # No subprocess.returncode available; use WIFEXITED/WIFSIGNALED to
+            # determine whch of WEXITSTATUS / WTERMSIG to use.
+            # TODO: is it safe to just say "call all WEXITSTATUS/WTERMSIG and
+            # return whichever one of them is nondefault"? Probably not?
+            # NOTE: doing this in an arbitrary order should be safe since only
+            # one of the WIF* methods ought to ever return True.
+            code = None
+            if os.WIFEXITED(self.status):
+                code = os.WEXITSTATUS(self.status)
+            elif os.WIFSIGNALED(self.status):
+                code = os.WTERMSIG(self.status)
+                # Match subprocess.returncode by turning signals into negative
+                # 'exit code' integers.
+                code = -1 * code
+            return code
+            # TODO: do we care about WIFSTOPPED? Maybe someday?
+        else:
+            return self.process.returncode
+
+    def stop(self) -> None:
+        super().stop()
+        # If we opened a PTY for child communications, make sure to close() it,
+        # otherwise long-running Invoke-using processes exhaust their file
+        # descriptors eventually.
+        if self.using_pty:
+            try:
+                os.close(self.parent_fd)
+            except Exception:
+                # If something weird happened preventing the close, there's
+                # nothing to be done about it now...
+                pass
+
+
+class Result:
+    """
+    A container for information about the result of a command execution.
+
+    All params are exposed as attributes of the same name and type.
+
+    :param str stdout:
+        The subprocess' standard output.
+
+    :param str stderr:
+        Same as ``stdout`` but containing standard error (unless the process
+        was invoked via a pty, in which case it will be empty; see
+        `.Runner.run`.)
+
+    :param str encoding:
+        The string encoding used by the local shell environment.
+
+    :param str command:
+        The command which was executed.
+
+    :param str shell:
+        The shell binary used for execution.
+
+    :param dict env:
+        The shell environment used for execution. (Default is the empty dict,
+        ``{}``, not ``None`` as displayed in the signature.)
+
+    :param int exited:
+        An integer representing the subprocess' exit/return code.
+
+        .. note::
+            This may be ``None`` in situations where the subprocess did not run
+            to completion, such as when auto-responding failed or a timeout was
+            reached.
+
+    :param bool pty:
+        A boolean describing whether the subprocess was invoked with a pty or
+        not; see `.Runner.run`.
+
+    :param tuple hide:
+        A tuple of stream names (none, one or both of ``('stdout', 'stderr')``)
+        which were hidden from the user when the generating command executed;
+        this is a normalized value derived from the ``hide`` parameter of
+        `.Runner.run`.
+
+        For example, ``run('command', hide='stdout')`` will yield a `Result`
+        where ``result.hide == ('stdout',)``; ``hide=True`` or ``hide='both'``
+        results in ``result.hide == ('stdout', 'stderr')``; and ``hide=False``
+        (the default) generates ``result.hide == ()`` (the empty tuple.)
+
+    .. note::
+        `Result` objects' truth evaluation is equivalent to their `.ok`
+        attribute's value. Therefore, quick-and-dirty expressions like the
+        following are possible::
+
+            if run("some shell command"):
+                do_something()
+            else:
+                handle_problem()
+
+        However, remember `Zen of Python #2
+        <http://zen-of-python.info/explicit-is-better-than-implicit.html#2>`_.
+
+    .. versionadded:: 1.0
+    """
+
+    # TODO: inherit from namedtuple instead? heh (or: use attrs from pypi)
+    def __init__(
+        self,
+        stdout: str = "",
+        stderr: str = "",
+        encoding: Optional[str] = None,
+        command: str = "",
+        shell: str = "",
+        env: Optional[Dict[str, Any]] = None,
+        exited: int = 0,
+        pty: bool = False,
+        hide: Tuple[str, ...] = tuple(),
+    ):
+        self.stdout = stdout
+        self.stderr = stderr
+        if encoding is None:
+            encoding = default_encoding()
+        self.encoding = encoding
+        self.command = command
+        self.shell = shell
+        self.env = {} if env is None else env
+        self.exited = exited
+        self.pty = pty
+        self.hide = hide
+
+    @property
+    def return_code(self) -> int:
+        """
+        An alias for ``.exited``.
+
+        .. versionadded:: 1.0
+        """
+        return self.exited
+
+    def __bool__(self) -> bool:
+        return self.ok
+
+    def __str__(self) -> str:
+        if self.exited is not None:
+            desc = "Command exited with status {}.".format(self.exited)
+        else:
+            desc = "Command was not fully executed due to watcher error."
+        ret = [desc]
+        for x in ("stdout", "stderr"):
+            val = getattr(self, x)
+            ret.append(
+                """=== {} ===
+{}
+""".format(
+                    x, val.rstrip()
+                )
+                if val
+                else "(no {})".format(x)
+            )
+        return "\n".join(ret)
+
+    def __repr__(self) -> str:
+        # TODO: more? e.g. len of stdout/err? (how to represent cleanly in a
+        # 'x=y' format like this? e.g. '4b' is ambiguous as to what it
+        # represents
+        template = "<Result cmd={!r} exited={}>"
+        return template.format(self.command, self.exited)
+
+    @property
+    def ok(self) -> bool:
+        """
+        A boolean equivalent to ``exited == 0``.
+
+        .. versionadded:: 1.0
+        """
+        return bool(self.exited == 0)
+
+    @property
+    def failed(self) -> bool:
+        """
+        The inverse of ``ok``.
+
+        I.e., ``True`` if the program exited with a nonzero return code, and
+        ``False`` otherwise.
+
+        .. versionadded:: 1.0
+        """
+        return not self.ok
+
+    def tail(self, stream: str, count: int = 10) -> str:
+        """
+        Return the last ``count`` lines of ``stream``, plus leading whitespace.
+
+        :param str stream:
+            Name of some captured stream attribute, eg ``"stdout"``.
+        :param int count:
+            Number of lines to preserve.
+
+        .. versionadded:: 1.3
+        """
+        # TODO: preserve alternate line endings? Mehhhh
+        # NOTE: no trailing \n preservation; easier for below display if
+        # normalized
+        return "\n\n" + "\n".join(getattr(self, stream).splitlines()[-count:])
+
+
+class Promise(Result):
+    """
+    A promise of some future `Result`, yielded from asynchronous execution.
+
+    This class' primary API member is `join`; instances may also be used as
+    context managers, which will automatically call `join` when the block
+    exits. In such cases, the context manager yields ``self``.
+
+    `Promise` also exposes copies of many `Result` attributes, specifically
+    those that derive from `~Runner.run` kwargs and not the result of command
+    execution. For example, ``command`` is replicated here, but ``stdout`` is
+    not.
+
+    .. versionadded:: 1.4
+    """
+
+    def __init__(self, runner: "Runner") -> None:
+        """
+        Create a new promise.
+
+        :param runner:
+            An in-flight `Runner` instance making this promise.
+
+            Must already have started the subprocess and spun up IO threads.
+        """
+        self.runner = runner
+        # Basically just want exactly this (recently refactored) kwargs dict.
+        # TODO: consider proxying vs copying, but prob wait for refactor
+        for key, value in self.runner.result_kwargs.items():
+            setattr(self, key, value)
+
+    def join(self) -> Result:
+        """
+        Block until associated subprocess exits, returning/raising the result.
+
+        This acts identically to the end of a synchronously executed ``run``,
+        namely that:
+
+        - various background threads (such as IO workers) are themselves
+          joined;
+        - if the subprocess exited normally, a `Result` is returned;
+        - in any other case (unforeseen exceptions, IO sub-thread
+          `.ThreadException`, `.Failure`, `.WatcherError`) the relevant
+          exception is raised here.
+
+        See `~Runner.run` docs, or those of the relevant classes, for further
+        details.
+        """
+        try:
+            return self.runner._finish()
+        finally:
+            self.runner.stop()
+
+    def __enter__(self) -> "Promise":
+        return self
+
+    def __exit__(
+        self,
+        exc_type: Optional[Type[BaseException]],
+        exc_value: BaseException,
+        exc_tb: Optional[TracebackType],
+    ) -> None:
+        self.join()
+
+
+def normalize_hide(
+    val: Any,
+    out_stream: Optional[str] = None,
+    err_stream: Optional[str] = None,
+) -> Tuple[str, ...]:
+    # Normalize to list-of-stream-names
+    hide_vals = (None, False, "out", "stdout", "err", "stderr", "both", True)
+    if val not in hide_vals:
+        err = "'hide' got {!r} which is not in {!r}"
+        raise ValueError(err.format(val, hide_vals))
+    if val in (None, False):
+        hide = []
+    elif val in ("both", True):
+        hide = ["stdout", "stderr"]
+    elif val == "out":
+        hide = ["stdout"]
+    elif val == "err":
+        hide = ["stderr"]
+    else:
+        hide = [val]
+    # Revert any streams that have been overridden from the default value
+    if out_stream is not None and "stdout" in hide:
+        hide.remove("stdout")
+    if err_stream is not None and "stderr" in hide:
+        hide.remove("stderr")
+    return tuple(hide)
+
+
+def default_encoding() -> str:
+    """
+    Obtain apparent interpreter-local default text encoding.
+
+    Often used as a baseline in situations where we must use SOME encoding for
+    unknown-but-presumably-text bytes, and the user has not specified an
+    override.
+    """
+    encoding = locale.getpreferredencoding(False)
+    return encoding
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/tasks.py b/TP03/TP03/lib/python3.9/site-packages/invoke/tasks.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd3075e9b417f838792978e01bea06f0e7814bcd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/tasks.py
@@ -0,0 +1,519 @@
+"""
+This module contains the core `.Task` class & convenience decorators used to
+generate new tasks.
+"""
+
+import inspect
+import types
+from copy import deepcopy
+from functools import update_wrapper
+from typing import (
+    TYPE_CHECKING,
+    Any,
+    Callable,
+    Dict,
+    List,
+    Generic,
+    Iterable,
+    Optional,
+    Set,
+    Tuple,
+    Type,
+    TypeVar,
+    Union,
+)
+
+from .context import Context
+from .parser import Argument, translate_underscores
+
+if TYPE_CHECKING:
+    from inspect import Signature
+    from .config import Config
+
+T = TypeVar("T", bound=Callable)
+
+
+class Task(Generic[T]):
+    """
+    Core object representing an executable task & its argument specification.
+
+    For the most part, this object is a clearinghouse for all of the data that
+    may be supplied to the `@task <invoke.tasks.task>` decorator, such as
+    ``name``, ``aliases``, ``positional`` etc, which appear as attributes.
+
+    In addition, instantiation copies some introspection/documentation friendly
+    metadata off of the supplied ``body`` object, such as ``__doc__``,
+    ``__name__`` and ``__module__``, allowing it to "appear as" ``body`` for
+    most intents and purposes.
+
+    .. versionadded:: 1.0
+    """
+
+    # TODO: store these kwarg defaults central, refer to those values both here
+    # and in @task.
+    # TODO: allow central per-session / per-taskmodule control over some of
+    # them, e.g. (auto_)positional, auto_shortflags.
+    # NOTE: we shadow __builtins__.help here on purpose - obfuscating to avoid
+    # it feels bad, given the builtin will never actually be in play anywhere
+    # except a debug shell whose frame is exactly inside this class.
+    def __init__(
+        self,
+        body: Callable,
+        name: Optional[str] = None,
+        aliases: Iterable[str] = (),
+        positional: Optional[Iterable[str]] = None,
+        optional: Iterable[str] = (),
+        default: bool = False,
+        auto_shortflags: bool = True,
+        help: Optional[Dict[str, Any]] = None,
+        pre: Optional[Union[List[str], str]] = None,
+        post: Optional[Union[List[str], str]] = None,
+        autoprint: bool = False,
+        iterable: Optional[Iterable[str]] = None,
+        incrementable: Optional[Iterable[str]] = None,
+    ) -> None:
+        # Real callable
+        self.body = body
+        update_wrapper(self, self.body)
+        # Copy a bunch of special properties from the body for the benefit of
+        # Sphinx autodoc or other introspectors.
+        self.__doc__ = getattr(body, "__doc__", "")
+        self.__name__ = getattr(body, "__name__", "")
+        self.__module__ = getattr(body, "__module__", "")
+        # Default name, alternate names, and whether it should act as the
+        # default for its parent collection
+        self._name = name
+        self.aliases = aliases
+        self.is_default = default
+        # Arg/flag/parser hints
+        self.positional = self.fill_implicit_positionals(positional)
+        self.optional = tuple(optional)
+        self.iterable = iterable or []
+        self.incrementable = incrementable or []
+        self.auto_shortflags = auto_shortflags
+        self.help = (help or {}).copy()
+        # Call chain bidness
+        self.pre = pre or []
+        self.post = post or []
+        self.times_called = 0
+        # Whether to print return value post-execution
+        self.autoprint = autoprint
+
+    @property
+    def name(self) -> str:
+        return self._name or self.__name__
+
+    def __repr__(self) -> str:
+        aliases = ""
+        if self.aliases:
+            aliases = " ({})".format(", ".join(self.aliases))
+        return "<Task {!r}{}>".format(self.name, aliases)
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, Task) or self.name != other.name:
+            return False
+        # Functions do not define __eq__ but func_code objects apparently do.
+        # (If we're wrapping some other callable, they will be responsible for
+        # defining equality on their end.)
+        if self.body == other.body:
+            return True
+        else:
+            try:
+                return self.body.__code__ == other.body.__code__
+            except AttributeError:
+                return False
+
+    def __hash__(self) -> int:
+        # Presumes name and body will never be changed. Hrm.
+        # Potentially cleaner to just not use Tasks as hash keys, but let's do
+        # this for now.
+        return hash(self.name) + hash(self.body)
+
+    def __call__(self, *args: Any, **kwargs: Any) -> T:
+        # Guard against calling tasks with no context.
+        if not isinstance(args[0], Context):
+            err = "Task expected a Context as its first arg, got {} instead!"
+            # TODO: raise a custom subclass _of_ TypeError instead
+            raise TypeError(err.format(type(args[0])))
+        result = self.body(*args, **kwargs)
+        self.times_called += 1
+        return result
+
+    @property
+    def called(self) -> bool:
+        return self.times_called > 0
+
+    def argspec(self, body: Callable) -> "Signature":
+        """
+        Returns a modified `inspect.Signature` based on that of ``body``.
+
+        :returns:
+            an `inspect.Signature` matching that of ``body``, but with the
+            initial context argument removed.
+        :raises TypeError:
+            if the task lacks an initial positional `.Context` argument.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 2.0
+            Changed from returning a two-tuple of ``(arg_names, spec_dict)`` to
+            returning an `inspect.Signature`.
+        """
+        # Handle callable-but-not-function objects
+        func = (
+            body
+            if isinstance(body, types.FunctionType)
+            else body.__call__  # type: ignore
+        )
+        # Rebuild signature with first arg dropped, or die usefully(ish trying
+        sig = inspect.signature(func)
+        params = list(sig.parameters.values())
+        # TODO: this ought to also check if an extant 1st param _was_ a Context
+        # arg, and yell similarly if not.
+        if not len(params):
+            # TODO: see TODO under __call__, this should be same type
+            raise TypeError("Tasks must have an initial Context argument!")
+        return sig.replace(parameters=params[1:])
+
+    def fill_implicit_positionals(
+        self, positional: Optional[Iterable[str]]
+    ) -> Iterable[str]:
+        # If positionals is None, everything lacking a default
+        # value will be automatically considered positional.
+        if positional is None:
+            positional = [
+                x.name
+                for x in self.argspec(self.body).parameters.values()
+                if x.default is inspect.Signature.empty
+            ]
+        return positional
+
+    def arg_opts(
+        self, name: str, default: str, taken_names: Set[str]
+    ) -> Dict[str, Any]:
+        opts: Dict[str, Any] = {}
+        # Whether it's positional or not
+        opts["positional"] = name in self.positional
+        # Whether it is a value-optional flag
+        opts["optional"] = name in self.optional
+        # Whether it should be of an iterable (list) kind
+        if name in self.iterable:
+            opts["kind"] = list
+            # If user gave a non-None default, hopefully they know better
+            # than us what they want here (and hopefully it offers the list
+            # protocol...) - otherwise supply useful default
+            opts["default"] = default if default is not None else []
+        # Whether it should increment its value or not
+        if name in self.incrementable:
+            opts["incrementable"] = True
+        # Argument name(s) (replace w/ dashed version if underscores present,
+        # and move the underscored version to be the attr_name instead.)
+        original_name = name  # For reference in eg help=
+        if "_" in name:
+            opts["attr_name"] = name
+            name = translate_underscores(name)
+        names = [name]
+        if self.auto_shortflags:
+            # Must know what short names are available
+            for char in name:
+                if not (char == name or char in taken_names):
+                    names.append(char)
+                    break
+        opts["names"] = names
+        # Handle default value & kind if possible
+        if default not in (None, inspect.Signature.empty):
+            # TODO: allow setting 'kind' explicitly.
+            # NOTE: skip setting 'kind' if optional is True + type(default) is
+            # bool; that results in a nonsensical Argument which gives the
+            # parser grief in a few ways.
+            kind = type(default)
+            if not (opts["optional"] and kind is bool):
+                opts["kind"] = kind
+            opts["default"] = default
+        # Help
+        for possibility in name, original_name:
+            if possibility in self.help:
+                opts["help"] = self.help.pop(possibility)
+                break
+        return opts
+
+    def get_arguments(
+        self, ignore_unknown_help: Optional[bool] = None
+    ) -> List[Argument]:
+        """
+        Return a list of Argument objects representing this task's signature.
+
+        :param bool ignore_unknown_help:
+            Controls whether unknown help flags cause errors. See the config
+            option by the same name for details.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 1.7
+            Added the ``ignore_unknown_help`` kwarg.
+        """
+        # Core argspec
+        sig = self.argspec(self.body)
+        # Prime the list of all already-taken names (mostly for help in
+        # choosing auto shortflags)
+        taken_names = set(sig.parameters.keys())
+        # Build arg list (arg_opts will take care of setting up shortnames,
+        # etc)
+        args = []
+        for param in sig.parameters.values():
+            new_arg = Argument(
+                **self.arg_opts(param.name, param.default, taken_names)
+            )
+            args.append(new_arg)
+            # Update taken_names list with new argument's full name list
+            # (which may include new shortflags) so subsequent Argument
+            # creation knows what's taken.
+            taken_names.update(set(new_arg.names))
+        # If any values were leftover after consuming a 'help' dict, it implies
+        # the user messed up & had a typo or similar. Let's explode.
+        if self.help and not ignore_unknown_help:
+            raise ValueError(
+                "Help field was set for param(s) that don't exist: {}".format(
+                    list(self.help.keys())
+                )
+            )
+        # Now we need to ensure positionals end up in the front of the list, in
+        # order given in self.positionals, so that when Context consumes them,
+        # this order is preserved.
+        for posarg in reversed(list(self.positional)):
+            for i, arg in enumerate(args):
+                if arg.name == posarg:
+                    args.insert(0, args.pop(i))
+                    break
+        return args
+
+
+def task(*args: Any, **kwargs: Any) -> Callable:
+    """
+    Marks wrapped callable object as a valid Invoke task.
+
+    May be called without any parentheses if no extra options need to be
+    specified. Otherwise, the following keyword arguments are allowed in the
+    parenthese'd form:
+
+    * ``name``: Default name to use when binding to a `.Collection`. Useful for
+      avoiding Python namespace issues (i.e. when the desired CLI level name
+      can't or shouldn't be used as the Python level name.)
+    * ``aliases``: Specify one or more aliases for this task, allowing it to be
+      invoked as multiple different names. For example, a task named ``mytask``
+      with a simple ``@task`` wrapper may only be invoked as ``"mytask"``.
+      Changing the decorator to be ``@task(aliases=['myothertask'])`` allows
+      invocation as ``"mytask"`` *or* ``"myothertask"``.
+    * ``positional``: Iterable overriding the parser's automatic "args with no
+      default value are considered positional" behavior. If a list of arg
+      names, no args besides those named in this iterable will be considered
+      positional. (This means that an empty list will force all arguments to be
+      given as explicit flags.)
+    * ``optional``: Iterable of argument names, declaring those args to
+      have :ref:`optional values <optional-values>`. Such arguments may be
+      given as value-taking options (e.g. ``--my-arg=myvalue``, wherein the
+      task is given ``"myvalue"``) or as Boolean flags (``--my-arg``, resulting
+      in ``True``).
+    * ``iterable``: Iterable of argument names, declaring them to :ref:`build
+      iterable values <iterable-flag-values>`.
+    * ``incrementable``: Iterable of argument names, declaring them to
+      :ref:`increment their values <incrementable-flag-values>`.
+    * ``default``: Boolean option specifying whether this task should be its
+      collection's default task (i.e. called if the collection's own name is
+      given.)
+    * ``auto_shortflags``: Whether or not to automatically create short
+      flags from task options; defaults to True.
+    * ``help``: Dict mapping argument names to their help strings. Will be
+      displayed in ``--help`` output. For arguments containing underscores
+      (which are transformed into dashes on the CLI by default), either the
+      dashed or underscored version may be supplied here.
+    * ``pre``, ``post``: Lists of task objects to execute prior to, or after,
+      the wrapped task whenever it is executed.
+    * ``autoprint``: Boolean determining whether to automatically print this
+      task's return value to standard output when invoked directly via the CLI.
+      Defaults to False.
+    * ``klass``: Class to instantiate/return. Defaults to `.Task`.
+
+    If any non-keyword arguments are given, they are taken as the value of the
+    ``pre`` kwarg for convenience's sake. (It is an error to give both
+    ``*args`` and ``pre`` at the same time.)
+
+    .. versionadded:: 1.0
+    .. versionchanged:: 1.1
+        Added the ``klass`` keyword argument.
+    """
+    klass: Type[Task] = kwargs.pop("klass", Task)
+    # @task -- no options were (probably) given.
+    if len(args) == 1 and callable(args[0]) and not isinstance(args[0], Task):
+        return klass(args[0], **kwargs)
+    # @task(pre, tasks, here)
+    if args:
+        if "pre" in kwargs:
+            raise TypeError(
+                "May not give *args and 'pre' kwarg simultaneously!"
+            )
+        kwargs["pre"] = args
+
+    def inner(body: Callable) -> Task[T]:
+        _task = klass(body, **kwargs)
+        return _task
+
+    # update_wrapper(inner, klass)
+    return inner
+
+
+class Call:
+    """
+    Represents a call/execution of a `.Task` with given (kw)args.
+
+    Similar to `~functools.partial` with some added functionality (such as the
+    delegation to the inner task, and optional tracking of the name it's being
+    called by.)
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(
+        self,
+        task: "Task",
+        called_as: Optional[str] = None,
+        args: Optional[Tuple[str, ...]] = None,
+        kwargs: Optional[Dict[str, Any]] = None,
+    ) -> None:
+        """
+        Create a new `.Call` object.
+
+        :param task: The `.Task` object to be executed.
+
+        :param str called_as:
+            The name the task is being called as, e.g. if it was called by an
+            alias or other rebinding. Defaults to ``None``, aka, the task was
+            referred to by its default name.
+
+        :param tuple args:
+            Positional arguments to call with, if any. Default: ``None``.
+
+        :param dict kwargs:
+            Keyword arguments to call with, if any. Default: ``None``.
+        """
+        self.task = task
+        self.called_as = called_as
+        self.args = args or tuple()
+        self.kwargs = kwargs or dict()
+
+    # TODO: just how useful is this? feels like maybe overkill magic
+    def __getattr__(self, name: str) -> Any:
+        return getattr(self.task, name)
+
+    def __deepcopy__(self, memo: object) -> "Call":
+        return self.clone()
+
+    def __repr__(self) -> str:
+        aka = ""
+        if self.called_as is not None and self.called_as != self.task.name:
+            aka = " (called as: {!r})".format(self.called_as)
+        return "<{} {!r}{}, args: {!r}, kwargs: {!r}>".format(
+            self.__class__.__name__,
+            self.task.name,
+            aka,
+            self.args,
+            self.kwargs,
+        )
+
+    def __eq__(self, other: object) -> bool:
+        # NOTE: Not comparing 'called_as'; a named call of a given Task with
+        # same args/kwargs should be considered same as an unnamed call of the
+        # same Task with the same args/kwargs (e.g. pre/post task specified w/o
+        # name). Ditto tasks with multiple aliases.
+        for attr in "task args kwargs".split():
+            if getattr(self, attr) != getattr(other, attr):
+                return False
+        return True
+
+    def make_context(self, config: "Config") -> Context:
+        """
+        Generate a `.Context` appropriate for this call, with given config.
+
+        .. versionadded:: 1.0
+        """
+        return Context(config=config)
+
+    def clone_data(self) -> Dict[str, Any]:
+        """
+        Return keyword args suitable for cloning this call into another.
+
+        .. versionadded:: 1.1
+        """
+        return dict(
+            task=self.task,
+            called_as=self.called_as,
+            args=deepcopy(self.args),
+            kwargs=deepcopy(self.kwargs),
+        )
+
+    def clone(
+        self,
+        into: Optional[Type["Call"]] = None,
+        with_: Optional[Dict[str, Any]] = None,
+    ) -> "Call":
+        """
+        Return a standalone copy of this Call.
+
+        Useful when parameterizing task executions.
+
+        :param into:
+            A subclass to generate instead of the current class. Optional.
+
+        :param dict with_:
+            A dict of additional keyword arguments to use when creating the new
+            clone; typically used when cloning ``into`` a subclass that has
+            extra args on top of the base class. Optional.
+
+            .. note::
+                This dict is used to ``.update()`` the original object's data
+                (the return value from its `clone_data`), so in the event of
+                a conflict, values in ``with_`` will win out.
+
+        .. versionadded:: 1.0
+        .. versionchanged:: 1.1
+            Added the ``with_`` kwarg.
+        """
+        klass = into if into is not None else self.__class__
+        data = self.clone_data()
+        if with_ is not None:
+            data.update(with_)
+        return klass(**data)
+
+
+def call(task: "Task", *args: Any, **kwargs: Any) -> "Call":
+    """
+    Describes execution of a `.Task`, typically with pre-supplied arguments.
+
+    Useful for setting up :ref:`pre/post task invocations
+    <parameterizing-pre-post-tasks>`. It's actually just a convenient wrapper
+    around the `.Call` class, which may be used directly instead if desired.
+
+    For example, here's two build-like tasks that both refer to a ``setup``
+    pre-task, one with no baked-in argument values (and thus no need to use
+    `.call`), and one that toggles a boolean flag::
+
+        @task
+        def setup(c, clean=False):
+            if clean:
+                c.run("rm -rf target")
+            # ... setup things here ...
+            c.run("tar czvf target.tgz target")
+
+        @task(pre=[setup])
+        def build(c):
+            c.run("build, accounting for leftover files...")
+
+        @task(pre=[call(setup, clean=True)])
+        def clean_build(c):
+            c.run("build, assuming clean slate...")
+
+    Please see the constructor docs for `.Call` for details - this function's
+    ``args`` and ``kwargs`` map directly to the same arguments as in that
+    method.
+
+    .. versionadded:: 1.0
+    """
+    return Call(task, args=args, kwargs=kwargs)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/terminals.py b/TP03/TP03/lib/python3.9/site-packages/invoke/terminals.py
new file mode 100644
index 0000000000000000000000000000000000000000..2694712fa481655845180f927093393f49ee67df
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/terminals.py
@@ -0,0 +1,247 @@
+"""
+Utility functions surrounding terminal devices & I/O.
+
+Much of this code performs platform-sensitive branching, e.g. Windows support.
+
+This is its own module to abstract away what would otherwise be distracting
+logic-flow interruptions.
+"""
+
+from contextlib import contextmanager
+from typing import Generator, IO, Optional, Tuple
+import os
+import select
+import sys
+
+# TODO: move in here? They're currently platform-agnostic...
+from .util import has_fileno, isatty
+
+
+WINDOWS = sys.platform == "win32"
+"""
+Whether or not the current platform appears to be Windows in nature.
+
+Note that Cygwin's Python is actually close enough to "real" UNIXes that it
+doesn't need (or want!) to use PyWin32 -- so we only test for literal Win32
+setups (vanilla Python, ActiveState etc) here.
+
+.. versionadded:: 1.0
+"""
+
+if sys.platform == "win32":
+    import msvcrt
+    from ctypes import (
+        Structure,
+        c_ushort,
+        windll,
+        POINTER,
+        byref,
+    )
+    from ctypes.wintypes import HANDLE, _COORD, _SMALL_RECT
+else:
+    import fcntl
+    import struct
+    import termios
+    import tty
+
+
+if sys.platform == "win32":
+
+    def _pty_size() -> Tuple[Optional[int], Optional[int]]:
+        class CONSOLE_SCREEN_BUFFER_INFO(Structure):
+            _fields_ = [
+                ("dwSize", _COORD),
+                ("dwCursorPosition", _COORD),
+                ("wAttributes", c_ushort),
+                ("srWindow", _SMALL_RECT),
+                ("dwMaximumWindowSize", _COORD),
+            ]
+
+        GetStdHandle = windll.kernel32.GetStdHandle
+        GetConsoleScreenBufferInfo = windll.kernel32.GetConsoleScreenBufferInfo
+        GetStdHandle.restype = HANDLE
+        GetConsoleScreenBufferInfo.argtypes = [
+            HANDLE,
+            POINTER(CONSOLE_SCREEN_BUFFER_INFO),
+        ]
+
+        hstd = GetStdHandle(-11)  # STD_OUTPUT_HANDLE = -11
+        csbi = CONSOLE_SCREEN_BUFFER_INFO()
+        ret = GetConsoleScreenBufferInfo(hstd, byref(csbi))
+
+        if ret:
+            sizex = csbi.srWindow.Right - csbi.srWindow.Left + 1
+            sizey = csbi.srWindow.Bottom - csbi.srWindow.Top + 1
+            return sizex, sizey
+        else:
+            return (None, None)
+
+else:
+
+    def _pty_size() -> Tuple[Optional[int], Optional[int]]:
+        """
+        Suitable for most POSIX platforms.
+
+        .. versionadded:: 1.0
+        """
+        # Sentinel values to be replaced w/ defaults by caller
+        size = (None, None)
+        # We want two short unsigned integers (rows, cols)
+        fmt = "HH"
+        # Create an empty (zeroed) buffer for ioctl to map onto. Yay for C!
+        buf = struct.pack(fmt, 0, 0)
+        # Call TIOCGWINSZ to get window size of stdout, returns our filled
+        # buffer
+        try:
+            result = fcntl.ioctl(sys.stdout, termios.TIOCGWINSZ, buf)
+            # Unpack buffer back into Python data types
+            # NOTE: this unpack gives us rows x cols, but we return the
+            # inverse.
+            rows, cols = struct.unpack(fmt, result)
+            return (cols, rows)
+        # Fallback to emptyish return value in various failure cases:
+        # * sys.stdout being monkeypatched, such as in testing, and lacking
+        # * .fileno
+        # * sys.stdout having a .fileno but not actually being attached to a
+        # * TTY
+        # * termios not having a TIOCGWINSZ attribute (happens sometimes...)
+        # * other situations where ioctl doesn't explode but the result isn't
+        #   something unpack can deal with
+        except (struct.error, TypeError, IOError, AttributeError):
+            pass
+        return size
+
+
+def pty_size() -> Tuple[int, int]:
+    """
+    Determine current local pseudoterminal dimensions.
+
+    :returns:
+        A ``(num_cols, num_rows)`` two-tuple describing PTY size. Defaults to
+        ``(80, 24)`` if unable to get a sensible result dynamically.
+
+    .. versionadded:: 1.0
+    """
+    cols, rows = _pty_size()
+    # TODO: make defaults configurable?
+    return (cols or 80, rows or 24)
+
+
+def stdin_is_foregrounded_tty(stream: IO) -> bool:
+    """
+    Detect if given stdin ``stream`` seems to be in the foreground of a TTY.
+
+    Specifically, compares the current Python process group ID to that of the
+    stream's file descriptor to see if they match; if they do not match, it is
+    likely that the process has been placed in the background.
+
+    This is used as a test to determine whether we should manipulate an active
+    stdin so it runs in a character-buffered mode; touching the terminal in
+    this way when the process is backgrounded, causes most shells to pause
+    execution.
+
+    .. note::
+        Processes that aren't attached to a terminal to begin with, will always
+        fail this test, as it starts with "do you have a real ``fileno``?".
+
+    .. versionadded:: 1.0
+    """
+    if not has_fileno(stream):
+        return False
+    return os.getpgrp() == os.tcgetpgrp(stream.fileno())
+
+
+def cbreak_already_set(stream: IO) -> bool:
+    # Explicitly not docstringed to remain private, for now. Eh.
+    # Checks whether tty.setcbreak appears to have already been run against
+    # ``stream`` (or if it would otherwise just not do anything).
+    # Used to effect idempotency for character-buffering a stream, which also
+    # lets us avoid multiple capture-then-restore cycles.
+    attrs = termios.tcgetattr(stream)
+    lflags, cc = attrs[3], attrs[6]
+    echo = bool(lflags & termios.ECHO)
+    icanon = bool(lflags & termios.ICANON)
+    # setcbreak sets ECHO and ICANON to 0/off, CC[VMIN] to 1-ish, and CC[VTIME]
+    # to 0-ish. If any of that is not true we can reasonably assume it has not
+    # yet been executed against this stream.
+    sentinels = (
+        not echo,
+        not icanon,
+        cc[termios.VMIN] in [1, b"\x01"],
+        cc[termios.VTIME] in [0, b"\x00"],
+    )
+    return all(sentinels)
+
+
+@contextmanager
+def character_buffered(
+    stream: IO,
+) -> Generator[None, None, None]:
+    """
+    Force local terminal ``stream`` be character, not line, buffered.
+
+    Only applies to Unix-based systems; on Windows this is a no-op.
+
+    .. versionadded:: 1.0
+    """
+    if (
+        WINDOWS
+        or not isatty(stream)
+        or not stdin_is_foregrounded_tty(stream)
+        or cbreak_already_set(stream)
+    ):
+        yield
+    else:
+        old_settings = termios.tcgetattr(stream)
+        tty.setcbreak(stream)
+        try:
+            yield
+        finally:
+            termios.tcsetattr(stream, termios.TCSADRAIN, old_settings)
+
+
+def ready_for_reading(input_: IO) -> bool:
+    """
+    Test ``input_`` to determine whether a read action will succeed.
+
+    :param input_: Input stream object (file-like).
+
+    :returns: ``True`` if a read should succeed, ``False`` otherwise.
+
+    .. versionadded:: 1.0
+    """
+    # A "real" terminal stdin needs select/kbhit to tell us when it's ready for
+    # a nonblocking read().
+    # Otherwise, assume a "safer" file-like object that can be read from in a
+    # nonblocking fashion (e.g. a StringIO or regular file).
+    if not has_fileno(input_):
+        return True
+    if sys.platform == "win32":
+        return msvcrt.kbhit()
+    else:
+        reads, _, _ = select.select([input_], [], [], 0.0)
+        return bool(reads and reads[0] is input_)
+
+
+def bytes_to_read(input_: IO) -> int:
+    """
+    Query stream ``input_`` to see how many bytes may be readable.
+
+    .. note::
+        If we are unable to tell (e.g. if ``input_`` isn't a true file
+        descriptor or isn't a valid TTY) we fall back to suggesting reading 1
+        byte only.
+
+    :param input: Input stream object (file-like).
+
+    :returns: `int` number of bytes to read.
+
+    .. versionadded:: 1.0
+    """
+    # NOTE: we have to check both possibilities here; situations exist where
+    # it's not a tty but has a fileno, or vice versa; neither is typically
+    # going to work re: ioctl().
+    if not WINDOWS and isatty(input_) and has_fileno(input_):
+        fionread = fcntl.ioctl(input_, termios.FIONREAD, b"  ")
+        return int(struct.unpack("h", fionread)[0])
+    return 1
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/util.py b/TP03/TP03/lib/python3.9/site-packages/invoke/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..df29c841af2e619bb15cbdfebb604f9421bf847e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/util.py
@@ -0,0 +1,268 @@
+from collections import namedtuple
+from contextlib import contextmanager
+from types import TracebackType
+from typing import Any, Generator, List, IO, Optional, Tuple, Type, Union
+import io
+import logging
+import os
+import threading
+import sys
+
+# NOTE: This is the canonical location for commonly-used vendored modules,
+# which is the only spot that performs this try/except to allow repackaged
+# Invoke to function (e.g. distro packages which unvendor the vendored bits and
+# thus must import our 'vendored' stuff from the overall environment.)
+# All other uses of Lexicon, etc should do 'from .util import lexicon' etc.
+# Saves us from having to update the same logic in a dozen places.
+# TODO: would this make more sense to put _into_ invoke.vendor? That way, the
+# import lines which now read 'from .util import <third party stuff>' would be
+# more obvious. Requires packagers to leave invoke/vendor/__init__.py alone tho
+try:
+    from .vendor.lexicon import Lexicon  # noqa
+    from .vendor import yaml  # noqa
+except ImportError:
+    from lexicon import Lexicon  # type: ignore[no-redef] # noqa
+    import yaml  # type: ignore[no-redef] # noqa
+
+
+LOG_FORMAT = "%(name)s.%(module)s.%(funcName)s: %(message)s"
+
+
+def enable_logging() -> None:
+    logging.basicConfig(level=logging.DEBUG, format=LOG_FORMAT)
+
+
+# Allow from-the-start debugging (vs toggled during load of tasks module) via
+# shell env var.
+if os.environ.get("INVOKE_DEBUG"):
+    enable_logging()
+
+# Add top level logger functions to global namespace. Meh.
+log = logging.getLogger("invoke")
+debug = log.debug
+
+
+def task_name_sort_key(name: str) -> Tuple[List[str], str]:
+    """
+    Return key tuple for use sorting dotted task names, via e.g. `sorted`.
+
+    .. versionadded:: 1.0
+    """
+    parts = name.split(".")
+    return (
+        # First group/sort by non-leaf path components. This keeps everything
+        # grouped in its hierarchy, and incidentally puts top-level tasks
+        # (whose non-leaf path set is the empty list) first, where we want them
+        parts[:-1],
+        # Then we sort lexicographically by the actual task name
+        parts[-1],
+    )
+
+
+# TODO: Make part of public API sometime
+@contextmanager
+def cd(where: str) -> Generator[None, None, None]:
+    cwd = os.getcwd()
+    os.chdir(where)
+    try:
+        yield
+    finally:
+        os.chdir(cwd)
+
+
+def has_fileno(stream: IO) -> bool:
+    """
+    Cleanly determine whether ``stream`` has a useful ``.fileno()``.
+
+    .. note::
+        This function helps determine if a given file-like object can be used
+        with various terminal-oriented modules and functions such as `select`,
+        `termios`, and `tty`. For most of those, a fileno is all that is
+        required; they'll function even if ``stream.isatty()`` is ``False``.
+
+    :param stream: A file-like object.
+
+    :returns:
+        ``True`` if ``stream.fileno()`` returns an integer, ``False`` otherwise
+        (this includes when ``stream`` lacks a ``fileno`` method).
+
+    .. versionadded:: 1.0
+    """
+    try:
+        return isinstance(stream.fileno(), int)
+    except (AttributeError, io.UnsupportedOperation):
+        return False
+
+
+def isatty(stream: IO) -> Union[bool, Any]:
+    """
+    Cleanly determine whether ``stream`` is a TTY.
+
+    Specifically, first try calling ``stream.isatty()``, and if that fails
+    (e.g. due to lacking the method entirely) fallback to `os.isatty`.
+
+    .. note::
+        Most of the time, we don't actually care about true TTY-ness, but
+        merely whether the stream seems to have a fileno (per `has_fileno`).
+        However, in some cases (notably the use of `pty.fork` to present a
+        local pseudoterminal) we need to tell if a given stream has a valid
+        fileno but *isn't* tied to an actual terminal. Thus, this function.
+
+    :param stream: A file-like object.
+
+    :returns:
+        A boolean depending on the result of calling ``.isatty()`` and/or
+        `os.isatty`.
+
+    .. versionadded:: 1.0
+    """
+    # If there *is* an .isatty, ask it.
+    if hasattr(stream, "isatty") and callable(stream.isatty):
+        return stream.isatty()
+    # If there wasn't, see if it has a fileno, and if so, ask os.isatty
+    elif has_fileno(stream):
+        return os.isatty(stream.fileno())
+    # If we got here, none of the above worked, so it's reasonable to assume
+    # the darn thing isn't a real TTY.
+    return False
+
+
+def helpline(obj: object) -> Optional[str]:
+    """
+    Yield an object's first docstring line, or None if there was no docstring.
+
+    .. versionadded:: 1.0
+    """
+    docstring = obj.__doc__
+    if (
+        not docstring
+        or not docstring.strip()
+        or docstring == type(obj).__doc__
+    ):
+        return None
+    return docstring.lstrip().splitlines()[0]
+
+
+class ExceptionHandlingThread(threading.Thread):
+    """
+    Thread handler making it easier for parent to handle thread exceptions.
+
+    Based in part on Fabric 1's ThreadHandler. See also Fabric GH issue #204.
+
+    When used directly, can be used in place of a regular ``threading.Thread``.
+    If subclassed, the subclass must do one of:
+
+    - supply ``target`` to ``__init__``
+    - define ``_run()`` instead of ``run()``
+
+    This is because this thread's entire point is to wrap behavior around the
+    thread's execution; subclasses could not redefine ``run()`` without
+    breaking that functionality.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, **kwargs: Any) -> None:
+        """
+        Create a new exception-handling thread instance.
+
+        Takes all regular `threading.Thread` keyword arguments, via
+        ``**kwargs`` for easier display of thread identity when raising
+        captured exceptions.
+        """
+        super().__init__(**kwargs)
+        # No record of why, but Fabric used daemon threads ever since the
+        # switch from select.select, so let's keep doing that.
+        self.daemon = True
+        # Track exceptions raised in run()
+        self.kwargs = kwargs
+        # TODO: legacy cruft that needs to be removed
+        self.exc_info: Optional[
+            Union[
+                Tuple[Type[BaseException], BaseException, TracebackType],
+                Tuple[None, None, None],
+            ]
+        ] = None
+
+    def run(self) -> None:
+        try:
+            # Allow subclasses implemented using the "override run()'s body"
+            # approach to work, by using _run() instead of run(). If that
+            # doesn't appear to be the case, then assume we're being used
+            # directly and just use super() ourselves.
+            # XXX https://github.com/python/mypy/issues/1424
+            if hasattr(self, "_run") and callable(self._run):  # type: ignore
+                # TODO: this could be:
+                # - io worker with no 'result' (always local)
+                # - tunnel worker, also with no 'result' (also always local)
+                # - threaded concurrent run(), sudo(), put(), etc, with a
+                # result (not necessarily local; might want to be a subproc or
+                # whatever eventually)
+                # TODO: so how best to conditionally add a "capture result
+                # value of some kind"?
+                # - update so all use cases use subclassing, add functionality
+                # alongside self.exception() that is for the result of _run()
+                # - split out class that does not care about result of _run()
+                # and let it continue acting like a normal thread (meh)
+                # - assume the run/sudo/etc case will use a queue inside its
+                # worker body, orthogonal to how exception handling works
+                self._run()  # type: ignore
+            else:
+                super().run()
+        except BaseException:
+            # Store for actual reraising later
+            self.exc_info = sys.exc_info()
+            # And log now, in case we never get to later (e.g. if executing
+            # program is hung waiting for us to do something)
+            msg = "Encountered exception {!r} in thread for {!r}"
+            # Name is either target function's dunder-name, or just "_run" if
+            # we were run subclass-wise.
+            name = "_run"
+            if "target" in self.kwargs:
+                name = self.kwargs["target"].__name__
+            debug(msg.format(self.exc_info[1], name))  # noqa
+
+    def exception(self) -> Optional["ExceptionWrapper"]:
+        """
+        If an exception occurred, return an `.ExceptionWrapper` around it.
+
+        :returns:
+            An `.ExceptionWrapper` managing the result of `sys.exc_info`, if an
+            exception was raised during thread execution. If no exception
+            occurred, returns ``None`` instead.
+
+        .. versionadded:: 1.0
+        """
+        if self.exc_info is None:
+            return None
+        return ExceptionWrapper(self.kwargs, *self.exc_info)
+
+    @property
+    def is_dead(self) -> bool:
+        """
+        Returns ``True`` if not alive and has a stored exception.
+
+        Used to detect threads that have excepted & shut down.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: it seems highly unlikely that a thread could still be
+        # is_alive() but also have encountered an exception. But hey. Why not
+        # be thorough?
+        return (not self.is_alive()) and self.exc_info is not None
+
+    def __repr__(self) -> str:
+        # TODO: beef this up more
+        return str(self.kwargs["target"].__name__)
+
+
+# NOTE: ExceptionWrapper defined here, not in exceptions.py, to avoid circular
+# dependency issues (e.g. Failure subclasses need to use some bits from this
+# module...)
+#: A namedtuple wrapping a thread-borne exception & that thread's arguments.
+#: Mostly used as an intermediate between `.ExceptionHandlingThread` (which
+#: preserves initial exceptions) and `.ThreadException` (which holds 1..N such
+#: exceptions, as typically multiple threads are involved.)
+ExceptionWrapper = namedtuple(
+    "ExceptionWrapper", "kwargs type value traceback"
+)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4d8721caabd49c8ba611688017d7a74f8f8d6ff5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..3339fefb3a4a1cfa92441cd8d0ed55c34b769e1d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__init__.py
@@ -0,0 +1,4 @@
+from .machine import (StateMachine, state, transition,
+                               InvalidConfiguration, InvalidTransition,
+                               GuardNotSatisfied, ForkedTransition)
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..80100dd252f5aa8aae12d8cb17ef0e9b9fcbee0c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a70a7d6357290251ade33e2dc2c92c0eb903cbc4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/backwardscompat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/machine.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/machine.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..edbab48a130f223f73271cdb6b4251abac447cd4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/__pycache__/machine.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/backwardscompat.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/backwardscompat.py
new file mode 100644
index 0000000000000000000000000000000000000000..88eac4f6f7b2c60f12611380a1ecaf1cebb590ee
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/backwardscompat.py
@@ -0,0 +1,8 @@
+import sys
+
+if sys.version_info >= (3,):
+    def callable(obj):
+        return hasattr(obj, '__call__')
+else:
+    callable = callable
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/machine.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/machine.py
new file mode 100644
index 0000000000000000000000000000000000000000..da9fdda0d672d2b6b174eb4e336f8f1aab7063dc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/fluidity/machine.py
@@ -0,0 +1,270 @@
+import re
+import inspect
+from .backwardscompat import callable
+
+# metaclass implementation idea from
+# http://blog.ianbicking.org/more-on-python-metaprogramming-comment-14.html
+_transition_gatherer = []
+
+def transition(event, from_, to, action=None, guard=None):
+    _transition_gatherer.append([event, from_, to, action, guard])
+
+_state_gatherer = []
+
+def state(name, enter=None, exit=None):
+    _state_gatherer.append([name, enter, exit])
+
+
+class MetaStateMachine(type):
+
+    def __new__(cls, name, bases, dictionary):
+        global _transition_gatherer, _state_gatherer
+        Machine = super(MetaStateMachine, cls).__new__(cls, name, bases, dictionary)
+        Machine._class_transitions = []
+        Machine._class_states = {}
+        for s in _state_gatherer:
+            Machine._add_class_state(*s)
+        for i in _transition_gatherer:
+            Machine._add_class_transition(*i)
+        _transition_gatherer = []
+        _state_gatherer = []
+        return Machine
+
+
+StateMachineBase = MetaStateMachine('StateMachineBase', (object, ), {})
+
+
+class StateMachine(StateMachineBase):
+
+    def __init__(self):
+        self._bring_definitions_to_object_level()
+        self._inject_into_parts()
+        self._validate_machine_definitions()
+        if callable(self.initial_state):
+            self.initial_state = self.initial_state()
+        self._current_state_object = self._state_by_name(self.initial_state)
+        self._current_state_object.run_enter(self)
+        self._create_state_getters()
+
+    def __new__(cls, *args, **kwargs):
+        obj = super(StateMachine, cls).__new__(cls)
+        obj._states = {}
+        obj._transitions = []
+        return obj
+
+    def _bring_definitions_to_object_level(self):
+        self._states.update(self.__class__._class_states)
+        self._transitions.extend(self.__class__._class_transitions)
+
+    def _inject_into_parts(self):
+        for collection in [self._states.values(), self._transitions]:
+            for component in collection:
+                component.machine = self
+
+    def _validate_machine_definitions(self):
+        if len(self._states) < 2:
+            raise InvalidConfiguration('There must be at least two states')
+        if not getattr(self, 'initial_state', None):
+            raise InvalidConfiguration('There must exist an initial state')
+
+    @classmethod
+    def _add_class_state(cls, name, enter, exit):
+        cls._class_states[name] = _State(name, enter, exit)
+
+    def add_state(self, name, enter=None, exit=None):
+        state = _State(name, enter, exit)
+        setattr(self, state.getter_name(), state.getter_method().__get__(self, self.__class__))
+        self._states[name] = state
+
+    def _current_state_name(self):
+        return self._current_state_object.name
+
+    current_state = property(_current_state_name)
+
+    def changing_state(self, from_, to):
+        """
+        This method is called whenever a state change is executed
+        """
+        pass
+
+    def _new_state(self, state):
+        self.changing_state(self._current_state_object.name, state.name)
+        self._current_state_object = state
+
+    def _state_objects(self):
+        return list(self._states.values())
+
+    def states(self):
+        return [s.name for s in self._state_objects()]
+
+    @classmethod
+    def _add_class_transition(cls, event, from_, to, action, guard):
+        transition = _Transition(event, [cls._class_states[s] for s in _listize(from_)],
+            cls._class_states[to], action, guard)
+        cls._class_transitions.append(transition)
+        setattr(cls, event, transition.event_method())
+
+    def add_transition(self, event, from_, to, action=None, guard=None):
+        transition = _Transition(event, [self._state_by_name(s) for s in _listize(from_)],
+            self._state_by_name(to), action, guard)
+        self._transitions.append(transition)
+        setattr(self, event, transition.event_method().__get__(self, self.__class__))
+
+    def _process_transitions(self, event_name, *args, **kwargs):
+        transitions = self._transitions_by_name(event_name)
+        transitions = self._ensure_from_validity(transitions)
+        this_transition = self._check_guards(transitions)
+        this_transition.run(self, *args, **kwargs)
+
+    def _create_state_getters(self):
+        for state in self._state_objects():
+            setattr(self, state.getter_name(), state.getter_method().__get__(self, self.__class__))
+
+    def _state_by_name(self, name):
+        for state in self._state_objects():
+            if state.name == name:
+                return state
+
+    def _transitions_by_name(self, name):
+        return list(filter(lambda transition: transition.event == name, self._transitions))
+
+    def _ensure_from_validity(self, transitions):
+        valid_transitions = list(filter(
+          lambda transition: transition.is_valid_from(self._current_state_object),
+          transitions))
+        if len(valid_transitions) == 0:
+            raise InvalidTransition("Cannot %s from %s" % (
+                transitions[0].event, self.current_state))
+        return valid_transitions
+
+    def _check_guards(self, transitions):
+        allowed_transitions = []
+        for transition in transitions:
+            if transition.check_guard(self):
+                allowed_transitions.append(transition)
+        if len(allowed_transitions) == 0:
+            raise GuardNotSatisfied("Guard is not satisfied for this transition")
+        elif len(allowed_transitions) > 1:
+            raise ForkedTransition("More than one transition was allowed for this event")
+        return allowed_transitions[0]
+
+
+class _Transition(object):
+
+    def __init__(self, event, from_, to, action, guard):
+        self.event = event
+        self.from_ = from_
+        self.to = to
+        self.action = action
+        self.guard = _Guard(guard)
+
+    def event_method(self):
+        def generated_event(machine, *args, **kwargs):
+            these_transitions = machine._process_transitions(self.event, *args, **kwargs)
+        generated_event.__doc__ = 'event %s' % self.event
+        generated_event.__name__ = self.event
+        return generated_event
+
+    def is_valid_from(self, from_):
+        return from_ in _listize(self.from_)
+
+    def check_guard(self, machine):
+        return self.guard.check(machine)
+
+    def run(self, machine, *args, **kwargs):
+        machine._current_state_object.run_exit(machine)
+        machine._new_state(self.to)
+        self.to.run_enter(machine)
+        _ActionRunner(machine).run(self.action, *args, **kwargs)
+
+
+class _Guard(object):
+
+    def __init__(self, action):
+        self.action = action
+
+    def check(self, machine):
+        if self.action is None:
+            return True
+        items = _listize(self.action)
+        result = True
+        for item in items:
+            result = result and self._evaluate(machine, item)
+        return result
+
+    def _evaluate(self, machine, item):
+        if callable(item):
+            return item(machine)
+        else:
+            guard = getattr(machine, item)
+            if callable(guard):
+                guard = guard()
+            return guard
+
+
+class _State(object):
+
+    def __init__(self, name, enter, exit):
+        self.name = name
+        self.enter = enter
+        self.exit = exit
+
+    def getter_name(self):
+        return 'is_%s' % self.name
+
+    def getter_method(self):
+        def state_getter(self_machine):
+            return self_machine.current_state == self.name
+        return state_getter
+
+    def run_enter(self, machine):
+        _ActionRunner(machine).run(self.enter)
+
+    def run_exit(self, machine):
+        _ActionRunner(machine).run(self.exit)
+
+
+class _ActionRunner(object):
+
+    def __init__(self, machine):
+        self.machine = machine
+
+    def run(self, action_param, *args, **kwargs):
+        if not action_param:
+            return
+        action_items = _listize(action_param)
+        for action_item in action_items:
+            self._run_action(action_item, *args, **kwargs)
+
+    def _run_action(self, action, *args, **kwargs):
+        if callable(action):
+            self._try_to_run_with_args(action, self.machine, *args, **kwargs)
+        else:
+            self._try_to_run_with_args(getattr(self.machine, action), *args, **kwargs)
+
+    def _try_to_run_with_args(self, action, *args, **kwargs):
+        try:
+            action(*args, **kwargs)
+        except TypeError:
+            action()
+
+
+class InvalidConfiguration(Exception):
+    pass
+
+
+class InvalidTransition(Exception):
+    pass
+
+
+class GuardNotSatisfied(Exception):
+    pass
+
+
+class ForkedTransition(Exception):
+    pass
+
+
+def _listize(value):
+    return type(value) in [list, tuple] and value or [value]
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c7f65d31ac60cc888d4ad287f9304b439aa9add5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__init__.py
@@ -0,0 +1,24 @@
+from ._version import __version_info__, __version__  # noqa
+from .attribute_dict import AttributeDict
+from .alias_dict import AliasDict
+
+
+class Lexicon(AttributeDict, AliasDict):
+    def __init__(self, *args, **kwargs):
+        # Need to avoid combining AliasDict's initial attribute write on
+        # self.aliases, with AttributeDict's __setattr__. Doing so results in
+        # an infinite loop. Instead, just skip straight to dict() for both
+        # explicitly (i.e. we override AliasDict.__init__ instead of extending
+        # it.)
+        # NOTE: could tickle AttributeDict.__init__ instead, in case it ever
+        # grows one.
+        dict.__init__(self, *args, **kwargs)
+        dict.__setattr__(self, "aliases", {})
+
+    def __getattr__(self, key):
+        # Intercept deepcopy/etc driven access to self.aliases when not
+        # actually set. (Only a problem for us, due to abovementioned combo of
+        # Alias and Attribute Dicts, so not solvable in a parent alone.)
+        if key == "aliases" and key not in self.__dict__:
+            self.__dict__[key] = {}
+        return super(Lexicon, self).__getattr__(key)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0f7a023d7cfe60909455eba418f236f39ab058c7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/_version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/_version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0319ba084da9502e819f4d06478fc9db6052ddd9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/_version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/alias_dict.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/alias_dict.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..37235ae66c810862d04522db37e61f6f80422bfc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/alias_dict.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..21c24e4e16b0e15b7e6c02b79875e9afcbc60b40
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/__pycache__/attribute_dict.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/_version.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..f55a4f181c249fc1cd7ba7cfa7094b37f6afc26b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/_version.py
@@ -0,0 +1,2 @@
+__version_info__ = (2, 0, 1)
+__version__ = ".".join(map(str, __version_info__))
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/alias_dict.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/alias_dict.py
new file mode 100644
index 0000000000000000000000000000000000000000..f2191fb9ff1d158ae597c562ab82afe859f9e867
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/alias_dict.py
@@ -0,0 +1,95 @@
+class AliasDict(dict):
+    def __init__(self, *args, **kwargs):
+        super(AliasDict, self).__init__(*args, **kwargs)
+        self.aliases = {}
+
+    def alias(self, from_, to):
+        self.aliases[from_] = to
+
+    def unalias(self, from_):
+        del self.aliases[from_]
+
+    def aliases_of(self, name):
+        """
+        Returns other names for given real key or alias ``name``.
+
+        If given a real key, returns its aliases.
+
+        If given an alias, returns the real key it points to, plus any other
+        aliases of that real key. (The given alias itself is not included in
+        the return value.)
+        """
+        names = []
+        key = name
+        # self.aliases keys are aliases, not realkeys. Easy test to see if we
+        # should flip around to the POV of a realkey when given an alias.
+        if name in self.aliases:
+            key = self.aliases[name]
+            # Ensure the real key shows up in output.
+            names.append(key)
+        # 'key' is now a realkey, whose aliases are all keys whose value is
+        # itself. Filter out the original name given.
+        names.extend(
+            [k for k, v in self.aliases.items() if v == key and k != name]
+        )
+        return names
+
+    def _handle(self, key, value, single, multi, unaliased):
+        # Attribute existence test required to not blow up when deepcopy'd
+        if key in getattr(self, "aliases", {}):
+            target = self.aliases[key]
+            # Single-string targets
+            if isinstance(target, str):
+                return single(self, target, value)
+            # Multi-string targets
+            else:
+                if multi:
+                    return multi(self, target, value)
+                else:
+                    for subkey in target:
+                        single(self, subkey, value)
+        else:
+            return unaliased(self, key, value)
+
+    def __setitem__(self, key, value):
+        def single(d, target, value):
+            d[target] = value
+
+        def unaliased(d, key, value):
+            super(AliasDict, d).__setitem__(key, value)
+
+        return self._handle(key, value, single, None, unaliased)
+
+    def __getitem__(self, key):
+        def single(d, target, value):
+            return d[target]
+
+        def unaliased(d, key, value):
+            return super(AliasDict, d).__getitem__(key)
+
+        def multi(d, target, value):
+            msg = "Multi-target aliases have no well-defined value and can't be read."  # noqa
+            raise ValueError(msg)
+
+        return self._handle(key, None, single, multi, unaliased)
+
+    def __contains__(self, key):
+        def single(d, target, value):
+            return target in d
+
+        def multi(d, target, value):
+            return all(subkey in self for subkey in self.aliases[key])
+
+        def unaliased(d, key, value):
+            return super(AliasDict, d).__contains__(key)
+
+        return self._handle(key, None, single, multi, unaliased)
+
+    def __delitem__(self, key):
+        def single(d, target, value):
+            del d[target]
+
+        def unaliased(d, key, value):
+            return super(AliasDict, d).__delitem__(key)
+
+        return self._handle(key, None, single, None, unaliased)
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/attribute_dict.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/attribute_dict.py
new file mode 100644
index 0000000000000000000000000000000000000000..5d09f13acb39d5505f25d2a3c0984bd5194851c6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/lexicon/attribute_dict.py
@@ -0,0 +1,16 @@
+class AttributeDict(dict):
+    def __getattr__(self, key):
+        try:
+            return self[key]
+        except KeyError:
+            # to conform with __getattr__ spec
+            raise AttributeError(key)
+
+    def __setattr__(self, key, value):
+        self[key] = value
+
+    def __delattr__(self, key):
+        del self[key]
+
+    def __dir__(self):
+        return dir(type(self)) + list(self.keys())
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__init__.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..86d07b5525d10bf1d543be0e1f5d01af897a4b49
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__init__.py
@@ -0,0 +1,427 @@
+
+from .error import *
+
+from .tokens import *
+from .events import *
+from .nodes import *
+
+from .loader import *
+from .dumper import *
+
+__version__ = '5.4.1'
+try:
+    from .cyaml import *
+    __with_libyaml__ = True
+except ImportError:
+    __with_libyaml__ = False
+
+import io
+
+#------------------------------------------------------------------------------
+# Warnings control
+#------------------------------------------------------------------------------
+
+# 'Global' warnings state:
+_warnings_enabled = {
+    'YAMLLoadWarning': True,
+}
+
+# Get or set global warnings' state
+def warnings(settings=None):
+    if settings is None:
+        return _warnings_enabled
+
+    if type(settings) is dict:
+        for key in settings:
+            if key in _warnings_enabled:
+                _warnings_enabled[key] = settings[key]
+
+# Warn when load() is called without Loader=...
+class YAMLLoadWarning(RuntimeWarning):
+    pass
+
+def load_warning(method):
+    if _warnings_enabled['YAMLLoadWarning'] is False:
+        return
+
+    import warnings
+
+    message = (
+        "calling yaml.%s() without Loader=... is deprecated, as the "
+        "default Loader is unsafe. Please read "
+        "https://msg.pyyaml.org/load for full details."
+    ) % method
+
+    warnings.warn(message, YAMLLoadWarning, stacklevel=3)
+
+#------------------------------------------------------------------------------
+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=None):
+    """
+    Parse the first YAML document in a stream
+    and produce the corresponding Python object.
+    """
+    if Loader is None:
+        load_warning('load')
+        Loader = FullLoader
+
+    loader = Loader(stream)
+    try:
+        return loader.get_single_data()
+    finally:
+        loader.dispose()
+
+def load_all(stream, Loader=None):
+    """
+    Parse all YAML documents in a stream
+    and produce corresponding Python objects.
+    """
+    if Loader is None:
+        load_warning('load_all')
+        Loader = FullLoader
+
+    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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..640e32220b8fb0d312ef76add7cbbd9b64a84e19
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/composer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/composer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..668903cbc6ac9a587c79eeb9042126581ba467af
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/composer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/constructor.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/constructor.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e0f87458ea7e4a1a6016698a917c90b37e4105f3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/constructor.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/cyaml.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/cyaml.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e09075281601daa9ea5c674c3a930f0027c19e1a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/cyaml.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/dumper.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/dumper.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fe056ca6977a7306f31100db20226733ff576fcc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/dumper.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/emitter.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/emitter.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..317cc3bc52ffe45e6c3bd40b56040f4294b08e2a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/emitter.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/error.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/error.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2107bb33db7f2015958222e813e06f57d940b896
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/error.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/events.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/events.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e0c1aad03e11a8493d723b6df485642670bd7737
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/events.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/loader.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/loader.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..72518251fa25d8bb49f1a505af1a0f6b1c268ddf
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/loader.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/nodes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/nodes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bec3c99f9a9662190738450aa98be29e95e75418
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/nodes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/parser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/parser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0a0b517a37cad67f3852a0f5f2f1708aff763438
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/parser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/reader.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/reader.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6f98ae81084666fa101016aeffc15a044e1ab25b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/reader.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/representer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/representer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1a4e3806f00159c5a947104497c87147324ecacb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/representer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/resolver.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/resolver.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0c1bcf5ce8371f5136ef813a9f0c60c0aeb7266f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/resolver.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/scanner.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/scanner.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd386452b8d7685cb1ada8f77280834c6ef21f56
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/scanner.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/serializer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/serializer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..290ef8b5e05fcb2e1af299cfe035b2de4e087029
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/serializer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/tokens.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/tokens.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2f662f612caf17464347d59435c0a12a3c5368a6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/__pycache__/tokens.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/composer.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/composer.py
new file mode 100644
index 0000000000000000000000000000000000000000..6d15cb40e3b4198819c91c6f8d8b32807fcf53b2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/composer.py
@@ -0,0 +1,139 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/constructor.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/constructor.py
new file mode 100644
index 0000000000000000000000000000000000000000..619acd3070a4845c653fcf22a626e05158035bc2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/constructor.py
@@ -0,0 +1,748 @@
+
+__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<year>[0-9][0-9][0-9][0-9])
+                -(?P<month>[0-9][0-9]?)
+                -(?P<day>[0-9][0-9]?)
+                (?:(?:[Tt]|[ \t]+)
+                (?P<hour>[0-9][0-9]?)
+                :(?P<minute>[0-9][0-9])
+                :(?P<second>[0-9][0-9])
+                (?:\.(?P<fraction>[0-9]*))?
+                (?:[ \t]*(?P<tz>Z|(?P<tz_sign>[-+])(?P<tz_hour>[0-9][0-9]?)
+                (?::(?P<tz_minute>[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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/cyaml.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/cyaml.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c21345879b298bb8668201bebe7d289586b17f9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/cyaml.py
@@ -0,0 +1,101 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/dumper.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/dumper.py
new file mode 100644
index 0000000000000000000000000000000000000000..6aadba551f3836b02f4752277f4b3027073defad
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/dumper.py
@@ -0,0 +1,62 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/emitter.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/emitter.py
new file mode 100644
index 0000000000000000000000000000000000000000..a664d011162af69184df2f8e59ab7feec818f7c7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/emitter.py
@@ -0,0 +1,1137 @@
+
+# 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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/error.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/error.py
new file mode 100644
index 0000000000000000000000000000000000000000..b796b4dc519512c4825ff539a2e6aa20f4d370d0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/error.py
@@ -0,0 +1,75 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/events.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/events.py
new file mode 100644
index 0000000000000000000000000000000000000000..f79ad389cb6c9517e391dcd25534866bc9ccd36a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/events.py
@@ -0,0 +1,86 @@
+
+# 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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/loader.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/loader.py
new file mode 100644
index 0000000000000000000000000000000000000000..e90c11224c38e559cdf0cb205f0692ebd4fb8681
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/loader.py
@@ -0,0 +1,63 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/nodes.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/nodes.py
new file mode 100644
index 0000000000000000000000000000000000000000..c4f070c41e1fb1bc01af27d69329e92dded38908
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/nodes.py
@@ -0,0 +1,49 @@
+
+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 = '<empty>'
+        #    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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/parser.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..13a5995d292045d0f865a99abf692bd35dc87814
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/parser.py
@@ -0,0 +1,589 @@
+
+# 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 '<document start>', 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 <block end>, 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 <block end>, 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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/reader.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/reader.py
new file mode 100644
index 0000000000000000000000000000000000000000..774b0219b5932a0ee1c27e637371de5ba8d9cb16
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/reader.py
@@ -0,0 +1,185 @@
+# 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 = "<unicode string>"
+            self.check_printable(stream)
+            self.buffer = stream+'\0'
+        elif isinstance(stream, bytes):
+            self.name = "<byte string>"
+            self.raw_buffer = stream
+            self.determine_encoding()
+        else:
+            self.stream = stream
+            self.name = getattr(stream, 'name', "<file>")
+            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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/representer.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/representer.py
new file mode 100644
index 0000000000000000000000000000000000000000..3b0b192ef32ed7f5b7015456fe883c3327bb841e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/representer.py
@@ -0,0 +1,389 @@
+
+__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_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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/resolver.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/resolver.py
new file mode 100644
index 0000000000000000000000000000000000000000..013896d2f10619e0e75d2579cd63220338a7fef1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/resolver.py
@@ -0,0 +1,227 @@
+
+__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_]+(?:[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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/scanner.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/scanner.py
new file mode 100644
index 0000000000000000000000000000000000000000..7437ede1c608266aaca481955f438844479cab4f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/scanner.py
@@ -0,0 +1,1435 @@
+
+# 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 <TAB>:
+        #       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 hexdecimal 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 hexdecimal 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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/serializer.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/serializer.py
new file mode 100644
index 0000000000000000000000000000000000000000..fe911e67ae7a739abb491fbbc6834b9c37bbda4b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/serializer.py
@@ -0,0 +1,111 @@
+
+__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/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/tokens.py b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/tokens.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d0b48a394ac8c019b401516a12f688df361cf90
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/vendor/yaml/tokens.py
@@ -0,0 +1,104 @@
+
+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 = '<byte order mark>'
+
+class DirectiveToken(Token):
+    id = '<directive>'
+    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 = '<document start>'
+
+class DocumentEndToken(Token):
+    id = '<document end>'
+
+class StreamStartToken(Token):
+    id = '<stream start>'
+    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 = '<stream end>'
+
+class BlockSequenceStartToken(Token):
+    id = '<block sequence start>'
+
+class BlockMappingStartToken(Token):
+    id = '<block mapping start>'
+
+class BlockEndToken(Token):
+    id = '<block end>'
+
+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 = '<alias>'
+    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 = '<anchor>'
+    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 = '<tag>'
+    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 = '<scalar>'
+    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/TP03/TP03/lib/python3.9/site-packages/invoke/watchers.py b/TP03/TP03/lib/python3.9/site-packages/invoke/watchers.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb813df289ae73239262514d88cecc3f2404e429
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/invoke/watchers.py
@@ -0,0 +1,145 @@
+import re
+import threading
+from typing import Generator, Iterable
+
+from .exceptions import ResponseNotAccepted
+
+
+class StreamWatcher(threading.local):
+    """
+    A class whose subclasses may act on seen stream data from subprocesses.
+
+    Subclasses must exhibit the following API; see `Responder` for a concrete
+    example.
+
+    * ``__init__`` is completely up to each subclass, though as usual,
+      subclasses *of* subclasses should be careful to make use of `super` where
+      appropriate.
+    * `submit` must accept the entire current contents of the stream being
+      watched, as a string, and may optionally return an iterable of strings
+      (or act as a generator iterator, i.e. multiple calls to ``yield
+      <string>``), which will each be written to the subprocess' standard
+      input.
+
+    .. note::
+        `StreamWatcher` subclasses exist in part to enable state tracking, such
+        as detecting when a submitted password didn't work & erroring (or
+        prompting a user, or etc). Such bookkeeping isn't easily achievable
+        with simple callback functions.
+
+    .. note::
+        `StreamWatcher` subclasses `threading.local` so that its instances can
+        be used to 'watch' both subprocess stdout and stderr in separate
+        threads.
+
+    .. versionadded:: 1.0
+    """
+
+    def submit(self, stream: str) -> Iterable[str]:
+        """
+        Act on ``stream`` data, potentially returning responses.
+
+        :param str stream:
+            All data read on this stream since the beginning of the session.
+
+        :returns:
+            An iterable of ``str`` (which may be empty).
+
+        .. versionadded:: 1.0
+        """
+        raise NotImplementedError
+
+
+class Responder(StreamWatcher):
+    """
+    A parameterizable object that submits responses to specific patterns.
+
+    Commonly used to implement password auto-responds for things like ``sudo``.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, pattern: str, response: str) -> None:
+        r"""
+        Imprint this `Responder` with necessary parameters.
+
+        :param pattern:
+            A raw string (e.g. ``r"\[sudo\] password for .*:"``) which will be
+            turned into a regular expression.
+
+        :param response:
+            The string to submit to the subprocess' stdin when ``pattern`` is
+            detected.
+        """
+        # TODO: precompile the keys into regex objects
+        self.pattern = pattern
+        self.response = response
+        self.index = 0
+
+    def pattern_matches(
+        self, stream: str, pattern: str, index_attr: str
+    ) -> Iterable[str]:
+        """
+        Generic "search for pattern in stream, using index" behavior.
+
+        Used here and in some subclasses that want to track multiple patterns
+        concurrently.
+
+        :param str stream: The same data passed to ``submit``.
+        :param str pattern: The pattern to search for.
+        :param str index_attr: The name of the index attribute to use.
+        :returns: An iterable of string matches.
+
+        .. versionadded:: 1.0
+        """
+        # NOTE: generifies scanning so it can be used to scan for >1 pattern at
+        # once, e.g. in FailingResponder.
+        # Only look at stream contents we haven't seen yet, to avoid dupes.
+        index = getattr(self, index_attr)
+        new = stream[index:]
+        # Search, across lines if necessary
+        matches = re.findall(pattern, new, re.S)
+        # Update seek index if we've matched
+        if matches:
+            setattr(self, index_attr, index + len(new))
+        return matches
+
+    def submit(self, stream: str) -> Generator[str, None, None]:
+        # Iterate over findall() response in case >1 match occurred.
+        for _ in self.pattern_matches(stream, self.pattern, "index"):
+            yield self.response
+
+
+class FailingResponder(Responder):
+    """
+    Variant of `Responder` which is capable of detecting incorrect responses.
+
+    This class adds a ``sentinel`` parameter to ``__init__``, and its
+    ``submit`` will raise `.ResponseNotAccepted` if it detects that sentinel
+    value in the stream.
+
+    .. versionadded:: 1.0
+    """
+
+    def __init__(self, pattern: str, response: str, sentinel: str) -> None:
+        super().__init__(pattern, response)
+        self.sentinel = sentinel
+        self.failure_index = 0
+        self.tried = False
+
+    def submit(self, stream: str) -> Generator[str, None, None]:
+        # Behave like regular Responder initially
+        response = super().submit(stream)
+        # Also check stream for our failure sentinel
+        failed = self.pattern_matches(stream, self.sentinel, "failure_index")
+        # Error out if we seem to have failed after a previous response.
+        if self.tried and failed:
+            err = 'Auto-response to r"{}" failed with {!r}!'.format(
+                self.pattern, self.sentinel
+            )
+            raise ResponseNotAccepted(err)
+        # Once we see that we had a response, take note
+        if response:
+            self.tried = True
+        # Again, behave regularly by default.
+        return response
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__init__.py b/TP03/TP03/lib/python3.9/site-packages/nacl/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..cc8b7ea7b35be88f03c2871ca31065b15c113e2a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/__init__.py
@@ -0,0 +1,39 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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.
+
+
+__all__ = [
+    "__title__",
+    "__summary__",
+    "__uri__",
+    "__version__",
+    "__author__",
+    "__email__",
+    "__license__",
+    "__copyright__",
+]
+
+__title__ = "PyNaCl"
+__summary__ = (
+    "Python binding to the Networking and Cryptography (NaCl) library"
+)
+__uri__ = "https://github.com/pyca/pynacl/"
+
+__version__ = "1.5.0"
+
+__author__ = "The PyNaCl developers"
+__email__ = "cryptography-dev@python.org"
+
+__license__ = "Apache License 2.0"
+__copyright__ = "Copyright 2013-2018 {}".format(__author__)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0e0ffc8d1f4bf2b97979b1355644b3e2459473dd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/encoding.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/encoding.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9681545dc349515ca298d35858a6dd90e24d8547
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/encoding.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/exceptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/exceptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c082316912f56c7e9c7c60da96089150b15dc680
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/exceptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..959c9cd77a8d79cb70a6bbf9fa93ea3a73ac2345
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hashlib.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hashlib.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4e6790804c2fc35b0e948cc5cd969ff7c69ec03b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/hashlib.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/public.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/public.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ef14290e2b3d9cf0aad7870dfd4610af92686555
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/public.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/secret.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/secret.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1f331ffd391b076f366a433cd6c808ee2f840c2d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/secret.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/signing.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/signing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e8bc0f21138290d71ef2dae6d620548cd04f8ef4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/signing.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..47c414ca072befa211fa0991f090d6c2b7f3e36d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/_sodium.abi3.so b/TP03/TP03/lib/python3.9/site-packages/nacl/_sodium.abi3.so
new file mode 100755
index 0000000000000000000000000000000000000000..448331e8c9f1ae32f9c4b3288479eaaad35e92cc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/_sodium.abi3.so differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__init__.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..1e3b10e82fd6e2da413e1f4999a6d25d7fd919c8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__init__.py
@@ -0,0 +1,451 @@
+# Copyright 2013-2019 Donald Stufft and individual contributors
+#
+# 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 nacl.bindings.crypto_aead import (
+    crypto_aead_chacha20poly1305_ABYTES,
+    crypto_aead_chacha20poly1305_KEYBYTES,
+    crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX,
+    crypto_aead_chacha20poly1305_NPUBBYTES,
+    crypto_aead_chacha20poly1305_NSECBYTES,
+    crypto_aead_chacha20poly1305_decrypt,
+    crypto_aead_chacha20poly1305_encrypt,
+    crypto_aead_chacha20poly1305_ietf_ABYTES,
+    crypto_aead_chacha20poly1305_ietf_KEYBYTES,
+    crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX,
+    crypto_aead_chacha20poly1305_ietf_NPUBBYTES,
+    crypto_aead_chacha20poly1305_ietf_NSECBYTES,
+    crypto_aead_chacha20poly1305_ietf_decrypt,
+    crypto_aead_chacha20poly1305_ietf_encrypt,
+    crypto_aead_xchacha20poly1305_ietf_ABYTES,
+    crypto_aead_xchacha20poly1305_ietf_KEYBYTES,
+    crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX,
+    crypto_aead_xchacha20poly1305_ietf_NPUBBYTES,
+    crypto_aead_xchacha20poly1305_ietf_NSECBYTES,
+    crypto_aead_xchacha20poly1305_ietf_decrypt,
+    crypto_aead_xchacha20poly1305_ietf_encrypt,
+)
+from nacl.bindings.crypto_box import (
+    crypto_box,
+    crypto_box_BEFORENMBYTES,
+    crypto_box_BOXZEROBYTES,
+    crypto_box_NONCEBYTES,
+    crypto_box_PUBLICKEYBYTES,
+    crypto_box_SEALBYTES,
+    crypto_box_SECRETKEYBYTES,
+    crypto_box_SEEDBYTES,
+    crypto_box_ZEROBYTES,
+    crypto_box_afternm,
+    crypto_box_beforenm,
+    crypto_box_keypair,
+    crypto_box_open,
+    crypto_box_open_afternm,
+    crypto_box_seal,
+    crypto_box_seal_open,
+    crypto_box_seed_keypair,
+)
+from nacl.bindings.crypto_core import (
+    crypto_core_ed25519_BYTES,
+    crypto_core_ed25519_NONREDUCEDSCALARBYTES,
+    crypto_core_ed25519_SCALARBYTES,
+    crypto_core_ed25519_add,
+    crypto_core_ed25519_is_valid_point,
+    crypto_core_ed25519_scalar_add,
+    crypto_core_ed25519_scalar_complement,
+    crypto_core_ed25519_scalar_invert,
+    crypto_core_ed25519_scalar_mul,
+    crypto_core_ed25519_scalar_negate,
+    crypto_core_ed25519_scalar_reduce,
+    crypto_core_ed25519_scalar_sub,
+    crypto_core_ed25519_sub,
+    has_crypto_core_ed25519,
+)
+from nacl.bindings.crypto_generichash import (
+    crypto_generichash_BYTES,
+    crypto_generichash_BYTES_MAX,
+    crypto_generichash_BYTES_MIN,
+    crypto_generichash_KEYBYTES,
+    crypto_generichash_KEYBYTES_MAX,
+    crypto_generichash_KEYBYTES_MIN,
+    crypto_generichash_PERSONALBYTES,
+    crypto_generichash_SALTBYTES,
+    crypto_generichash_STATEBYTES,
+    generichash_blake2b_final as crypto_generichash_blake2b_final,
+    generichash_blake2b_init as crypto_generichash_blake2b_init,
+    generichash_blake2b_salt_personal as crypto_generichash_blake2b_salt_personal,
+    generichash_blake2b_update as crypto_generichash_blake2b_update,
+)
+from nacl.bindings.crypto_hash import (
+    crypto_hash,
+    crypto_hash_BYTES,
+    crypto_hash_sha256,
+    crypto_hash_sha256_BYTES,
+    crypto_hash_sha512,
+    crypto_hash_sha512_BYTES,
+)
+from nacl.bindings.crypto_kx import (
+    crypto_kx_PUBLIC_KEY_BYTES,
+    crypto_kx_SECRET_KEY_BYTES,
+    crypto_kx_SEED_BYTES,
+    crypto_kx_SESSION_KEY_BYTES,
+    crypto_kx_client_session_keys,
+    crypto_kx_keypair,
+    crypto_kx_seed_keypair,
+    crypto_kx_server_session_keys,
+)
+from nacl.bindings.crypto_pwhash import (
+    crypto_pwhash_ALG_ARGON2I13,
+    crypto_pwhash_ALG_ARGON2ID13,
+    crypto_pwhash_ALG_DEFAULT,
+    crypto_pwhash_BYTES_MAX,
+    crypto_pwhash_BYTES_MIN,
+    crypto_pwhash_PASSWD_MAX,
+    crypto_pwhash_PASSWD_MIN,
+    crypto_pwhash_SALTBYTES,
+    crypto_pwhash_STRBYTES,
+    crypto_pwhash_alg,
+    crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE,
+    crypto_pwhash_argon2i_MEMLIMIT_MAX,
+    crypto_pwhash_argon2i_MEMLIMIT_MIN,
+    crypto_pwhash_argon2i_MEMLIMIT_MODERATE,
+    crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE,
+    crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE,
+    crypto_pwhash_argon2i_OPSLIMIT_MAX,
+    crypto_pwhash_argon2i_OPSLIMIT_MIN,
+    crypto_pwhash_argon2i_OPSLIMIT_MODERATE,
+    crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE,
+    crypto_pwhash_argon2i_STRPREFIX,
+    crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE,
+    crypto_pwhash_argon2id_MEMLIMIT_MAX,
+    crypto_pwhash_argon2id_MEMLIMIT_MIN,
+    crypto_pwhash_argon2id_MEMLIMIT_MODERATE,
+    crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE,
+    crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE,
+    crypto_pwhash_argon2id_OPSLIMIT_MAX,
+    crypto_pwhash_argon2id_OPSLIMIT_MIN,
+    crypto_pwhash_argon2id_OPSLIMIT_MODERATE,
+    crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE,
+    crypto_pwhash_argon2id_STRPREFIX,
+    crypto_pwhash_scryptsalsa208sha256_BYTES_MAX,
+    crypto_pwhash_scryptsalsa208sha256_BYTES_MIN,
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE,
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX,
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN,
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE,
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE,
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX,
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN,
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE,
+    crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX,
+    crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN,
+    crypto_pwhash_scryptsalsa208sha256_SALTBYTES,
+    crypto_pwhash_scryptsalsa208sha256_STRBYTES,
+    crypto_pwhash_scryptsalsa208sha256_STRPREFIX,
+    crypto_pwhash_scryptsalsa208sha256_ll,
+    crypto_pwhash_scryptsalsa208sha256_str,
+    crypto_pwhash_scryptsalsa208sha256_str_verify,
+    crypto_pwhash_str_alg,
+    crypto_pwhash_str_verify,
+    has_crypto_pwhash_scryptsalsa208sha256,
+    nacl_bindings_pick_scrypt_params,
+)
+from nacl.bindings.crypto_scalarmult import (
+    crypto_scalarmult,
+    crypto_scalarmult_BYTES,
+    crypto_scalarmult_SCALARBYTES,
+    crypto_scalarmult_base,
+    crypto_scalarmult_ed25519,
+    crypto_scalarmult_ed25519_BYTES,
+    crypto_scalarmult_ed25519_SCALARBYTES,
+    crypto_scalarmult_ed25519_base,
+    crypto_scalarmult_ed25519_base_noclamp,
+    crypto_scalarmult_ed25519_noclamp,
+    has_crypto_scalarmult_ed25519,
+)
+from nacl.bindings.crypto_secretbox import (
+    crypto_secretbox,
+    crypto_secretbox_BOXZEROBYTES,
+    crypto_secretbox_KEYBYTES,
+    crypto_secretbox_MACBYTES,
+    crypto_secretbox_MESSAGEBYTES_MAX,
+    crypto_secretbox_NONCEBYTES,
+    crypto_secretbox_ZEROBYTES,
+    crypto_secretbox_open,
+)
+from nacl.bindings.crypto_secretstream import (
+    crypto_secretstream_xchacha20poly1305_ABYTES,
+    crypto_secretstream_xchacha20poly1305_HEADERBYTES,
+    crypto_secretstream_xchacha20poly1305_KEYBYTES,
+    crypto_secretstream_xchacha20poly1305_STATEBYTES,
+    crypto_secretstream_xchacha20poly1305_TAG_FINAL,
+    crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,
+    crypto_secretstream_xchacha20poly1305_TAG_PUSH,
+    crypto_secretstream_xchacha20poly1305_TAG_REKEY,
+    crypto_secretstream_xchacha20poly1305_init_pull,
+    crypto_secretstream_xchacha20poly1305_init_push,
+    crypto_secretstream_xchacha20poly1305_keygen,
+    crypto_secretstream_xchacha20poly1305_pull,
+    crypto_secretstream_xchacha20poly1305_push,
+    crypto_secretstream_xchacha20poly1305_rekey,
+    crypto_secretstream_xchacha20poly1305_state,
+)
+from nacl.bindings.crypto_shorthash import (
+    BYTES as crypto_shorthash_siphash24_BYTES,
+    KEYBYTES as crypto_shorthash_siphash24_KEYBYTES,
+    XBYTES as crypto_shorthash_siphashx24_BYTES,
+    XKEYBYTES as crypto_shorthash_siphashx24_KEYBYTES,
+    crypto_shorthash_siphash24,
+    crypto_shorthash_siphashx24,
+    has_crypto_shorthash_siphashx24,
+)
+from nacl.bindings.crypto_sign import (
+    crypto_sign,
+    crypto_sign_BYTES,
+    crypto_sign_PUBLICKEYBYTES,
+    crypto_sign_SECRETKEYBYTES,
+    crypto_sign_SEEDBYTES,
+    crypto_sign_ed25519_pk_to_curve25519,
+    crypto_sign_ed25519_sk_to_curve25519,
+    crypto_sign_ed25519_sk_to_pk,
+    crypto_sign_ed25519_sk_to_seed,
+    crypto_sign_ed25519ph_STATEBYTES,
+    crypto_sign_ed25519ph_final_create,
+    crypto_sign_ed25519ph_final_verify,
+    crypto_sign_ed25519ph_state,
+    crypto_sign_ed25519ph_update,
+    crypto_sign_keypair,
+    crypto_sign_open,
+    crypto_sign_seed_keypair,
+)
+from nacl.bindings.randombytes import (
+    randombytes,
+    randombytes_buf_deterministic,
+)
+from nacl.bindings.sodium_core import sodium_init
+from nacl.bindings.utils import (
+    sodium_add,
+    sodium_increment,
+    sodium_memcmp,
+    sodium_pad,
+    sodium_unpad,
+)
+
+
+__all__ = [
+    "crypto_aead_chacha20poly1305_ABYTES",
+    "crypto_aead_chacha20poly1305_KEYBYTES",
+    "crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX",
+    "crypto_aead_chacha20poly1305_NPUBBYTES",
+    "crypto_aead_chacha20poly1305_NSECBYTES",
+    "crypto_aead_chacha20poly1305_decrypt",
+    "crypto_aead_chacha20poly1305_encrypt",
+    "crypto_aead_chacha20poly1305_ietf_ABYTES",
+    "crypto_aead_chacha20poly1305_ietf_KEYBYTES",
+    "crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX",
+    "crypto_aead_chacha20poly1305_ietf_NPUBBYTES",
+    "crypto_aead_chacha20poly1305_ietf_NSECBYTES",
+    "crypto_aead_chacha20poly1305_ietf_decrypt",
+    "crypto_aead_chacha20poly1305_ietf_encrypt",
+    "crypto_aead_xchacha20poly1305_ietf_ABYTES",
+    "crypto_aead_xchacha20poly1305_ietf_KEYBYTES",
+    "crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX",
+    "crypto_aead_xchacha20poly1305_ietf_NPUBBYTES",
+    "crypto_aead_xchacha20poly1305_ietf_NSECBYTES",
+    "crypto_aead_xchacha20poly1305_ietf_decrypt",
+    "crypto_aead_xchacha20poly1305_ietf_encrypt",
+    "crypto_box_SECRETKEYBYTES",
+    "crypto_box_PUBLICKEYBYTES",
+    "crypto_box_SEEDBYTES",
+    "crypto_box_NONCEBYTES",
+    "crypto_box_ZEROBYTES",
+    "crypto_box_BOXZEROBYTES",
+    "crypto_box_BEFORENMBYTES",
+    "crypto_box_SEALBYTES",
+    "crypto_box_keypair",
+    "crypto_box",
+    "crypto_box_open",
+    "crypto_box_beforenm",
+    "crypto_box_afternm",
+    "crypto_box_open_afternm",
+    "crypto_box_seal",
+    "crypto_box_seal_open",
+    "crypto_box_seed_keypair",
+    "has_crypto_core_ed25519",
+    "crypto_core_ed25519_BYTES",
+    "crypto_core_ed25519_UNIFORMBYTES",
+    "crypto_core_ed25519_SCALARBYTES",
+    "crypto_core_ed25519_NONREDUCEDSCALARBYTES",
+    "crypto_core_ed25519_add",
+    "crypto_core_ed25519_from_uniform",
+    "crypto_core_ed25519_is_valid_point",
+    "crypto_core_ed25519_sub",
+    "crypto_core_ed25519_scalar_invert",
+    "crypto_core_ed25519_scalar_negate",
+    "crypto_core_ed25519_scalar_complement",
+    "crypto_core_ed25519_scalar_add",
+    "crypto_core_ed25519_scalar_sub",
+    "crypto_core_ed25519_scalar_mul",
+    "crypto_core_ed25519_scalar_reduce",
+    "crypto_hash_BYTES",
+    "crypto_hash_sha256_BYTES",
+    "crypto_hash_sha512_BYTES",
+    "crypto_hash",
+    "crypto_hash_sha256",
+    "crypto_hash_sha512",
+    "crypto_generichash_BYTES",
+    "crypto_generichash_BYTES_MIN",
+    "crypto_generichash_BYTES_MAX",
+    "crypto_generichash_KEYBYTES",
+    "crypto_generichash_KEYBYTES_MIN",
+    "crypto_generichash_KEYBYTES_MAX",
+    "crypto_generichash_SALTBYTES",
+    "crypto_generichash_PERSONALBYTES",
+    "crypto_generichash_STATEBYTES",
+    "crypto_generichash_blake2b_salt_personal",
+    "crypto_generichash_blake2b_init",
+    "crypto_generichash_blake2b_update",
+    "crypto_generichash_blake2b_final",
+    "crypto_kx_keypair",
+    "crypto_kx_seed_keypair",
+    "crypto_kx_client_session_keys",
+    "crypto_kx_server_session_keys",
+    "crypto_kx_PUBLIC_KEY_BYTES",
+    "crypto_kx_SECRET_KEY_BYTES",
+    "crypto_kx_SEED_BYTES",
+    "crypto_kx_SESSION_KEY_BYTES",
+    "has_crypto_scalarmult_ed25519",
+    "crypto_scalarmult_BYTES",
+    "crypto_scalarmult_SCALARBYTES",
+    "crypto_scalarmult",
+    "crypto_scalarmult_base",
+    "crypto_scalarmult_ed25519_BYTES",
+    "crypto_scalarmult_ed25519_SCALARBYTES",
+    "crypto_scalarmult_ed25519",
+    "crypto_scalarmult_ed25519_base",
+    "crypto_scalarmult_ed25519_noclamp",
+    "crypto_scalarmult_ed25519_base_noclamp",
+    "crypto_secretbox_KEYBYTES",
+    "crypto_secretbox_NONCEBYTES",
+    "crypto_secretbox_ZEROBYTES",
+    "crypto_secretbox_BOXZEROBYTES",
+    "crypto_secretbox_MACBYTES",
+    "crypto_secretbox_MESSAGEBYTES_MAX",
+    "crypto_secretbox",
+    "crypto_secretbox_open",
+    "crypto_secretstream_xchacha20poly1305_ABYTES",
+    "crypto_secretstream_xchacha20poly1305_HEADERBYTES",
+    "crypto_secretstream_xchacha20poly1305_KEYBYTES",
+    "crypto_secretstream_xchacha20poly1305_STATEBYTES",
+    "crypto_secretstream_xchacha20poly1305_TAG_FINAL",
+    "crypto_secretstream_xchacha20poly1305_TAG_MESSAGE",
+    "crypto_secretstream_xchacha20poly1305_TAG_PUSH",
+    "crypto_secretstream_xchacha20poly1305_TAG_REKEY",
+    "crypto_secretstream_xchacha20poly1305_init_pull",
+    "crypto_secretstream_xchacha20poly1305_init_push",
+    "crypto_secretstream_xchacha20poly1305_keygen",
+    "crypto_secretstream_xchacha20poly1305_pull",
+    "crypto_secretstream_xchacha20poly1305_push",
+    "crypto_secretstream_xchacha20poly1305_rekey",
+    "crypto_secretstream_xchacha20poly1305_state",
+    "has_crypto_shorthash_siphashx24",
+    "crypto_shorthash_siphash24_BYTES",
+    "crypto_shorthash_siphash24_KEYBYTES",
+    "crypto_shorthash_siphash24",
+    "crypto_shorthash_siphashx24_BYTES",
+    "crypto_shorthash_siphashx24_KEYBYTES",
+    "crypto_shorthash_siphashx24",
+    "crypto_sign_BYTES",
+    "crypto_sign_SEEDBYTES",
+    "crypto_sign_PUBLICKEYBYTES",
+    "crypto_sign_SECRETKEYBYTES",
+    "crypto_sign_keypair",
+    "crypto_sign_seed_keypair",
+    "crypto_sign",
+    "crypto_sign_open",
+    "crypto_sign_ed25519_pk_to_curve25519",
+    "crypto_sign_ed25519_sk_to_curve25519",
+    "crypto_sign_ed25519_sk_to_pk",
+    "crypto_sign_ed25519_sk_to_seed",
+    "crypto_sign_ed25519ph_STATEBYTES",
+    "crypto_sign_ed25519ph_final_create",
+    "crypto_sign_ed25519ph_final_verify",
+    "crypto_sign_ed25519ph_state",
+    "crypto_sign_ed25519ph_update",
+    "crypto_pwhash_ALG_ARGON2I13",
+    "crypto_pwhash_ALG_ARGON2ID13",
+    "crypto_pwhash_ALG_DEFAULT",
+    "crypto_pwhash_BYTES_MAX",
+    "crypto_pwhash_BYTES_MIN",
+    "crypto_pwhash_PASSWD_MAX",
+    "crypto_pwhash_PASSWD_MIN",
+    "crypto_pwhash_SALTBYTES",
+    "crypto_pwhash_STRBYTES",
+    "crypto_pwhash_alg",
+    "crypto_pwhash_argon2i_MEMLIMIT_MIN",
+    "crypto_pwhash_argon2i_MEMLIMIT_MAX",
+    "crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE",
+    "crypto_pwhash_argon2i_MEMLIMIT_MODERATE",
+    "crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE",
+    "crypto_pwhash_argon2i_OPSLIMIT_MIN",
+    "crypto_pwhash_argon2i_OPSLIMIT_MAX",
+    "crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE",
+    "crypto_pwhash_argon2i_OPSLIMIT_MODERATE",
+    "crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE",
+    "crypto_pwhash_argon2i_STRPREFIX",
+    "crypto_pwhash_argon2id_MEMLIMIT_MIN",
+    "crypto_pwhash_argon2id_MEMLIMIT_MAX",
+    "crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE",
+    "crypto_pwhash_argon2id_MEMLIMIT_MODERATE",
+    "crypto_pwhash_argon2id_OPSLIMIT_MIN",
+    "crypto_pwhash_argon2id_OPSLIMIT_MAX",
+    "crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE",
+    "crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE",
+    "crypto_pwhash_argon2id_OPSLIMIT_MODERATE",
+    "crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE",
+    "crypto_pwhash_argon2id_STRPREFIX",
+    "crypto_pwhash_str_alg",
+    "crypto_pwhash_str_verify",
+    "has_crypto_pwhash_scryptsalsa208sha256",
+    "crypto_pwhash_scryptsalsa208sha256_BYTES_MAX",
+    "crypto_pwhash_scryptsalsa208sha256_BYTES_MIN",
+    "crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE",
+    "crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX",
+    "crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN",
+    "crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE",
+    "crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE",
+    "crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX",
+    "crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN",
+    "crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE",
+    "crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX",
+    "crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN",
+    "crypto_pwhash_scryptsalsa208sha256_SALTBYTES",
+    "crypto_pwhash_scryptsalsa208sha256_STRBYTES",
+    "crypto_pwhash_scryptsalsa208sha256_STRPREFIX",
+    "crypto_pwhash_scryptsalsa208sha256_ll",
+    "crypto_pwhash_scryptsalsa208sha256_str",
+    "crypto_pwhash_scryptsalsa208sha256_str_verify",
+    "nacl_bindings_pick_scrypt_params",
+    "randombytes",
+    "randombytes_buf_deterministic",
+    "sodium_init",
+    "sodium_add",
+    "sodium_increment",
+    "sodium_memcmp",
+    "sodium_pad",
+    "sodium_unpad",
+]
+
+
+# Initialize Sodium
+sodium_init()
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ec78501f3fe336cad1db6eec85ee922de7524015
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_aead.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_aead.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e6b6dd9775e376e663d5df73391128007ea29314
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_aead.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_box.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_box.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7380a56ee41b18b852ba4e5fae0d2f0fc8ba6385
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_box.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_core.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_core.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2c9e143f8d2b781f61f5f213e00e6638ca225edc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_core.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_generichash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_generichash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8d9882cdc5eb644444f76ceea9cde1e7331fd4d9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_generichash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_hash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_hash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b43f6260fdf32a7a3f0237e6cd63b4398ad82239
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_hash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_kx.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_kx.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b464204e3297cccbc4f8832bac419c7ff003510e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_kx.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_pwhash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_pwhash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a23a8b3e7d04e85bd081a2637b28f11dd834ab1f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_pwhash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_scalarmult.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_scalarmult.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e99d04533cab81fab24aed5b1f3c59ea90d59a47
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_scalarmult.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretbox.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretbox.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd8d399b91018abc1b35e30562734b052918ce54
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretbox.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretstream.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretstream.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ad311bb198895c225c3d1e0d55f41d82c041b2c1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_secretstream.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_shorthash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_shorthash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6799e5945cac46a534edee41f3f2ce8ed56eb839
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_shorthash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_sign.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_sign.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..86326bec89ae27f49e9a2885cffdd4911f4964d4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/crypto_sign.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/randombytes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/randombytes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..17724768545b70c4f187fdbaf0791e7dea12cbe5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/randombytes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/sodium_core.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/sodium_core.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..14afee20e56f353e97c53c43796a8a279070e020
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/sodium_core.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..19518ebcaf127676e263a17462c332e73da4c930
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_aead.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_aead.py
new file mode 100644
index 0000000000000000000000000000000000000000..2e7168db74bdae5fa72f8080291c1362cd145021
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_aead.py
@@ -0,0 +1,559 @@
+# Copyright 2017 Donald Stufft and individual contributors
+#
+# 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 Optional
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+"""
+Implementations of authenticated encription with associated data (*AEAD*)
+constructions building on the chacha20 stream cipher and the poly1305
+authenticator
+"""
+
+crypto_aead_chacha20poly1305_ietf_KEYBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_ietf_keybytes()
+)
+crypto_aead_chacha20poly1305_ietf_NSECBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_ietf_nsecbytes()
+)
+crypto_aead_chacha20poly1305_ietf_NPUBBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_ietf_npubbytes()
+)
+crypto_aead_chacha20poly1305_ietf_ABYTES: int = (
+    lib.crypto_aead_chacha20poly1305_ietf_abytes()
+)
+crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX: int = (
+    lib.crypto_aead_chacha20poly1305_ietf_messagebytes_max()
+)
+_aead_chacha20poly1305_ietf_CRYPTBYTES_MAX = (
+    crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
+    + crypto_aead_chacha20poly1305_ietf_ABYTES
+)
+
+crypto_aead_chacha20poly1305_KEYBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_keybytes()
+)
+crypto_aead_chacha20poly1305_NSECBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_nsecbytes()
+)
+crypto_aead_chacha20poly1305_NPUBBYTES: int = (
+    lib.crypto_aead_chacha20poly1305_npubbytes()
+)
+crypto_aead_chacha20poly1305_ABYTES: int = (
+    lib.crypto_aead_chacha20poly1305_abytes()
+)
+crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX: int = (
+    lib.crypto_aead_chacha20poly1305_messagebytes_max()
+)
+_aead_chacha20poly1305_CRYPTBYTES_MAX = (
+    crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX
+    + crypto_aead_chacha20poly1305_ABYTES
+)
+
+crypto_aead_xchacha20poly1305_ietf_KEYBYTES: int = (
+    lib.crypto_aead_xchacha20poly1305_ietf_keybytes()
+)
+crypto_aead_xchacha20poly1305_ietf_NSECBYTES: int = (
+    lib.crypto_aead_xchacha20poly1305_ietf_nsecbytes()
+)
+crypto_aead_xchacha20poly1305_ietf_NPUBBYTES: int = (
+    lib.crypto_aead_xchacha20poly1305_ietf_npubbytes()
+)
+crypto_aead_xchacha20poly1305_ietf_ABYTES: int = (
+    lib.crypto_aead_xchacha20poly1305_ietf_abytes()
+)
+crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX: int = (
+    lib.crypto_aead_xchacha20poly1305_ietf_messagebytes_max()
+)
+_aead_xchacha20poly1305_ietf_CRYPTBYTES_MAX = (
+    crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
+    + crypto_aead_xchacha20poly1305_ietf_ABYTES
+)
+
+
+def crypto_aead_chacha20poly1305_ietf_encrypt(
+    message: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Encrypt the given ``message`` using the IETF ratified chacha20poly1305
+    construction described in RFC7539.
+
+    :param message:
+    :type message: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: authenticated ciphertext
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(message, bytes),
+        "Input message type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    mlen = len(message)
+
+    ensure(
+        mlen <= crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX,
+        "Message must be at most {} bytes long".format(
+            crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_chacha20poly1305_ietf_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_chacha20poly1305_ietf_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_ietf_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    mxout = mlen + crypto_aead_chacha20poly1305_ietf_ABYTES
+
+    clen = ffi.new("unsigned long long *")
+
+    ciphertext = ffi.new("unsigned char[]", mxout)
+
+    res = lib.crypto_aead_chacha20poly1305_ietf_encrypt(
+        ciphertext, clen, message, mlen, _aad, aalen, ffi.NULL, nonce, key
+    )
+
+    ensure(res == 0, "Encryption failed.", raising=exc.CryptoError)
+    return ffi.buffer(ciphertext, clen[0])[:]
+
+
+def crypto_aead_chacha20poly1305_ietf_decrypt(
+    ciphertext: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Decrypt the given ``ciphertext`` using the IETF ratified chacha20poly1305
+    construction described in RFC7539.
+
+    :param ciphertext:
+    :type ciphertext: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: message
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(ciphertext, bytes),
+        "Input ciphertext type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    clen = len(ciphertext)
+
+    ensure(
+        clen <= _aead_chacha20poly1305_ietf_CRYPTBYTES_MAX,
+        "Ciphertext must be at most {} bytes long".format(
+            _aead_chacha20poly1305_ietf_CRYPTBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_chacha20poly1305_ietf_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_ietf_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_chacha20poly1305_ietf_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_ietf_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    mxout = clen - crypto_aead_chacha20poly1305_ietf_ABYTES
+
+    mlen = ffi.new("unsigned long long *")
+    message = ffi.new("unsigned char[]", mxout)
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    res = lib.crypto_aead_chacha20poly1305_ietf_decrypt(
+        message, mlen, ffi.NULL, ciphertext, clen, _aad, aalen, nonce, key
+    )
+
+    ensure(res == 0, "Decryption failed.", raising=exc.CryptoError)
+
+    return ffi.buffer(message, mlen[0])[:]
+
+
+def crypto_aead_chacha20poly1305_encrypt(
+    message: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Encrypt the given ``message`` using the "legacy" construction
+    described in draft-agl-tls-chacha20poly1305.
+
+    :param message:
+    :type message: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: authenticated ciphertext
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(message, bytes),
+        "Input message type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    mlen = len(message)
+
+    ensure(
+        mlen <= crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX,
+        "Message must be at most {} bytes long".format(
+            crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_chacha20poly1305_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_chacha20poly1305_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    mlen = len(message)
+    mxout = mlen + crypto_aead_chacha20poly1305_ietf_ABYTES
+
+    clen = ffi.new("unsigned long long *")
+
+    ciphertext = ffi.new("unsigned char[]", mxout)
+
+    res = lib.crypto_aead_chacha20poly1305_encrypt(
+        ciphertext, clen, message, mlen, _aad, aalen, ffi.NULL, nonce, key
+    )
+
+    ensure(res == 0, "Encryption failed.", raising=exc.CryptoError)
+    return ffi.buffer(ciphertext, clen[0])[:]
+
+
+def crypto_aead_chacha20poly1305_decrypt(
+    ciphertext: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Decrypt the given ``ciphertext`` using the "legacy" construction
+    described in draft-agl-tls-chacha20poly1305.
+
+    :param ciphertext: authenticated ciphertext
+    :type ciphertext: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: message
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(ciphertext, bytes),
+        "Input ciphertext type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    clen = len(ciphertext)
+
+    ensure(
+        clen <= _aead_chacha20poly1305_CRYPTBYTES_MAX,
+        "Ciphertext must be at most {} bytes long".format(
+            _aead_chacha20poly1305_CRYPTBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_chacha20poly1305_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_chacha20poly1305_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_chacha20poly1305_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    mxout = clen - crypto_aead_chacha20poly1305_ABYTES
+
+    mlen = ffi.new("unsigned long long *")
+    message = ffi.new("unsigned char[]", mxout)
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    res = lib.crypto_aead_chacha20poly1305_decrypt(
+        message, mlen, ffi.NULL, ciphertext, clen, _aad, aalen, nonce, key
+    )
+
+    ensure(res == 0, "Decryption failed.", raising=exc.CryptoError)
+
+    return ffi.buffer(message, mlen[0])[:]
+
+
+def crypto_aead_xchacha20poly1305_ietf_encrypt(
+    message: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Encrypt the given ``message`` using the long-nonces xchacha20poly1305
+    construction.
+
+    :param message:
+    :type message: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: authenticated ciphertext
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(message, bytes),
+        "Input message type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    mlen = len(message)
+
+    ensure(
+        mlen <= crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX,
+        "Message must be at most {} bytes long".format(
+            crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_xchacha20poly1305_ietf_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    mlen = len(message)
+    mxout = mlen + crypto_aead_xchacha20poly1305_ietf_ABYTES
+
+    clen = ffi.new("unsigned long long *")
+
+    ciphertext = ffi.new("unsigned char[]", mxout)
+
+    res = lib.crypto_aead_xchacha20poly1305_ietf_encrypt(
+        ciphertext, clen, message, mlen, _aad, aalen, ffi.NULL, nonce, key
+    )
+
+    ensure(res == 0, "Encryption failed.", raising=exc.CryptoError)
+    return ffi.buffer(ciphertext, clen[0])[:]
+
+
+def crypto_aead_xchacha20poly1305_ietf_decrypt(
+    ciphertext: bytes, aad: Optional[bytes], nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Decrypt the given ``ciphertext`` using the long-nonces xchacha20poly1305
+    construction.
+
+    :param ciphertext: authenticated ciphertext
+    :type ciphertext: bytes
+    :param aad:
+    :type aad: Optional[bytes]
+    :param nonce:
+    :type nonce: bytes
+    :param key:
+    :type key: bytes
+    :return: message
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(ciphertext, bytes),
+        "Input ciphertext type must be bytes",
+        raising=exc.TypeError,
+    )
+
+    clen = len(ciphertext)
+
+    ensure(
+        clen <= _aead_xchacha20poly1305_ietf_CRYPTBYTES_MAX,
+        "Ciphertext must be at most {} bytes long".format(
+            _aead_xchacha20poly1305_ietf_CRYPTBYTES_MAX
+        ),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        isinstance(aad, bytes) or (aad is None),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(nonce, bytes)
+        and len(nonce) == crypto_aead_xchacha20poly1305_ietf_NPUBBYTES,
+        "Nonce must be a {} bytes long bytes sequence".format(
+            crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(key, bytes)
+        and len(key) == crypto_aead_xchacha20poly1305_ietf_KEYBYTES,
+        "Key must be a {} bytes long bytes sequence".format(
+            crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    mxout = clen - crypto_aead_xchacha20poly1305_ietf_ABYTES
+    mlen = ffi.new("unsigned long long *")
+    message = ffi.new("unsigned char[]", mxout)
+
+    if aad:
+        _aad = aad
+        aalen = len(aad)
+    else:
+        _aad = ffi.NULL
+        aalen = 0
+
+    res = lib.crypto_aead_xchacha20poly1305_ietf_decrypt(
+        message, mlen, ffi.NULL, ciphertext, clen, _aad, aalen, nonce, key
+    )
+
+    ensure(res == 0, "Decryption failed.", raising=exc.CryptoError)
+
+    return ffi.buffer(message, mlen[0])[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_box.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_box.py
new file mode 100644
index 0000000000000000000000000000000000000000..74f7f0a639cd7c6e03b1a52bdb3f15101b1ce050
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_box.py
@@ -0,0 +1,324 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 Tuple
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+__all__ = ["crypto_box_keypair", "crypto_box"]
+
+
+crypto_box_SECRETKEYBYTES: int = lib.crypto_box_secretkeybytes()
+crypto_box_PUBLICKEYBYTES: int = lib.crypto_box_publickeybytes()
+crypto_box_SEEDBYTES: int = lib.crypto_box_seedbytes()
+crypto_box_NONCEBYTES: int = lib.crypto_box_noncebytes()
+crypto_box_ZEROBYTES: int = lib.crypto_box_zerobytes()
+crypto_box_BOXZEROBYTES: int = lib.crypto_box_boxzerobytes()
+crypto_box_BEFORENMBYTES: int = lib.crypto_box_beforenmbytes()
+crypto_box_SEALBYTES: int = lib.crypto_box_sealbytes()
+
+
+def crypto_box_keypair() -> Tuple[bytes, bytes]:
+    """
+    Returns a randomly generated public and secret key.
+
+    :rtype: (bytes(public_key), bytes(secret_key))
+    """
+    pk = ffi.new("unsigned char[]", crypto_box_PUBLICKEYBYTES)
+    sk = ffi.new("unsigned char[]", crypto_box_SECRETKEYBYTES)
+
+    rc = lib.crypto_box_keypair(pk, sk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return (
+        ffi.buffer(pk, crypto_box_PUBLICKEYBYTES)[:],
+        ffi.buffer(sk, crypto_box_SECRETKEYBYTES)[:],
+    )
+
+
+def crypto_box_seed_keypair(seed: bytes) -> Tuple[bytes, bytes]:
+    """
+    Returns a (public, secret) keypair deterministically generated
+    from an input ``seed``.
+
+    .. warning:: The seed **must** be high-entropy; therefore,
+        its generator **must** be a cryptographic quality
+        random function like, for example, :func:`~nacl.utils.random`.
+
+    .. warning:: The seed **must** be protected and remain secret.
+        Anyone who knows the seed is really in possession of
+        the corresponding PrivateKey.
+
+
+    :param seed: bytes
+    :rtype: (bytes(public_key), bytes(secret_key))
+    """
+    ensure(isinstance(seed, bytes), "seed must be bytes", raising=TypeError)
+
+    if len(seed) != crypto_box_SEEDBYTES:
+        raise exc.ValueError("Invalid seed")
+
+    pk = ffi.new("unsigned char[]", crypto_box_PUBLICKEYBYTES)
+    sk = ffi.new("unsigned char[]", crypto_box_SECRETKEYBYTES)
+
+    rc = lib.crypto_box_seed_keypair(pk, sk, seed)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return (
+        ffi.buffer(pk, crypto_box_PUBLICKEYBYTES)[:],
+        ffi.buffer(sk, crypto_box_SECRETKEYBYTES)[:],
+    )
+
+
+def crypto_box(message: bytes, nonce: bytes, pk: bytes, sk: bytes) -> bytes:
+    """
+    Encrypts and returns a message ``message`` using the secret key ``sk``,
+    public key ``pk``, and the nonce ``nonce``.
+
+    :param message: bytes
+    :param nonce: bytes
+    :param pk: bytes
+    :param sk: bytes
+    :rtype: bytes
+    """
+    if len(nonce) != crypto_box_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce size")
+
+    if len(pk) != crypto_box_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid public key")
+
+    if len(sk) != crypto_box_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    padded = (b"\x00" * crypto_box_ZEROBYTES) + message
+    ciphertext = ffi.new("unsigned char[]", len(padded))
+
+    rc = lib.crypto_box(ciphertext, padded, len(padded), nonce, pk, sk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(ciphertext, len(padded))[crypto_box_BOXZEROBYTES:]
+
+
+def crypto_box_open(
+    ciphertext: bytes, nonce: bytes, pk: bytes, sk: bytes
+) -> bytes:
+    """
+    Decrypts and returns an encrypted message ``ciphertext``, using the secret
+    key ``sk``, public key ``pk``, and the nonce ``nonce``.
+
+    :param ciphertext: bytes
+    :param nonce: bytes
+    :param pk: bytes
+    :param sk: bytes
+    :rtype: bytes
+    """
+    if len(nonce) != crypto_box_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce size")
+
+    if len(pk) != crypto_box_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid public key")
+
+    if len(sk) != crypto_box_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    padded = (b"\x00" * crypto_box_BOXZEROBYTES) + ciphertext
+    plaintext = ffi.new("unsigned char[]", len(padded))
+
+    res = lib.crypto_box_open(plaintext, padded, len(padded), nonce, pk, sk)
+    ensure(
+        res == 0,
+        "An error occurred trying to decrypt the message",
+        raising=exc.CryptoError,
+    )
+
+    return ffi.buffer(plaintext, len(padded))[crypto_box_ZEROBYTES:]
+
+
+def crypto_box_beforenm(pk: bytes, sk: bytes) -> bytes:
+    """
+    Computes and returns the shared key for the public key ``pk`` and the
+    secret key ``sk``. This can be used to speed up operations where the same
+    set of keys is going to be used multiple times.
+
+    :param pk: bytes
+    :param sk: bytes
+    :rtype: bytes
+    """
+    if len(pk) != crypto_box_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid public key")
+
+    if len(sk) != crypto_box_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    k = ffi.new("unsigned char[]", crypto_box_BEFORENMBYTES)
+
+    rc = lib.crypto_box_beforenm(k, pk, sk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(k, crypto_box_BEFORENMBYTES)[:]
+
+
+def crypto_box_afternm(message: bytes, nonce: bytes, k: bytes) -> bytes:
+    """
+    Encrypts and returns the message ``message`` using the shared key ``k`` and
+    the nonce ``nonce``.
+
+    :param message: bytes
+    :param nonce: bytes
+    :param k: bytes
+    :rtype: bytes
+    """
+    if len(nonce) != crypto_box_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce")
+
+    if len(k) != crypto_box_BEFORENMBYTES:
+        raise exc.ValueError("Invalid shared key")
+
+    padded = b"\x00" * crypto_box_ZEROBYTES + message
+    ciphertext = ffi.new("unsigned char[]", len(padded))
+
+    rc = lib.crypto_box_afternm(ciphertext, padded, len(padded), nonce, k)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(ciphertext, len(padded))[crypto_box_BOXZEROBYTES:]
+
+
+def crypto_box_open_afternm(
+    ciphertext: bytes, nonce: bytes, k: bytes
+) -> bytes:
+    """
+    Decrypts and returns the encrypted message ``ciphertext``, using the shared
+    key ``k`` and the nonce ``nonce``.
+
+    :param ciphertext: bytes
+    :param nonce: bytes
+    :param k: bytes
+    :rtype: bytes
+    """
+    if len(nonce) != crypto_box_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce")
+
+    if len(k) != crypto_box_BEFORENMBYTES:
+        raise exc.ValueError("Invalid shared key")
+
+    padded = (b"\x00" * crypto_box_BOXZEROBYTES) + ciphertext
+    plaintext = ffi.new("unsigned char[]", len(padded))
+
+    res = lib.crypto_box_open_afternm(plaintext, padded, len(padded), nonce, k)
+    ensure(
+        res == 0,
+        "An error occurred trying to decrypt the message",
+        raising=exc.CryptoError,
+    )
+
+    return ffi.buffer(plaintext, len(padded))[crypto_box_ZEROBYTES:]
+
+
+def crypto_box_seal(message: bytes, pk: bytes) -> bytes:
+    """
+    Encrypts and returns a message ``message`` using an ephemeral secret key
+    and the public key ``pk``.
+    The ephemeral public key, which is embedded in the sealed box, is also
+    used, in combination with ``pk``, to derive the nonce needed for the
+    underlying box construct.
+
+    :param message: bytes
+    :param pk: bytes
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+    ensure(
+        isinstance(message, bytes),
+        "input message must be bytes",
+        raising=TypeError,
+    )
+
+    ensure(
+        isinstance(pk, bytes), "public key must be bytes", raising=TypeError
+    )
+
+    if len(pk) != crypto_box_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid public key")
+
+    _mlen = len(message)
+    _clen = crypto_box_SEALBYTES + _mlen
+
+    ciphertext = ffi.new("unsigned char[]", _clen)
+
+    rc = lib.crypto_box_seal(ciphertext, message, _mlen, pk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(ciphertext, _clen)[:]
+
+
+def crypto_box_seal_open(ciphertext: bytes, pk: bytes, sk: bytes) -> bytes:
+    """
+    Decrypts and returns an encrypted message ``ciphertext``, using the
+    recipent's secret key ``sk`` and the sender's ephemeral public key
+    embedded in the sealed box. The box contruct nonce is derived from
+    the recipient's public key ``pk`` and the sender's public key.
+
+    :param ciphertext: bytes
+    :param pk: bytes
+    :param sk: bytes
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+    ensure(
+        isinstance(ciphertext, bytes),
+        "input ciphertext must be bytes",
+        raising=TypeError,
+    )
+
+    ensure(
+        isinstance(pk, bytes), "public key must be bytes", raising=TypeError
+    )
+
+    ensure(
+        isinstance(sk, bytes), "secret key must be bytes", raising=TypeError
+    )
+
+    if len(pk) != crypto_box_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid public key")
+
+    if len(sk) != crypto_box_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    _clen = len(ciphertext)
+
+    ensure(
+        _clen >= crypto_box_SEALBYTES,
+        ("Input cyphertext must be at least {} long").format(
+            crypto_box_SEALBYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    _mlen = _clen - crypto_box_SEALBYTES
+
+    # zero-length malloc results are implementation.dependent
+    plaintext = ffi.new("unsigned char[]", max(1, _mlen))
+
+    res = lib.crypto_box_seal_open(plaintext, ciphertext, _clen, pk, sk)
+    ensure(
+        res == 0,
+        "An error occurred trying to decrypt the message",
+        raising=exc.CryptoError,
+    )
+
+    return ffi.buffer(plaintext, _mlen)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_core.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_core.py
new file mode 100644
index 0000000000000000000000000000000000000000..d29da9b3fc25ad78b4a33752a957b313a2b042bd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_core.py
@@ -0,0 +1,412 @@
+# Copyright 2018 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+has_crypto_core_ed25519 = bool(lib.PYNACL_HAS_CRYPTO_CORE_ED25519)
+
+crypto_core_ed25519_BYTES = 0
+crypto_core_ed25519_SCALARBYTES = 0
+crypto_core_ed25519_NONREDUCEDSCALARBYTES = 0
+
+if has_crypto_core_ed25519:
+    crypto_core_ed25519_BYTES = lib.crypto_core_ed25519_bytes()
+    crypto_core_ed25519_SCALARBYTES = lib.crypto_core_ed25519_scalarbytes()
+    crypto_core_ed25519_NONREDUCEDSCALARBYTES = (
+        lib.crypto_core_ed25519_nonreducedscalarbytes()
+    )
+
+
+def crypto_core_ed25519_is_valid_point(p: bytes) -> bool:
+    """
+    Check if ``p`` represents a point on the edwards25519 curve, in canonical
+    form, on the main subgroup, and that the point doesn't have a small order.
+
+    :param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type p: bytes
+    :return: point validity
+    :rtype: bool
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes) and len(p) == crypto_core_ed25519_BYTES,
+        "Point must be a crypto_core_ed25519_BYTES long bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    rc = lib.crypto_core_ed25519_is_valid_point(p)
+    return rc == 1
+
+
+def crypto_core_ed25519_add(p: bytes, q: bytes) -> bytes:
+    """
+    Add two points on the edwards25519 curve.
+
+    :param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type p: bytes
+    :param q: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type q: bytes
+    :return: a point on the edwards25519 curve represented as
+             a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes)
+        and isinstance(q, bytes)
+        and len(p) == crypto_core_ed25519_BYTES
+        and len(q) == crypto_core_ed25519_BYTES,
+        "Each point must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_BYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_BYTES)
+
+    rc = lib.crypto_core_ed25519_add(r, p, q)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(r, crypto_core_ed25519_BYTES)[:]
+
+
+def crypto_core_ed25519_sub(p: bytes, q: bytes) -> bytes:
+    """
+    Subtract a point from another on the edwards25519 curve.
+
+    :param p: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type p: bytes
+    :param q: a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type q: bytes
+    :return: a point on the edwards25519 curve represented as
+             a :py:data:`.crypto_core_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes)
+        and isinstance(q, bytes)
+        and len(p) == crypto_core_ed25519_BYTES
+        and len(q) == crypto_core_ed25519_BYTES,
+        "Each point must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_BYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_BYTES)
+
+    rc = lib.crypto_core_ed25519_sub(r, p, q)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(r, crypto_core_ed25519_BYTES)[:]
+
+
+def crypto_core_ed25519_scalar_invert(s: bytes) -> bytes:
+    """
+    Return the multiplicative inverse of integer ``s`` modulo ``L``,
+    i.e an integer ``i`` such that ``s * i = 1 (mod L)``, where ``L``
+    is the order of the main subgroup.
+
+    Raises a ``exc.RuntimeError`` if ``s`` is the integer zero.
+
+    :param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type s: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(s, bytes) and len(s) == crypto_core_ed25519_SCALARBYTES,
+        "Integer s must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    rc = lib.crypto_core_ed25519_scalar_invert(r, s)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_negate(s: bytes) -> bytes:
+    """
+    Return the integer ``n`` such that ``s + n = 0 (mod L)``, where ``L``
+    is the order of the main subgroup.
+
+    :param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type s: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(s, bytes) and len(s) == crypto_core_ed25519_SCALARBYTES,
+        "Integer s must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_negate(r, s)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_complement(s: bytes) -> bytes:
+    """
+    Return the complement of integer ``s`` modulo ``L``, i.e. an integer
+    ``c`` such that ``s + c = 1 (mod L)``, where ``L`` is the order of
+    the main subgroup.
+
+    :param s: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type s: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(s, bytes) and len(s) == crypto_core_ed25519_SCALARBYTES,
+        "Integer s must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_complement(r, s)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_add(p: bytes, q: bytes) -> bytes:
+    """
+    Add integers ``p`` and ``q`` modulo ``L``, where ``L`` is the order of
+    the main subgroup.
+
+    :param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type p: bytes
+    :param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type q: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes)
+        and isinstance(q, bytes)
+        and len(p) == crypto_core_ed25519_SCALARBYTES
+        and len(q) == crypto_core_ed25519_SCALARBYTES,
+        "Each integer must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_add(r, p, q)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_sub(p: bytes, q: bytes) -> bytes:
+    """
+    Subtract integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
+    order of the main subgroup.
+
+    :param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type p: bytes
+    :param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type q: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes)
+        and isinstance(q, bytes)
+        and len(p) == crypto_core_ed25519_SCALARBYTES
+        and len(q) == crypto_core_ed25519_SCALARBYTES,
+        "Each integer must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_sub(r, p, q)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_mul(p: bytes, q: bytes) -> bytes:
+    """
+    Multiply integers ``p`` and ``q`` modulo ``L``, where ``L`` is the
+    order of the main subgroup.
+
+    :param p: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type p: bytes
+    :param q: a :py:data:`.crypto_core_ed25519_SCALARBYTES`
+              long bytes sequence representing an integer
+    :type q: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(p, bytes)
+        and isinstance(q, bytes)
+        and len(p) == crypto_core_ed25519_SCALARBYTES
+        and len(q) == crypto_core_ed25519_SCALARBYTES,
+        "Each integer must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_mul(r, p, q)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
+
+
+def crypto_core_ed25519_scalar_reduce(s: bytes) -> bytes:
+    """
+    Reduce integer ``s`` to ``s`` modulo ``L``, where ``L`` is the order
+    of the main subgroup.
+
+    :param s: a :py:data:`.crypto_core_ed25519_NONREDUCEDSCALARBYTES`
+              long bytes sequence representing an integer
+    :type s: bytes
+    :return: an integer represented as a
+              :py:data:`.crypto_core_ed25519_SCALARBYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_core_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(s, bytes)
+        and len(s) == crypto_core_ed25519_NONREDUCEDSCALARBYTES,
+        "Integer s must be a {} long bytes sequence".format(
+            "crypto_core_ed25519_NONREDUCEDSCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    r = ffi.new("unsigned char[]", crypto_core_ed25519_SCALARBYTES)
+
+    lib.crypto_core_ed25519_scalar_reduce(r, s)
+
+    return ffi.buffer(r, crypto_core_ed25519_SCALARBYTES)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_generichash.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_generichash.py
new file mode 100644
index 0000000000000000000000000000000000000000..6ab385a59718221f54738f1727c757447427b04d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_generichash.py
@@ -0,0 +1,281 @@
+# Copyright 2013-2019 Donald Stufft and individual contributors
+#
+# 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 NoReturn, TypeVar
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+crypto_generichash_BYTES: int = lib.crypto_generichash_blake2b_bytes()
+crypto_generichash_BYTES_MIN: int = lib.crypto_generichash_blake2b_bytes_min()
+crypto_generichash_BYTES_MAX: int = lib.crypto_generichash_blake2b_bytes_max()
+crypto_generichash_KEYBYTES: int = lib.crypto_generichash_blake2b_keybytes()
+crypto_generichash_KEYBYTES_MIN: int = (
+    lib.crypto_generichash_blake2b_keybytes_min()
+)
+crypto_generichash_KEYBYTES_MAX: int = (
+    lib.crypto_generichash_blake2b_keybytes_max()
+)
+crypto_generichash_SALTBYTES: int = lib.crypto_generichash_blake2b_saltbytes()
+crypto_generichash_PERSONALBYTES: int = (
+    lib.crypto_generichash_blake2b_personalbytes()
+)
+crypto_generichash_STATEBYTES: int = lib.crypto_generichash_statebytes()
+
+_OVERLONG = "{0} length greater than {1} bytes"
+_TOOBIG = "{0} greater than {1}"
+
+
+def _checkparams(
+    digest_size: int, key: bytes, salt: bytes, person: bytes
+) -> None:
+    """Check hash parameters"""
+    ensure(
+        isinstance(key, bytes),
+        "Key must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(salt, bytes),
+        "Salt must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(person, bytes),
+        "Person must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(digest_size, int),
+        "Digest size must be an integer number",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        digest_size <= crypto_generichash_BYTES_MAX,
+        _TOOBIG.format("Digest_size", crypto_generichash_BYTES_MAX),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        len(key) <= crypto_generichash_KEYBYTES_MAX,
+        _OVERLONG.format("Key", crypto_generichash_KEYBYTES_MAX),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        len(salt) <= crypto_generichash_SALTBYTES,
+        _OVERLONG.format("Salt", crypto_generichash_SALTBYTES),
+        raising=exc.ValueError,
+    )
+
+    ensure(
+        len(person) <= crypto_generichash_PERSONALBYTES,
+        _OVERLONG.format("Person", crypto_generichash_PERSONALBYTES),
+        raising=exc.ValueError,
+    )
+
+
+def generichash_blake2b_salt_personal(
+    data: bytes,
+    digest_size: int = crypto_generichash_BYTES,
+    key: bytes = b"",
+    salt: bytes = b"",
+    person: bytes = b"",
+) -> bytes:
+    """One shot hash interface
+
+    :param data: the input data to the hash function
+    :type data: bytes
+    :param digest_size: must be at most
+                        :py:data:`.crypto_generichash_BYTES_MAX`;
+                        the default digest size is
+                        :py:data:`.crypto_generichash_BYTES`
+    :type digest_size: int
+    :param key: must be at most
+                :py:data:`.crypto_generichash_KEYBYTES_MAX` long
+    :type key: bytes
+    :param salt: must be at most
+                 :py:data:`.crypto_generichash_SALTBYTES` long;
+                 will be zero-padded if needed
+    :type salt: bytes
+    :param person: must be at most
+                   :py:data:`.crypto_generichash_PERSONALBYTES` long:
+                   will be zero-padded if needed
+    :type person: bytes
+    :return: digest_size long digest
+    :rtype: bytes
+    """
+
+    _checkparams(digest_size, key, salt, person)
+
+    ensure(
+        isinstance(data, bytes),
+        "Input data must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    digest = ffi.new("unsigned char[]", digest_size)
+
+    # both _salt and _personal must be zero-padded to the correct length
+    _salt = ffi.new("unsigned char []", crypto_generichash_SALTBYTES)
+    _person = ffi.new("unsigned char []", crypto_generichash_PERSONALBYTES)
+
+    ffi.memmove(_salt, salt, len(salt))
+    ffi.memmove(_person, person, len(person))
+
+    rc = lib.crypto_generichash_blake2b_salt_personal(
+        digest, digest_size, data, len(data), key, len(key), _salt, _person
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+    return ffi.buffer(digest, digest_size)[:]
+
+
+_Blake2State = TypeVar("_Blake2State", bound="Blake2State")
+
+
+class Blake2State:
+    """
+    Python-level wrapper for the crypto_generichash_blake2b state buffer
+    """
+
+    __slots__ = ["_statebuf", "digest_size"]
+
+    def __init__(self, digest_size: int):
+        self._statebuf = ffi.new(
+            "unsigned char[]", crypto_generichash_STATEBYTES
+        )
+        self.digest_size = digest_size
+
+    def __reduce__(self) -> NoReturn:
+        """
+        Raise the same exception as hashlib's blake implementation
+        on copy.copy()
+        """
+        raise TypeError(
+            "can't pickle {} objects".format(self.__class__.__name__)
+        )
+
+    def copy(self: _Blake2State) -> _Blake2State:
+        _st = self.__class__(self.digest_size)
+        ffi.memmove(
+            _st._statebuf, self._statebuf, crypto_generichash_STATEBYTES
+        )
+        return _st
+
+
+def generichash_blake2b_init(
+    key: bytes = b"",
+    salt: bytes = b"",
+    person: bytes = b"",
+    digest_size: int = crypto_generichash_BYTES,
+) -> Blake2State:
+    """
+    Create a new initialized blake2b hash state
+
+    :param key: must be at most
+                :py:data:`.crypto_generichash_KEYBYTES_MAX` long
+    :type key: bytes
+    :param salt: must be at most
+                 :py:data:`.crypto_generichash_SALTBYTES` long;
+                 will be zero-padded if needed
+    :type salt: bytes
+    :param person: must be at most
+                   :py:data:`.crypto_generichash_PERSONALBYTES` long:
+                   will be zero-padded if needed
+    :type person: bytes
+    :param digest_size: must be at most
+                        :py:data:`.crypto_generichash_BYTES_MAX`;
+                        the default digest size is
+                        :py:data:`.crypto_generichash_BYTES`
+    :type digest_size: int
+    :return: a initialized :py:class:`.Blake2State`
+    :rtype: object
+    """
+
+    _checkparams(digest_size, key, salt, person)
+
+    state = Blake2State(digest_size)
+
+    # both _salt and _personal must be zero-padded to the correct length
+    _salt = ffi.new("unsigned char []", crypto_generichash_SALTBYTES)
+    _person = ffi.new("unsigned char []", crypto_generichash_PERSONALBYTES)
+
+    ffi.memmove(_salt, salt, len(salt))
+    ffi.memmove(_person, person, len(person))
+
+    rc = lib.crypto_generichash_blake2b_init_salt_personal(
+        state._statebuf, key, len(key), digest_size, _salt, _person
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+    return state
+
+
+def generichash_blake2b_update(state: Blake2State, data: bytes) -> None:
+    """Update the blake2b hash state
+
+    :param state: a initialized Blake2bState object as returned from
+                     :py:func:`.crypto_generichash_blake2b_init`
+    :type state: :py:class:`.Blake2State`
+    :param data:
+    :type data: bytes
+    """
+
+    ensure(
+        isinstance(state, Blake2State),
+        "State must be a Blake2State object",
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(data, bytes),
+        "Input data must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+
+    rc = lib.crypto_generichash_blake2b_update(
+        state._statebuf, data, len(data)
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+
+def generichash_blake2b_final(state: Blake2State) -> bytes:
+    """Finalize the blake2b hash state and return the digest.
+
+    :param state: a initialized Blake2bState object as returned from
+                     :py:func:`.crypto_generichash_blake2b_init`
+    :type state: :py:class:`.Blake2State`
+    :return: the blake2 digest of the passed-in data stream
+    :rtype: bytes
+    """
+
+    ensure(
+        isinstance(state, Blake2State),
+        "State must be a Blake2State object",
+        raising=exc.TypeError,
+    )
+
+    _digest = ffi.new("unsigned char[]", crypto_generichash_BYTES_MAX)
+    rc = lib.crypto_generichash_blake2b_final(
+        state._statebuf, _digest, state.digest_size
+    )
+
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+    return ffi.buffer(_digest, state.digest_size)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_hash.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_hash.py
new file mode 100644
index 0000000000000000000000000000000000000000..2bab3991dff39423e0ef215f67a0b39877471828
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_hash.py
@@ -0,0 +1,63 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+# crypto_hash_BYTES = lib.crypto_hash_bytes()
+crypto_hash_BYTES: int = lib.crypto_hash_sha512_bytes()
+crypto_hash_sha256_BYTES: int = lib.crypto_hash_sha256_bytes()
+crypto_hash_sha512_BYTES: int = lib.crypto_hash_sha512_bytes()
+
+
+def crypto_hash(message: bytes) -> bytes:
+    """
+    Hashes and returns the message ``message``.
+
+    :param message: bytes
+    :rtype: bytes
+    """
+    digest = ffi.new("unsigned char[]", crypto_hash_BYTES)
+    rc = lib.crypto_hash(digest, message, len(message))
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+    return ffi.buffer(digest, crypto_hash_BYTES)[:]
+
+
+def crypto_hash_sha256(message: bytes) -> bytes:
+    """
+    Hashes and returns the message ``message``.
+
+    :param message: bytes
+    :rtype: bytes
+    """
+    digest = ffi.new("unsigned char[]", crypto_hash_sha256_BYTES)
+    rc = lib.crypto_hash_sha256(digest, message, len(message))
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+    return ffi.buffer(digest, crypto_hash_sha256_BYTES)[:]
+
+
+def crypto_hash_sha512(message: bytes) -> bytes:
+    """
+    Hashes and returns the message ``message``.
+
+    :param message: bytes
+    :rtype: bytes
+    """
+    digest = ffi.new("unsigned char[]", crypto_hash_sha512_BYTES)
+    rc = lib.crypto_hash_sha512(digest, message, len(message))
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+    return ffi.buffer(digest, crypto_hash_sha512_BYTES)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_kx.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_kx.py
new file mode 100644
index 0000000000000000000000000000000000000000..172a19f804d9958d1ff090f261969a1607b93b7b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_kx.py
@@ -0,0 +1,200 @@
+# Copyright 2018 Donald Stufft and individual contributors
+#
+# 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 Tuple
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+__all__ = [
+    "crypto_kx_keypair",
+    "crypto_kx_client_session_keys",
+    "crypto_kx_server_session_keys",
+    "crypto_kx_PUBLIC_KEY_BYTES",
+    "crypto_kx_SECRET_KEY_BYTES",
+    "crypto_kx_SEED_BYTES",
+    "crypto_kx_SESSION_KEY_BYTES",
+]
+
+"""
+Implementations of client, server key exchange
+"""
+crypto_kx_PUBLIC_KEY_BYTES: int = lib.crypto_kx_publickeybytes()
+crypto_kx_SECRET_KEY_BYTES: int = lib.crypto_kx_secretkeybytes()
+crypto_kx_SEED_BYTES: int = lib.crypto_kx_seedbytes()
+crypto_kx_SESSION_KEY_BYTES: int = lib.crypto_kx_sessionkeybytes()
+
+
+def crypto_kx_keypair() -> Tuple[bytes, bytes]:
+    """
+    Generate a keypair.
+    This is a duplicate crypto_box_keypair, but
+    is included for api consistency.
+    :return: (public_key, secret_key)
+    :rtype: (bytes, bytes)
+    """
+    public_key = ffi.new("unsigned char[]", crypto_kx_PUBLIC_KEY_BYTES)
+    secret_key = ffi.new("unsigned char[]", crypto_kx_SECRET_KEY_BYTES)
+    res = lib.crypto_kx_keypair(public_key, secret_key)
+    ensure(res == 0, "Key generation failed.", raising=exc.CryptoError)
+
+    return (
+        ffi.buffer(public_key, crypto_kx_PUBLIC_KEY_BYTES)[:],
+        ffi.buffer(secret_key, crypto_kx_SECRET_KEY_BYTES)[:],
+    )
+
+
+def crypto_kx_seed_keypair(seed: bytes) -> Tuple[bytes, bytes]:
+    """
+    Generate a keypair with a given seed.
+    This is functionally the same as crypto_box_seed_keypair, however
+    it uses the blake2b hash primitive instead of sha512.
+    It is included mainly for api consistency when using crypto_kx.
+    :param seed: random seed
+    :type seed: bytes
+    :return: (public_key, secret_key)
+    :rtype: (bytes, bytes)
+    """
+    public_key = ffi.new("unsigned char[]", crypto_kx_PUBLIC_KEY_BYTES)
+    secret_key = ffi.new("unsigned char[]", crypto_kx_SECRET_KEY_BYTES)
+    ensure(
+        isinstance(seed, bytes) and len(seed) == crypto_kx_SEED_BYTES,
+        "Seed must be a {} byte long bytes sequence".format(
+            crypto_kx_SEED_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+    res = lib.crypto_kx_seed_keypair(public_key, secret_key, seed)
+    ensure(res == 0, "Key generation failed.", raising=exc.CryptoError)
+
+    return (
+        ffi.buffer(public_key, crypto_kx_PUBLIC_KEY_BYTES)[:],
+        ffi.buffer(secret_key, crypto_kx_SECRET_KEY_BYTES)[:],
+    )
+
+
+def crypto_kx_client_session_keys(
+    client_public_key: bytes,
+    client_secret_key: bytes,
+    server_public_key: bytes,
+) -> Tuple[bytes, bytes]:
+    """
+    Generate session keys for the client.
+    :param client_public_key:
+    :type client_public_key: bytes
+    :param client_secret_key:
+    :type client_secret_key: bytes
+    :param server_public_key:
+    :type server_public_key: bytes
+    :return: (rx_key, tx_key)
+    :rtype: (bytes, bytes)
+    """
+    ensure(
+        isinstance(client_public_key, bytes)
+        and len(client_public_key) == crypto_kx_PUBLIC_KEY_BYTES,
+        "Client public key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(client_secret_key, bytes)
+        and len(client_secret_key) == crypto_kx_SECRET_KEY_BYTES,
+        "Client secret key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(server_public_key, bytes)
+        and len(server_public_key) == crypto_kx_PUBLIC_KEY_BYTES,
+        "Server public key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    rx_key = ffi.new("unsigned char[]", crypto_kx_SESSION_KEY_BYTES)
+    tx_key = ffi.new("unsigned char[]", crypto_kx_SESSION_KEY_BYTES)
+    res = lib.crypto_kx_client_session_keys(
+        rx_key, tx_key, client_public_key, client_secret_key, server_public_key
+    )
+    ensure(
+        res == 0,
+        "Client session key generation failed.",
+        raising=exc.CryptoError,
+    )
+
+    return (
+        ffi.buffer(rx_key, crypto_kx_SESSION_KEY_BYTES)[:],
+        ffi.buffer(tx_key, crypto_kx_SESSION_KEY_BYTES)[:],
+    )
+
+
+def crypto_kx_server_session_keys(
+    server_public_key: bytes,
+    server_secret_key: bytes,
+    client_public_key: bytes,
+) -> Tuple[bytes, bytes]:
+    """
+    Generate session keys for the server.
+    :param server_public_key:
+    :type server_public_key: bytes
+    :param server_secret_key:
+    :type server_secret_key: bytes
+    :param client_public_key:
+    :type client_public_key: bytes
+    :return: (rx_key, tx_key)
+    :rtype: (bytes, bytes)
+    """
+    ensure(
+        isinstance(server_public_key, bytes)
+        and len(server_public_key) == crypto_kx_PUBLIC_KEY_BYTES,
+        "Server public key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(server_secret_key, bytes)
+        and len(server_secret_key) == crypto_kx_SECRET_KEY_BYTES,
+        "Server secret key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(client_public_key, bytes)
+        and len(client_public_key) == crypto_kx_PUBLIC_KEY_BYTES,
+        "Client public key must be a {} bytes long bytes sequence".format(
+            crypto_kx_PUBLIC_KEY_BYTES
+        ),
+        raising=exc.TypeError,
+    )
+
+    rx_key = ffi.new("unsigned char[]", crypto_kx_SESSION_KEY_BYTES)
+    tx_key = ffi.new("unsigned char[]", crypto_kx_SESSION_KEY_BYTES)
+    res = lib.crypto_kx_server_session_keys(
+        rx_key, tx_key, server_public_key, server_secret_key, client_public_key
+    )
+    ensure(
+        res == 0,
+        "Server session key generation failed.",
+        raising=exc.CryptoError,
+    )
+
+    return (
+        ffi.buffer(rx_key, crypto_kx_SESSION_KEY_BYTES)[:],
+        ffi.buffer(tx_key, crypto_kx_SESSION_KEY_BYTES)[:],
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_pwhash.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_pwhash.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c4cc1a24402a1ca63a499a22c1a38c97c3c5ab4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_pwhash.py
@@ -0,0 +1,600 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 sys
+from typing import Tuple
+
+import nacl.exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+has_crypto_pwhash_scryptsalsa208sha256 = bool(
+    lib.PYNACL_HAS_CRYPTO_PWHASH_SCRYPTSALSA208SHA256
+)
+
+crypto_pwhash_scryptsalsa208sha256_STRPREFIX = b""
+crypto_pwhash_scryptsalsa208sha256_SALTBYTES = 0
+crypto_pwhash_scryptsalsa208sha256_STRBYTES = 0
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN = 0
+crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX = 0
+crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = 0
+crypto_pwhash_scryptsalsa208sha256_BYTES_MAX = 0
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN = 0
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX = 0
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN = 0
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX = 0
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE = 0
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE = 0
+crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE = 0
+crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE = 0
+
+if has_crypto_pwhash_scryptsalsa208sha256:
+    crypto_pwhash_scryptsalsa208sha256_STRPREFIX = ffi.string(
+        ffi.cast("char *", lib.crypto_pwhash_scryptsalsa208sha256_strprefix())
+    )[:]
+    crypto_pwhash_scryptsalsa208sha256_SALTBYTES = (
+        lib.crypto_pwhash_scryptsalsa208sha256_saltbytes()
+    )
+    crypto_pwhash_scryptsalsa208sha256_STRBYTES = (
+        lib.crypto_pwhash_scryptsalsa208sha256_strbytes()
+    )
+    crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN = (
+        lib.crypto_pwhash_scryptsalsa208sha256_passwd_min()
+    )
+    crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX = (
+        lib.crypto_pwhash_scryptsalsa208sha256_passwd_max()
+    )
+    crypto_pwhash_scryptsalsa208sha256_BYTES_MIN = (
+        lib.crypto_pwhash_scryptsalsa208sha256_bytes_min()
+    )
+    crypto_pwhash_scryptsalsa208sha256_BYTES_MAX = (
+        lib.crypto_pwhash_scryptsalsa208sha256_bytes_max()
+    )
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN = (
+        lib.crypto_pwhash_scryptsalsa208sha256_memlimit_min()
+    )
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX = (
+        lib.crypto_pwhash_scryptsalsa208sha256_memlimit_max()
+    )
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN = (
+        lib.crypto_pwhash_scryptsalsa208sha256_opslimit_min()
+    )
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX = (
+        lib.crypto_pwhash_scryptsalsa208sha256_opslimit_max()
+    )
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE = (
+        lib.crypto_pwhash_scryptsalsa208sha256_opslimit_interactive()
+    )
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE = (
+        lib.crypto_pwhash_scryptsalsa208sha256_memlimit_interactive()
+    )
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE = (
+        lib.crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive()
+    )
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE = (
+        lib.crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive()
+    )
+
+crypto_pwhash_ALG_ARGON2I13: int = lib.crypto_pwhash_alg_argon2i13()
+crypto_pwhash_ALG_ARGON2ID13: int = lib.crypto_pwhash_alg_argon2id13()
+crypto_pwhash_ALG_DEFAULT: int = lib.crypto_pwhash_alg_default()
+
+crypto_pwhash_SALTBYTES: int = lib.crypto_pwhash_saltbytes()
+crypto_pwhash_STRBYTES: int = lib.crypto_pwhash_strbytes()
+
+crypto_pwhash_PASSWD_MIN: int = lib.crypto_pwhash_passwd_min()
+crypto_pwhash_PASSWD_MAX: int = lib.crypto_pwhash_passwd_max()
+crypto_pwhash_BYTES_MIN: int = lib.crypto_pwhash_bytes_min()
+crypto_pwhash_BYTES_MAX: int = lib.crypto_pwhash_bytes_max()
+
+crypto_pwhash_argon2i_STRPREFIX: bytes = ffi.string(
+    ffi.cast("char *", lib.crypto_pwhash_argon2i_strprefix())
+)[:]
+crypto_pwhash_argon2i_MEMLIMIT_MIN: int = (
+    lib.crypto_pwhash_argon2i_memlimit_min()
+)
+crypto_pwhash_argon2i_MEMLIMIT_MAX: int = (
+    lib.crypto_pwhash_argon2i_memlimit_max()
+)
+crypto_pwhash_argon2i_OPSLIMIT_MIN: int = (
+    lib.crypto_pwhash_argon2i_opslimit_min()
+)
+crypto_pwhash_argon2i_OPSLIMIT_MAX: int = (
+    lib.crypto_pwhash_argon2i_opslimit_max()
+)
+crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE: int = (
+    lib.crypto_pwhash_argon2i_opslimit_interactive()
+)
+crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE: int = (
+    lib.crypto_pwhash_argon2i_memlimit_interactive()
+)
+crypto_pwhash_argon2i_OPSLIMIT_MODERATE: int = (
+    lib.crypto_pwhash_argon2i_opslimit_moderate()
+)
+crypto_pwhash_argon2i_MEMLIMIT_MODERATE: int = (
+    lib.crypto_pwhash_argon2i_memlimit_moderate()
+)
+crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE: int = (
+    lib.crypto_pwhash_argon2i_opslimit_sensitive()
+)
+crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE: int = (
+    lib.crypto_pwhash_argon2i_memlimit_sensitive()
+)
+
+crypto_pwhash_argon2id_STRPREFIX: bytes = ffi.string(
+    ffi.cast("char *", lib.crypto_pwhash_argon2id_strprefix())
+)[:]
+crypto_pwhash_argon2id_MEMLIMIT_MIN: int = (
+    lib.crypto_pwhash_argon2id_memlimit_min()
+)
+crypto_pwhash_argon2id_MEMLIMIT_MAX: int = (
+    lib.crypto_pwhash_argon2id_memlimit_max()
+)
+crypto_pwhash_argon2id_OPSLIMIT_MIN: int = (
+    lib.crypto_pwhash_argon2id_opslimit_min()
+)
+crypto_pwhash_argon2id_OPSLIMIT_MAX: int = (
+    lib.crypto_pwhash_argon2id_opslimit_max()
+)
+crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE: int = (
+    lib.crypto_pwhash_argon2id_opslimit_interactive()
+)
+crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE: int = (
+    lib.crypto_pwhash_argon2id_memlimit_interactive()
+)
+crypto_pwhash_argon2id_OPSLIMIT_MODERATE: int = (
+    lib.crypto_pwhash_argon2id_opslimit_moderate()
+)
+crypto_pwhash_argon2id_MEMLIMIT_MODERATE: int = (
+    lib.crypto_pwhash_argon2id_memlimit_moderate()
+)
+crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE: int = (
+    lib.crypto_pwhash_argon2id_opslimit_sensitive()
+)
+crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE: int = (
+    lib.crypto_pwhash_argon2id_memlimit_sensitive()
+)
+
+SCRYPT_OPSLIMIT_INTERACTIVE = (
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+)
+SCRYPT_MEMLIMIT_INTERACTIVE = (
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+)
+SCRYPT_OPSLIMIT_SENSITIVE = (
+    crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+)
+SCRYPT_MEMLIMIT_SENSITIVE = (
+    crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+)
+SCRYPT_SALTBYTES = crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+SCRYPT_STRBYTES = crypto_pwhash_scryptsalsa208sha256_STRBYTES
+
+SCRYPT_PR_MAX = (1 << 30) - 1
+LOG2_UINT64_MAX = 63
+UINT64_MAX = (1 << 64) - 1
+SCRYPT_MAX_MEM = 32 * (1024 * 1024)
+
+
+def _check_memory_occupation(
+    n: int, r: int, p: int, maxmem: int = SCRYPT_MAX_MEM
+) -> None:
+    ensure(r != 0, "Invalid block size", raising=exc.ValueError)
+
+    ensure(p != 0, "Invalid parallelization factor", raising=exc.ValueError)
+
+    ensure(
+        (n & (n - 1)) == 0,
+        "Cost factor must be a power of 2",
+        raising=exc.ValueError,
+    )
+
+    ensure(n > 1, "Cost factor must be at least 2", raising=exc.ValueError)
+
+    ensure(
+        p <= SCRYPT_PR_MAX / r,
+        "p*r is greater than {}".format(SCRYPT_PR_MAX),
+        raising=exc.ValueError,
+    )
+
+    ensure(n < (1 << (16 * r)), raising=exc.ValueError)
+
+    Blen = p * 128 * r
+
+    i = UINT64_MAX / 128
+
+    ensure(n + 2 <= i / r, raising=exc.ValueError)
+
+    Vlen = 32 * r * (n + 2) * 4
+
+    ensure(Blen <= UINT64_MAX - Vlen, raising=exc.ValueError)
+
+    ensure(Blen <= sys.maxsize - Vlen, raising=exc.ValueError)
+
+    ensure(
+        Blen + Vlen <= maxmem,
+        "Memory limit would be exceeded with the choosen n, r, p",
+        raising=exc.ValueError,
+    )
+
+
+def nacl_bindings_pick_scrypt_params(
+    opslimit: int, memlimit: int
+) -> Tuple[int, int, int]:
+    """Python implementation of libsodium's pickparams"""
+
+    if opslimit < 32768:
+        opslimit = 32768
+
+    r = 8
+
+    if opslimit < (memlimit // 32):
+        p = 1
+        maxn = opslimit // (4 * r)
+        for n_log2 in range(1, 63):  # pragma: no branch
+            if (2 ** n_log2) > (maxn // 2):
+                break
+    else:
+        maxn = memlimit // (r * 128)
+        for n_log2 in range(1, 63):  # pragma: no branch
+            if (2 ** n_log2) > maxn // 2:
+                break
+
+        maxrp = (opslimit // 4) // (2 ** n_log2)
+
+        if maxrp > 0x3FFFFFFF:  # pragma: no cover
+            maxrp = 0x3FFFFFFF
+
+        p = maxrp // r
+
+    return n_log2, r, p
+
+
+def crypto_pwhash_scryptsalsa208sha256_ll(
+    passwd: bytes,
+    salt: bytes,
+    n: int,
+    r: int,
+    p: int,
+    dklen: int = 64,
+    maxmem: int = SCRYPT_MAX_MEM,
+) -> bytes:
+    """
+    Derive a cryptographic key using the ``passwd`` and ``salt``
+    given as input.
+
+    The work factor can be tuned by by picking different
+    values for the parameters
+
+    :param bytes passwd:
+    :param bytes salt:
+    :param bytes salt: *must* be *exactly* :py:const:`.SALTBYTES` long
+    :param int dklen:
+    :param int opslimit:
+    :param int n:
+    :param int r: block size,
+    :param int p: the parallelism factor
+    :param int maxmem: the maximum available memory available for scrypt's
+                       operations
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_pwhash_scryptsalsa208sha256,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(isinstance(n, int), raising=TypeError)
+    ensure(isinstance(r, int), raising=TypeError)
+    ensure(isinstance(p, int), raising=TypeError)
+
+    ensure(isinstance(passwd, bytes), raising=TypeError)
+    ensure(isinstance(salt, bytes), raising=TypeError)
+
+    _check_memory_occupation(n, r, p, maxmem)
+
+    buf = ffi.new("uint8_t[]", dklen)
+
+    ret = lib.crypto_pwhash_scryptsalsa208sha256_ll(
+        passwd, len(passwd), salt, len(salt), n, r, p, buf, dklen
+    )
+
+    ensure(
+        ret == 0,
+        "Unexpected failure in key derivation",
+        raising=exc.RuntimeError,
+    )
+
+    return ffi.buffer(ffi.cast("char *", buf), dklen)[:]
+
+
+def crypto_pwhash_scryptsalsa208sha256_str(
+    passwd: bytes,
+    opslimit: int = SCRYPT_OPSLIMIT_INTERACTIVE,
+    memlimit: int = SCRYPT_MEMLIMIT_INTERACTIVE,
+) -> bytes:
+    """
+    Derive a cryptographic key using the ``passwd`` and ``salt``
+    given as input, returning a string representation which includes
+    the salt and the tuning parameters.
+
+    The returned string can be directly stored as a password hash.
+
+    See :py:func:`.crypto_pwhash_scryptsalsa208sha256` for a short
+    discussion about ``opslimit`` and ``memlimit`` values.
+
+    :param bytes passwd:
+    :param int opslimit:
+    :param int memlimit:
+    :return: serialized key hash, including salt and tuning parameters
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_pwhash_scryptsalsa208sha256,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    buf = ffi.new("char[]", SCRYPT_STRBYTES)
+
+    ret = lib.crypto_pwhash_scryptsalsa208sha256_str(
+        buf, passwd, len(passwd), opslimit, memlimit
+    )
+
+    ensure(
+        ret == 0,
+        "Unexpected failure in password hashing",
+        raising=exc.RuntimeError,
+    )
+
+    return ffi.string(buf)
+
+
+def crypto_pwhash_scryptsalsa208sha256_str_verify(
+    passwd_hash: bytes, passwd: bytes
+) -> bool:
+    """
+    Verifies the ``passwd`` against the ``passwd_hash`` that was generated.
+    Returns True or False depending on the success
+
+    :param passwd_hash: bytes
+    :param passwd: bytes
+    :rtype: boolean
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_pwhash_scryptsalsa208sha256,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        len(passwd_hash) == SCRYPT_STRBYTES - 1,
+        "Invalid password hash",
+        raising=exc.ValueError,
+    )
+
+    ret = lib.crypto_pwhash_scryptsalsa208sha256_str_verify(
+        passwd_hash, passwd, len(passwd)
+    )
+    ensure(ret == 0, "Wrong password", raising=exc.InvalidkeyError)
+    # all went well, therefore:
+    return True
+
+
+def _check_argon2_limits_alg(opslimit: int, memlimit: int, alg: int) -> None:
+
+    if alg == crypto_pwhash_ALG_ARGON2I13:
+        if memlimit < crypto_pwhash_argon2i_MEMLIMIT_MIN:
+            raise exc.ValueError(
+                "memlimit must be at least {} bytes".format(
+                    crypto_pwhash_argon2i_MEMLIMIT_MIN
+                )
+            )
+        elif memlimit > crypto_pwhash_argon2i_MEMLIMIT_MAX:
+            raise exc.ValueError(
+                "memlimit must be at most {} bytes".format(
+                    crypto_pwhash_argon2i_MEMLIMIT_MAX
+                )
+            )
+        if opslimit < crypto_pwhash_argon2i_OPSLIMIT_MIN:
+            raise exc.ValueError(
+                "opslimit must be at least {}".format(
+                    crypto_pwhash_argon2i_OPSLIMIT_MIN
+                )
+            )
+        elif opslimit > crypto_pwhash_argon2i_OPSLIMIT_MAX:
+            raise exc.ValueError(
+                "opslimit must be at most {}".format(
+                    crypto_pwhash_argon2i_OPSLIMIT_MAX
+                )
+            )
+
+    elif alg == crypto_pwhash_ALG_ARGON2ID13:
+        if memlimit < crypto_pwhash_argon2id_MEMLIMIT_MIN:
+            raise exc.ValueError(
+                "memlimit must be at least {} bytes".format(
+                    crypto_pwhash_argon2id_MEMLIMIT_MIN
+                )
+            )
+        elif memlimit > crypto_pwhash_argon2id_MEMLIMIT_MAX:
+            raise exc.ValueError(
+                "memlimit must be at most {} bytes".format(
+                    crypto_pwhash_argon2id_MEMLIMIT_MAX
+                )
+            )
+        if opslimit < crypto_pwhash_argon2id_OPSLIMIT_MIN:
+            raise exc.ValueError(
+                "opslimit must be at least {}".format(
+                    crypto_pwhash_argon2id_OPSLIMIT_MIN
+                )
+            )
+        elif opslimit > crypto_pwhash_argon2id_OPSLIMIT_MAX:
+            raise exc.ValueError(
+                "opslimit must be at most {}".format(
+                    crypto_pwhash_argon2id_OPSLIMIT_MAX
+                )
+            )
+    else:
+        raise exc.TypeError("Unsupported algorithm")
+
+
+def crypto_pwhash_alg(
+    outlen: int,
+    passwd: bytes,
+    salt: bytes,
+    opslimit: int,
+    memlimit: int,
+    alg: int,
+) -> bytes:
+    """
+    Derive a raw cryptographic key using the ``passwd`` and the ``salt``
+    given as input to the ``alg`` algorithm.
+
+    :param outlen: the length of the derived key
+    :type outlen: int
+    :param passwd: The input password
+    :type passwd: bytes
+    :param salt:
+    :type salt: bytes
+    :param opslimit: computational cost
+    :type opslimit: int
+    :param memlimit: memory cost
+    :type memlimit: int
+    :param alg: algorithm identifier
+    :type alg: int
+    :return: derived key
+    :rtype: bytes
+    """
+    ensure(isinstance(outlen, int), raising=exc.TypeError)
+    ensure(isinstance(opslimit, int), raising=exc.TypeError)
+    ensure(isinstance(memlimit, int), raising=exc.TypeError)
+    ensure(isinstance(alg, int), raising=exc.TypeError)
+    ensure(isinstance(passwd, bytes), raising=exc.TypeError)
+
+    if len(salt) != crypto_pwhash_SALTBYTES:
+        raise exc.ValueError(
+            "salt must be exactly {} bytes long".format(
+                crypto_pwhash_SALTBYTES
+            )
+        )
+
+    if outlen < crypto_pwhash_BYTES_MIN:
+        raise exc.ValueError(
+            "derived key must be at least {} bytes long".format(
+                crypto_pwhash_BYTES_MIN
+            )
+        )
+
+    elif outlen > crypto_pwhash_BYTES_MAX:
+        raise exc.ValueError(
+            "derived key must be at most {} bytes long".format(
+                crypto_pwhash_BYTES_MAX
+            )
+        )
+
+    _check_argon2_limits_alg(opslimit, memlimit, alg)
+
+    outbuf = ffi.new("unsigned char[]", outlen)
+
+    ret = lib.crypto_pwhash(
+        outbuf, outlen, passwd, len(passwd), salt, opslimit, memlimit, alg
+    )
+
+    ensure(
+        ret == 0,
+        "Unexpected failure in key derivation",
+        raising=exc.RuntimeError,
+    )
+
+    return ffi.buffer(outbuf, outlen)[:]
+
+
+def crypto_pwhash_str_alg(
+    passwd: bytes,
+    opslimit: int,
+    memlimit: int,
+    alg: int,
+) -> bytes:
+    """
+    Derive a cryptographic key using the ``passwd`` given as input
+    and a random salt, returning a string representation which
+    includes the salt, the tuning parameters and the used algorithm.
+
+    :param passwd: The input password
+    :type passwd: bytes
+    :param opslimit: computational cost
+    :type opslimit: int
+    :param memlimit: memory cost
+    :type memlimit: int
+    :param alg: The algorithm to use
+    :type alg: int
+    :return: serialized derived key and parameters
+    :rtype: bytes
+    """
+    ensure(isinstance(opslimit, int), raising=TypeError)
+    ensure(isinstance(memlimit, int), raising=TypeError)
+    ensure(isinstance(passwd, bytes), raising=TypeError)
+
+    _check_argon2_limits_alg(opslimit, memlimit, alg)
+
+    outbuf = ffi.new("char[]", 128)
+
+    ret = lib.crypto_pwhash_str_alg(
+        outbuf, passwd, len(passwd), opslimit, memlimit, alg
+    )
+
+    ensure(
+        ret == 0,
+        "Unexpected failure in key derivation",
+        raising=exc.RuntimeError,
+    )
+
+    return ffi.string(outbuf)
+
+
+def crypto_pwhash_str_verify(passwd_hash: bytes, passwd: bytes) -> bool:
+    """
+    Verifies the ``passwd`` against a given password hash.
+
+    Returns True on success, raises InvalidkeyError on failure
+    :param passwd_hash: saved password hash
+    :type passwd_hash: bytes
+    :param passwd: password to be checked
+    :type passwd: bytes
+    :return: success
+    :rtype: boolean
+    """
+    ensure(isinstance(passwd_hash, bytes), raising=TypeError)
+    ensure(isinstance(passwd, bytes), raising=TypeError)
+    ensure(
+        len(passwd_hash) <= 127,
+        "Hash must be at most 127 bytes long",
+        raising=exc.ValueError,
+    )
+
+    ret = lib.crypto_pwhash_str_verify(passwd_hash, passwd, len(passwd))
+
+    ensure(ret == 0, "Wrong password", raising=exc.InvalidkeyError)
+    # all went well, therefore:
+    return True
+
+
+crypto_pwhash_argon2i_str_verify = crypto_pwhash_str_verify
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_scalarmult.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_scalarmult.py
new file mode 100644
index 0000000000000000000000000000000000000000..ca4a2819d9a01f05da2df5dea3d13a3f23a64d22
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_scalarmult.py
@@ -0,0 +1,240 @@
+# Copyright 2013-2018 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+has_crypto_scalarmult_ed25519 = bool(lib.PYNACL_HAS_CRYPTO_SCALARMULT_ED25519)
+
+crypto_scalarmult_BYTES: int = lib.crypto_scalarmult_bytes()
+crypto_scalarmult_SCALARBYTES: int = lib.crypto_scalarmult_scalarbytes()
+
+crypto_scalarmult_ed25519_BYTES = 0
+crypto_scalarmult_ed25519_SCALARBYTES = 0
+
+if has_crypto_scalarmult_ed25519:
+    crypto_scalarmult_ed25519_BYTES = lib.crypto_scalarmult_ed25519_bytes()
+    crypto_scalarmult_ed25519_SCALARBYTES = (
+        lib.crypto_scalarmult_ed25519_scalarbytes()
+    )
+
+
+def crypto_scalarmult_base(n: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of a standard group element and an
+    integer ``n``.
+
+    :param n: bytes
+    :rtype: bytes
+    """
+    q = ffi.new("unsigned char[]", crypto_scalarmult_BYTES)
+
+    rc = lib.crypto_scalarmult_base(q, n)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]
+
+
+def crypto_scalarmult(n: bytes, p: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of the given group element and an
+    integer ``n``.
+
+    :param p: bytes
+    :param n: bytes
+    :rtype: bytes
+    """
+    q = ffi.new("unsigned char[]", crypto_scalarmult_BYTES)
+
+    rc = lib.crypto_scalarmult(q, n, p)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_SCALARBYTES)[:]
+
+
+def crypto_scalarmult_ed25519_base(n: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of a standard group element and an
+    integer ``n`` on the edwards25519 curve.
+
+    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
+              sequence representing a scalar
+    :type n: bytes
+    :return: a point on the edwards25519 curve, represented as a
+             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_scalarmult_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(n, bytes)
+        and len(n) == crypto_scalarmult_ed25519_SCALARBYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    q = ffi.new("unsigned char[]", crypto_scalarmult_ed25519_BYTES)
+
+    rc = lib.crypto_scalarmult_ed25519_base(q, n)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_ed25519_BYTES)[:]
+
+
+def crypto_scalarmult_ed25519_base_noclamp(n: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of a standard group element and an
+    integer ``n`` on the edwards25519 curve. The integer ``n`` is not clamped.
+
+    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
+              sequence representing a scalar
+    :type n: bytes
+    :return: a point on the edwards25519 curve, represented as a
+             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_scalarmult_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(n, bytes)
+        and len(n) == crypto_scalarmult_ed25519_SCALARBYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    q = ffi.new("unsigned char[]", crypto_scalarmult_ed25519_BYTES)
+
+    rc = lib.crypto_scalarmult_ed25519_base_noclamp(q, n)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_ed25519_BYTES)[:]
+
+
+def crypto_scalarmult_ed25519(n: bytes, p: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of a *clamped* integer ``n``
+    and the given group element on the edwards25519 curve.
+    The scalar is clamped, as done in the public key generation case,
+    by setting to zero the bits in position [0, 1, 2, 255] and setting
+    to one the bit in position 254.
+
+    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
+              sequence representing a scalar
+    :type n: bytes
+    :param p: a :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type p: bytes
+    :return: a point on the edwards25519 curve, represented as a
+             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_scalarmult_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(n, bytes)
+        and len(n) == crypto_scalarmult_ed25519_SCALARBYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(p, bytes) and len(p) == crypto_scalarmult_ed25519_BYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_BYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    q = ffi.new("unsigned char[]", crypto_scalarmult_ed25519_BYTES)
+
+    rc = lib.crypto_scalarmult_ed25519(q, n, p)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_ed25519_BYTES)[:]
+
+
+def crypto_scalarmult_ed25519_noclamp(n: bytes, p: bytes) -> bytes:
+    """
+    Computes and returns the scalar product of an integer ``n``
+    and the given group element on the edwards25519 curve. The integer
+    ``n`` is not clamped.
+
+    :param n: a :py:data:`.crypto_scalarmult_ed25519_SCALARBYTES` long bytes
+              sequence representing a scalar
+    :type n: bytes
+    :param p: a :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+              representing a point on the edwards25519 curve
+    :type p: bytes
+    :return: a point on the edwards25519 curve, represented as a
+             :py:data:`.crypto_scalarmult_ed25519_BYTES` long bytes sequence
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_scalarmult_ed25519,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        isinstance(n, bytes)
+        and len(n) == crypto_scalarmult_ed25519_SCALARBYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_SCALARBYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    ensure(
+        isinstance(p, bytes) and len(p) == crypto_scalarmult_ed25519_BYTES,
+        "Input must be a {} long bytes sequence".format(
+            "crypto_scalarmult_ed25519_BYTES"
+        ),
+        raising=exc.TypeError,
+    )
+
+    q = ffi.new("unsigned char[]", crypto_scalarmult_ed25519_BYTES)
+
+    rc = lib.crypto_scalarmult_ed25519_noclamp(q, n, p)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(q, crypto_scalarmult_ed25519_BYTES)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretbox.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretbox.py
new file mode 100644
index 0000000000000000000000000000000000000000..2a632a2bc4d547a12a6402e5fbe01a1744e915a0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretbox.py
@@ -0,0 +1,86 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+crypto_secretbox_KEYBYTES: int = lib.crypto_secretbox_keybytes()
+crypto_secretbox_NONCEBYTES: int = lib.crypto_secretbox_noncebytes()
+crypto_secretbox_ZEROBYTES: int = lib.crypto_secretbox_zerobytes()
+crypto_secretbox_BOXZEROBYTES: int = lib.crypto_secretbox_boxzerobytes()
+crypto_secretbox_MACBYTES: int = lib.crypto_secretbox_macbytes()
+crypto_secretbox_MESSAGEBYTES_MAX: int = (
+    lib.crypto_secretbox_messagebytes_max()
+)
+
+
+def crypto_secretbox(message: bytes, nonce: bytes, key: bytes) -> bytes:
+    """
+    Encrypts and returns the message ``message`` with the secret ``key`` and
+    the nonce ``nonce``.
+
+    :param message: bytes
+    :param nonce: bytes
+    :param key: bytes
+    :rtype: bytes
+    """
+    if len(key) != crypto_secretbox_KEYBYTES:
+        raise exc.ValueError("Invalid key")
+
+    if len(nonce) != crypto_secretbox_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce")
+
+    padded = b"\x00" * crypto_secretbox_ZEROBYTES + message
+    ciphertext = ffi.new("unsigned char[]", len(padded))
+
+    res = lib.crypto_secretbox(ciphertext, padded, len(padded), nonce, key)
+    ensure(res == 0, "Encryption failed", raising=exc.CryptoError)
+
+    ciphertext = ffi.buffer(ciphertext, len(padded))
+    return ciphertext[crypto_secretbox_BOXZEROBYTES:]
+
+
+def crypto_secretbox_open(
+    ciphertext: bytes, nonce: bytes, key: bytes
+) -> bytes:
+    """
+    Decrypt and returns the encrypted message ``ciphertext`` with the secret
+    ``key`` and the nonce ``nonce``.
+
+    :param ciphertext: bytes
+    :param nonce: bytes
+    :param key: bytes
+    :rtype: bytes
+    """
+    if len(key) != crypto_secretbox_KEYBYTES:
+        raise exc.ValueError("Invalid key")
+
+    if len(nonce) != crypto_secretbox_NONCEBYTES:
+        raise exc.ValueError("Invalid nonce")
+
+    padded = b"\x00" * crypto_secretbox_BOXZEROBYTES + ciphertext
+    plaintext = ffi.new("unsigned char[]", len(padded))
+
+    res = lib.crypto_secretbox_open(plaintext, padded, len(padded), nonce, key)
+    ensure(
+        res == 0,
+        "Decryption failed. Ciphertext failed verification",
+        raising=exc.CryptoError,
+    )
+
+    plaintext = ffi.buffer(plaintext, len(padded))
+    return plaintext[crypto_secretbox_ZEROBYTES:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretstream.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretstream.py
new file mode 100644
index 0000000000000000000000000000000000000000..d7c6725e54f70a023cffd34f4f9ebd080cd73987
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_secretstream.py
@@ -0,0 +1,357 @@
+# Copyright 2013-2018 Donald Stufft and individual contributors
+#
+# 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 ByteString, Optional, Tuple, cast
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+crypto_secretstream_xchacha20poly1305_ABYTES: int = (
+    lib.crypto_secretstream_xchacha20poly1305_abytes()
+)
+crypto_secretstream_xchacha20poly1305_HEADERBYTES: int = (
+    lib.crypto_secretstream_xchacha20poly1305_headerbytes()
+)
+crypto_secretstream_xchacha20poly1305_KEYBYTES: int = (
+    lib.crypto_secretstream_xchacha20poly1305_keybytes()
+)
+crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX: int = (
+    lib.crypto_secretstream_xchacha20poly1305_messagebytes_max()
+)
+crypto_secretstream_xchacha20poly1305_STATEBYTES: int = (
+    lib.crypto_secretstream_xchacha20poly1305_statebytes()
+)
+
+
+crypto_secretstream_xchacha20poly1305_TAG_MESSAGE: int = (
+    lib.crypto_secretstream_xchacha20poly1305_tag_message()
+)
+crypto_secretstream_xchacha20poly1305_TAG_PUSH: int = (
+    lib.crypto_secretstream_xchacha20poly1305_tag_push()
+)
+crypto_secretstream_xchacha20poly1305_TAG_REKEY: int = (
+    lib.crypto_secretstream_xchacha20poly1305_tag_rekey()
+)
+crypto_secretstream_xchacha20poly1305_TAG_FINAL: int = (
+    lib.crypto_secretstream_xchacha20poly1305_tag_final()
+)
+
+
+def crypto_secretstream_xchacha20poly1305_keygen() -> bytes:
+    """
+    Generate a key for use with
+    :func:`.crypto_secretstream_xchacha20poly1305_init_push`.
+
+    """
+    keybuf = ffi.new(
+        "unsigned char[]",
+        crypto_secretstream_xchacha20poly1305_KEYBYTES,
+    )
+    lib.crypto_secretstream_xchacha20poly1305_keygen(keybuf)
+    return ffi.buffer(keybuf)[:]
+
+
+class crypto_secretstream_xchacha20poly1305_state:
+    """
+    An object wrapping the crypto_secretstream_xchacha20poly1305 state.
+
+    """
+
+    __slots__ = ["statebuf", "rawbuf", "tagbuf"]
+
+    def __init__(self) -> None:
+        """Initialize a clean state object."""
+        self.statebuf: ByteString = ffi.new(
+            "unsigned char[]",
+            crypto_secretstream_xchacha20poly1305_STATEBYTES,
+        )
+
+        self.rawbuf: Optional[ByteString] = None
+        self.tagbuf: Optional[ByteString] = None
+
+
+def crypto_secretstream_xchacha20poly1305_init_push(
+    state: crypto_secretstream_xchacha20poly1305_state, key: bytes
+) -> bytes:
+    """
+    Initialize a crypto_secretstream_xchacha20poly1305 encryption buffer.
+
+    :param state: a secretstream state object
+    :type state: crypto_secretstream_xchacha20poly1305_state
+    :param key: must be
+                :data:`.crypto_secretstream_xchacha20poly1305_KEYBYTES` long
+    :type key: bytes
+    :return: header
+    :rtype: bytes
+
+    """
+    ensure(
+        isinstance(state, crypto_secretstream_xchacha20poly1305_state),
+        "State must be a crypto_secretstream_xchacha20poly1305_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(key, bytes),
+        "Key must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(key) == crypto_secretstream_xchacha20poly1305_KEYBYTES,
+        "Invalid key length",
+        raising=exc.ValueError,
+    )
+
+    headerbuf = ffi.new(
+        "unsigned char []",
+        crypto_secretstream_xchacha20poly1305_HEADERBYTES,
+    )
+
+    rc = lib.crypto_secretstream_xchacha20poly1305_init_push(
+        state.statebuf, headerbuf, key
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+    return ffi.buffer(headerbuf)[:]
+
+
+def crypto_secretstream_xchacha20poly1305_push(
+    state: crypto_secretstream_xchacha20poly1305_state,
+    m: bytes,
+    ad: Optional[bytes] = None,
+    tag: int = crypto_secretstream_xchacha20poly1305_TAG_MESSAGE,
+) -> bytes:
+    """
+    Add an encrypted message to the secret stream.
+
+    :param state: a secretstream state object
+    :type state: crypto_secretstream_xchacha20poly1305_state
+    :param m: the message to encrypt, the maximum length of an individual
+              message is
+              :data:`.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX`.
+    :type m: bytes
+    :param ad: additional data to include in the authentication tag
+    :type ad: bytes or None
+    :param tag: the message tag, usually
+                :data:`.crypto_secretstream_xchacha20poly1305_TAG_MESSAGE` or
+                :data:`.crypto_secretstream_xchacha20poly1305_TAG_FINAL`.
+    :type tag: int
+    :return: ciphertext
+    :rtype: bytes
+
+    """
+    ensure(
+        isinstance(state, crypto_secretstream_xchacha20poly1305_state),
+        "State must be a crypto_secretstream_xchacha20poly1305_state object",
+        raising=exc.TypeError,
+    )
+    ensure(isinstance(m, bytes), "Message is not bytes", raising=exc.TypeError)
+    ensure(
+        len(m) <= crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX,
+        "Message is too long",
+        raising=exc.ValueError,
+    )
+    ensure(
+        ad is None or isinstance(ad, bytes),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    clen = len(m) + crypto_secretstream_xchacha20poly1305_ABYTES
+    if state.rawbuf is None or len(state.rawbuf) < clen:
+        state.rawbuf = ffi.new("unsigned char[]", clen)
+
+    if ad is None:
+        ad = ffi.NULL
+        adlen = 0
+    else:
+        adlen = len(ad)
+
+    rc = lib.crypto_secretstream_xchacha20poly1305_push(
+        state.statebuf,
+        state.rawbuf,
+        ffi.NULL,
+        m,
+        len(m),
+        ad,
+        adlen,
+        tag,
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+    return ffi.buffer(state.rawbuf, clen)[:]
+
+
+def crypto_secretstream_xchacha20poly1305_init_pull(
+    state: crypto_secretstream_xchacha20poly1305_state,
+    header: bytes,
+    key: bytes,
+) -> None:
+    """
+    Initialize a crypto_secretstream_xchacha20poly1305 decryption buffer.
+
+    :param state: a secretstream state object
+    :type state: crypto_secretstream_xchacha20poly1305_state
+    :param header: must be
+                :data:`.crypto_secretstream_xchacha20poly1305_HEADERBYTES` long
+    :type header: bytes
+    :param key: must be
+                :data:`.crypto_secretstream_xchacha20poly1305_KEYBYTES` long
+    :type key: bytes
+
+    """
+    ensure(
+        isinstance(state, crypto_secretstream_xchacha20poly1305_state),
+        "State must be a crypto_secretstream_xchacha20poly1305_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(header, bytes),
+        "Header must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(header) == crypto_secretstream_xchacha20poly1305_HEADERBYTES,
+        "Invalid header length",
+        raising=exc.ValueError,
+    )
+    ensure(
+        isinstance(key, bytes),
+        "Key must be a bytes sequence",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(key) == crypto_secretstream_xchacha20poly1305_KEYBYTES,
+        "Invalid key length",
+        raising=exc.ValueError,
+    )
+
+    if state.tagbuf is None:
+        state.tagbuf = ffi.new("unsigned char *")
+
+    rc = lib.crypto_secretstream_xchacha20poly1305_init_pull(
+        state.statebuf, header, key
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+
+def crypto_secretstream_xchacha20poly1305_pull(
+    state: crypto_secretstream_xchacha20poly1305_state,
+    c: bytes,
+    ad: Optional[bytes] = None,
+) -> Tuple[bytes, int]:
+    """
+    Read a decrypted message from the secret stream.
+
+    :param state: a secretstream state object
+    :type state: crypto_secretstream_xchacha20poly1305_state
+    :param c: the ciphertext to decrypt, the maximum length of an individual
+              ciphertext is
+              :data:`.crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX` +
+              :data:`.crypto_secretstream_xchacha20poly1305_ABYTES`.
+    :type c: bytes
+    :param ad: additional data to include in the authentication tag
+    :type ad: bytes or None
+    :return: (message, tag)
+    :rtype: (bytes, int)
+
+    """
+    ensure(
+        isinstance(state, crypto_secretstream_xchacha20poly1305_state),
+        "State must be a crypto_secretstream_xchacha20poly1305_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        state.tagbuf is not None,
+        (
+            "State must be initialized using "
+            "crypto_secretstream_xchacha20poly1305_init_pull"
+        ),
+        raising=exc.ValueError,
+    )
+    ensure(
+        isinstance(c, bytes),
+        "Ciphertext is not bytes",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(c) >= crypto_secretstream_xchacha20poly1305_ABYTES,
+        "Ciphertext is too short",
+        raising=exc.ValueError,
+    )
+    ensure(
+        len(c)
+        <= (
+            crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX
+            + crypto_secretstream_xchacha20poly1305_ABYTES
+        ),
+        "Ciphertext is too long",
+        raising=exc.ValueError,
+    )
+    ensure(
+        ad is None or isinstance(ad, bytes),
+        "Additional data must be bytes or None",
+        raising=exc.TypeError,
+    )
+
+    mlen = len(c) - crypto_secretstream_xchacha20poly1305_ABYTES
+    if state.rawbuf is None or len(state.rawbuf) < mlen:
+        state.rawbuf = ffi.new("unsigned char[]", mlen)
+
+    if ad is None:
+        ad = ffi.NULL
+        adlen = 0
+    else:
+        adlen = len(ad)
+
+    rc = lib.crypto_secretstream_xchacha20poly1305_pull(
+        state.statebuf,
+        state.rawbuf,
+        ffi.NULL,
+        state.tagbuf,
+        c,
+        len(c),
+        ad,
+        adlen,
+    )
+    ensure(rc == 0, "Unexpected failure", raising=exc.RuntimeError)
+
+    # Cast safety: we `ensure` above that `state.tagbuf is not None`.
+    return (
+        ffi.buffer(state.rawbuf, mlen)[:],
+        int(cast(bytes, state.tagbuf)[0]),
+    )
+
+
+def crypto_secretstream_xchacha20poly1305_rekey(
+    state: crypto_secretstream_xchacha20poly1305_state,
+) -> None:
+    """
+    Explicitly change the encryption key in the stream.
+
+    Normally the stream is re-keyed as needed or an explicit ``tag`` of
+    :data:`.crypto_secretstream_xchacha20poly1305_TAG_REKEY` is added to a
+    message to ensure forward secrecy, but this method can be used instead
+    if the re-keying is controlled without adding the tag.
+
+    :param state: a secretstream state object
+    :type state: crypto_secretstream_xchacha20poly1305_state
+
+    """
+    ensure(
+        isinstance(state, crypto_secretstream_xchacha20poly1305_state),
+        "State must be a crypto_secretstream_xchacha20poly1305_state object",
+        raising=exc.TypeError,
+    )
+    lib.crypto_secretstream_xchacha20poly1305_rekey(state.statebuf)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_shorthash.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_shorthash.py
new file mode 100644
index 0000000000000000000000000000000000000000..8f7d209e44dc277323f4df4d8fc4e1b726603fb3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_shorthash.py
@@ -0,0 +1,81 @@
+# Copyright 2016 Donald Stufft and individual contributors
+#
+# 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 nacl.exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+has_crypto_shorthash_siphashx24 = bool(
+    lib.PYNACL_HAS_CRYPTO_SHORTHASH_SIPHASHX24
+)
+
+BYTES: int = lib.crypto_shorthash_siphash24_bytes()
+KEYBYTES: int = lib.crypto_shorthash_siphash24_keybytes()
+
+XBYTES = 0
+XKEYBYTES = 0
+
+if has_crypto_shorthash_siphashx24:
+    XBYTES = lib.crypto_shorthash_siphashx24_bytes()
+    XKEYBYTES = lib.crypto_shorthash_siphashx24_keybytes()
+
+
+def crypto_shorthash_siphash24(data: bytes, key: bytes) -> bytes:
+    """Compute a fast, cryptographic quality, keyed hash of the input data
+
+    :param data:
+    :type data: bytes
+    :param key: len(key) must be equal to
+                :py:data:`.KEYBYTES` (16)
+    :type key: bytes
+    """
+    if len(key) != KEYBYTES:
+        raise exc.ValueError(
+            "Key length must be exactly {} bytes".format(KEYBYTES)
+        )
+    digest = ffi.new("unsigned char[]", BYTES)
+    rc = lib.crypto_shorthash_siphash24(digest, data, len(data), key)
+
+    ensure(rc == 0, raising=exc.RuntimeError)
+    return ffi.buffer(digest, BYTES)[:]
+
+
+def crypto_shorthash_siphashx24(data: bytes, key: bytes) -> bytes:
+    """Compute a fast, cryptographic quality, keyed hash of the input data
+
+    :param data:
+    :type data: bytes
+    :param key: len(key) must be equal to
+                :py:data:`.XKEYBYTES` (16)
+    :type key: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+    """
+    ensure(
+        has_crypto_shorthash_siphashx24,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    if len(key) != XKEYBYTES:
+        raise exc.ValueError(
+            "Key length must be exactly {} bytes".format(XKEYBYTES)
+        )
+    digest = ffi.new("unsigned char[]", XBYTES)
+    rc = lib.crypto_shorthash_siphashx24(digest, data, len(data), key)
+
+    ensure(rc == 0, raising=exc.RuntimeError)
+    return ffi.buffer(digest, XBYTES)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_sign.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_sign.py
new file mode 100644
index 0000000000000000000000000000000000000000..de3be47a1b24d9953ec8cb30c08d9b855172bae5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/crypto_sign.py
@@ -0,0 +1,327 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 Tuple
+
+from nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+crypto_sign_BYTES: int = lib.crypto_sign_bytes()
+# crypto_sign_SEEDBYTES = lib.crypto_sign_seedbytes()
+crypto_sign_SEEDBYTES: int = lib.crypto_sign_secretkeybytes() // 2
+crypto_sign_PUBLICKEYBYTES: int = lib.crypto_sign_publickeybytes()
+crypto_sign_SECRETKEYBYTES: int = lib.crypto_sign_secretkeybytes()
+
+crypto_sign_curve25519_BYTES: int = lib.crypto_box_secretkeybytes()
+
+crypto_sign_ed25519ph_STATEBYTES: int = lib.crypto_sign_ed25519ph_statebytes()
+
+
+def crypto_sign_keypair() -> Tuple[bytes, bytes]:
+    """
+    Returns a randomly generated public key and secret key.
+
+    :rtype: (bytes(public_key), bytes(secret_key))
+    """
+    pk = ffi.new("unsigned char[]", crypto_sign_PUBLICKEYBYTES)
+    sk = ffi.new("unsigned char[]", crypto_sign_SECRETKEYBYTES)
+
+    rc = lib.crypto_sign_keypair(pk, sk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return (
+        ffi.buffer(pk, crypto_sign_PUBLICKEYBYTES)[:],
+        ffi.buffer(sk, crypto_sign_SECRETKEYBYTES)[:],
+    )
+
+
+def crypto_sign_seed_keypair(seed: bytes) -> Tuple[bytes, bytes]:
+    """
+    Computes and returns the public key and secret key using the seed ``seed``.
+
+    :param seed: bytes
+    :rtype: (bytes(public_key), bytes(secret_key))
+    """
+    if len(seed) != crypto_sign_SEEDBYTES:
+        raise exc.ValueError("Invalid seed")
+
+    pk = ffi.new("unsigned char[]", crypto_sign_PUBLICKEYBYTES)
+    sk = ffi.new("unsigned char[]", crypto_sign_SECRETKEYBYTES)
+
+    rc = lib.crypto_sign_seed_keypair(pk, sk, seed)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return (
+        ffi.buffer(pk, crypto_sign_PUBLICKEYBYTES)[:],
+        ffi.buffer(sk, crypto_sign_SECRETKEYBYTES)[:],
+    )
+
+
+def crypto_sign(message: bytes, sk: bytes) -> bytes:
+    """
+    Signs the message ``message`` using the secret key ``sk`` and returns the
+    signed message.
+
+    :param message: bytes
+    :param sk: bytes
+    :rtype: bytes
+    """
+    signed = ffi.new("unsigned char[]", len(message) + crypto_sign_BYTES)
+    signed_len = ffi.new("unsigned long long *")
+
+    rc = lib.crypto_sign(signed, signed_len, message, len(message), sk)
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(signed, signed_len[0])[:]
+
+
+def crypto_sign_open(signed: bytes, pk: bytes) -> bytes:
+    """
+    Verifies the signature of the signed message ``signed`` using the public
+    key ``pk`` and returns the unsigned message.
+
+    :param signed: bytes
+    :param pk: bytes
+    :rtype: bytes
+    """
+    message = ffi.new("unsigned char[]", len(signed))
+    message_len = ffi.new("unsigned long long *")
+
+    if (
+        lib.crypto_sign_open(message, message_len, signed, len(signed), pk)
+        != 0
+    ):
+        raise exc.BadSignatureError("Signature was forged or corrupt")
+
+    return ffi.buffer(message, message_len[0])[:]
+
+
+def crypto_sign_ed25519_pk_to_curve25519(public_key_bytes: bytes) -> bytes:
+    """
+    Converts a public Ed25519 key (encoded as bytes ``public_key_bytes``) to
+    a public Curve25519 key as bytes.
+
+    Raises a ValueError if ``public_key_bytes`` is not of length
+    ``crypto_sign_PUBLICKEYBYTES``
+
+    :param public_key_bytes: bytes
+    :rtype: bytes
+    """
+    if len(public_key_bytes) != crypto_sign_PUBLICKEYBYTES:
+        raise exc.ValueError("Invalid curve public key")
+
+    curve_public_key_len = crypto_sign_curve25519_BYTES
+    curve_public_key = ffi.new("unsigned char[]", curve_public_key_len)
+
+    rc = lib.crypto_sign_ed25519_pk_to_curve25519(
+        curve_public_key, public_key_bytes
+    )
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(curve_public_key, curve_public_key_len)[:]
+
+
+def crypto_sign_ed25519_sk_to_curve25519(secret_key_bytes: bytes) -> bytes:
+    """
+    Converts a secret Ed25519 key (encoded as bytes ``secret_key_bytes``) to
+    a secret Curve25519 key as bytes.
+
+    Raises a ValueError if ``secret_key_bytes``is not of length
+    ``crypto_sign_SECRETKEYBYTES``
+
+    :param secret_key_bytes: bytes
+    :rtype: bytes
+    """
+    if len(secret_key_bytes) != crypto_sign_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid curve secret key")
+
+    curve_secret_key_len = crypto_sign_curve25519_BYTES
+    curve_secret_key = ffi.new("unsigned char[]", curve_secret_key_len)
+
+    rc = lib.crypto_sign_ed25519_sk_to_curve25519(
+        curve_secret_key, secret_key_bytes
+    )
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(curve_secret_key, curve_secret_key_len)[:]
+
+
+def crypto_sign_ed25519_sk_to_pk(secret_key_bytes: bytes) -> bytes:
+    """
+    Extract the public Ed25519 key from a secret Ed25519 key (encoded
+    as bytes ``secret_key_bytes``).
+
+    Raises a ValueError if ``secret_key_bytes``is not of length
+    ``crypto_sign_SECRETKEYBYTES``
+
+    :param secret_key_bytes: bytes
+    :rtype: bytes
+    """
+    if len(secret_key_bytes) != crypto_sign_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    return secret_key_bytes[crypto_sign_SEEDBYTES:]
+
+
+def crypto_sign_ed25519_sk_to_seed(secret_key_bytes: bytes) -> bytes:
+    """
+    Extract the seed from a secret Ed25519 key (encoded
+    as bytes ``secret_key_bytes``).
+
+    Raises a ValueError if ``secret_key_bytes``is not of length
+    ``crypto_sign_SECRETKEYBYTES``
+
+    :param secret_key_bytes: bytes
+    :rtype: bytes
+    """
+    if len(secret_key_bytes) != crypto_sign_SECRETKEYBYTES:
+        raise exc.ValueError("Invalid secret key")
+
+    return secret_key_bytes[:crypto_sign_SEEDBYTES]
+
+
+class crypto_sign_ed25519ph_state:
+    """
+    State object wrapping the sha-512 state used in ed25519ph computation
+    """
+
+    __slots__ = ["state"]
+
+    def __init__(self) -> None:
+        self.state: bytes = ffi.new(
+            "unsigned char[]", crypto_sign_ed25519ph_STATEBYTES
+        )
+
+        rc = lib.crypto_sign_ed25519ph_init(self.state)
+
+        ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+
+def crypto_sign_ed25519ph_update(
+    edph: crypto_sign_ed25519ph_state, pmsg: bytes
+) -> None:
+    """
+    Update the hash state wrapped in edph
+
+    :param edph: the ed25519ph state being updated
+    :type edph: crypto_sign_ed25519ph_state
+    :param pmsg: the partial message
+    :type pmsg: bytes
+    :rtype: None
+    """
+    ensure(
+        isinstance(edph, crypto_sign_ed25519ph_state),
+        "edph parameter must be a ed25519ph_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(pmsg, bytes),
+        "pmsg parameter must be a bytes object",
+        raising=exc.TypeError,
+    )
+    rc = lib.crypto_sign_ed25519ph_update(edph.state, pmsg, len(pmsg))
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+
+def crypto_sign_ed25519ph_final_create(
+    edph: crypto_sign_ed25519ph_state, sk: bytes
+) -> bytes:
+    """
+    Create a signature for the data hashed in edph
+    using the secret key sk
+
+    :param edph: the ed25519ph state for the data
+                 being signed
+    :type edph: crypto_sign_ed25519ph_state
+    :param sk: the ed25519 secret part of the signing key
+    :type sk: bytes
+    :return: ed25519ph signature
+    :rtype: bytes
+    """
+    ensure(
+        isinstance(edph, crypto_sign_ed25519ph_state),
+        "edph parameter must be a ed25519ph_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(sk, bytes),
+        "secret key parameter must be a bytes object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(sk) == crypto_sign_SECRETKEYBYTES,
+        ("secret key must be {} bytes long").format(
+            crypto_sign_SECRETKEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+    signature = ffi.new("unsigned char[]", crypto_sign_BYTES)
+    rc = lib.crypto_sign_ed25519ph_final_create(
+        edph.state, signature, ffi.NULL, sk
+    )
+    ensure(rc == 0, "Unexpected library error", raising=exc.RuntimeError)
+
+    return ffi.buffer(signature, crypto_sign_BYTES)[:]
+
+
+def crypto_sign_ed25519ph_final_verify(
+    edph: crypto_sign_ed25519ph_state, signature: bytes, pk: bytes
+) -> bool:
+    """
+    Verify a prehashed signature using the public key pk
+
+    :param edph: the ed25519ph state for the data
+                 being verified
+    :type edph: crypto_sign_ed25519ph_state
+    :param signature: the signature being verified
+    :type signature: bytes
+    :param pk: the ed25519 public part of the signing key
+    :type pk: bytes
+    :return: True if the signature is valid
+    :rtype: boolean
+    :raises exc.BadSignatureError: if the signature is not valid
+    """
+    ensure(
+        isinstance(edph, crypto_sign_ed25519ph_state),
+        "edph parameter must be a ed25519ph_state object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(signature, bytes),
+        "signature parameter must be a bytes object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(signature) == crypto_sign_BYTES,
+        ("signature must be {} bytes long").format(crypto_sign_BYTES),
+        raising=exc.TypeError,
+    )
+    ensure(
+        isinstance(pk, bytes),
+        "public key parameter must be a bytes object",
+        raising=exc.TypeError,
+    )
+    ensure(
+        len(pk) == crypto_sign_PUBLICKEYBYTES,
+        ("public key must be {} bytes long").format(
+            crypto_sign_PUBLICKEYBYTES
+        ),
+        raising=exc.TypeError,
+    )
+    rc = lib.crypto_sign_ed25519ph_final_verify(edph.state, signature, pk)
+    if rc != 0:
+        raise exc.BadSignatureError("Signature was forged or corrupt")
+
+    return True
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/randombytes.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/randombytes.py
new file mode 100644
index 0000000000000000000000000000000000000000..ed76deb5f978b549e312957aa84588b25e32176f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/randombytes.py
@@ -0,0 +1,51 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+
+randombytes_SEEDBYTES: int = lib.randombytes_seedbytes()
+
+
+def randombytes(size: int) -> bytes:
+    """
+    Returns ``size`` number of random bytes from a cryptographically secure
+    random source.
+
+    :param size: int
+    :rtype: bytes
+    """
+    buf = ffi.new("unsigned char[]", size)
+    lib.randombytes(buf, size)
+    return ffi.buffer(buf, size)[:]
+
+
+def randombytes_buf_deterministic(size: int, seed: bytes) -> bytes:
+    """
+    Returns ``size`` number of deterministically generated pseudorandom bytes
+    from a seed
+
+    :param size: int
+    :param seed: bytes
+    :rtype: bytes
+    """
+    if len(seed) != randombytes_SEEDBYTES:
+        raise exc.TypeError(
+            "Deterministic random bytes must be generated from 32 bytes"
+        )
+
+    buf = ffi.new("unsigned char[]", size)
+    lib.randombytes_buf_deterministic(buf, size, seed)
+    return ffi.buffer(buf, size)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/sodium_core.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/sodium_core.py
new file mode 100644
index 0000000000000000000000000000000000000000..7ebb84c82b2cd91f7b607de82082e93c7364b0c6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/sodium_core.py
@@ -0,0 +1,33 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl import exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+def _sodium_init() -> None:
+    ensure(
+        lib.sodium_init() != -1,
+        "Could not initialize sodium",
+        raising=exc.RuntimeError,
+    )
+
+
+def sodium_init() -> None:
+    """
+    Initializes sodium, picking the best implementations available for this
+    machine.
+    """
+    ffi.init_once(_sodium_init, "libsodium")
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/utils.py b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..0ff22e34fc05b37cf4b1b667154949b519d72056
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/bindings/utils.py
@@ -0,0 +1,141 @@
+# Copyright 2013-2017 Donald Stufft and individual contributors
+#
+# 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 nacl.exceptions as exc
+from nacl._sodium import ffi, lib
+from nacl.exceptions import ensure
+
+
+def sodium_memcmp(inp1: bytes, inp2: bytes) -> bool:
+    """
+    Compare contents of two memory regions in constant time
+    """
+    ensure(isinstance(inp1, bytes), raising=exc.TypeError)
+    ensure(isinstance(inp2, bytes), raising=exc.TypeError)
+
+    ln = max(len(inp1), len(inp2))
+
+    buf1 = ffi.new("char []", ln)
+    buf2 = ffi.new("char []", ln)
+
+    ffi.memmove(buf1, inp1, len(inp1))
+    ffi.memmove(buf2, inp2, len(inp2))
+
+    eqL = len(inp1) == len(inp2)
+    eqC = lib.sodium_memcmp(buf1, buf2, ln) == 0
+
+    return eqL and eqC
+
+
+def sodium_pad(s: bytes, blocksize: int) -> bytes:
+    """
+    Pad the input bytearray ``s`` to a multiple of ``blocksize``
+    using the ISO/IEC 7816-4 algorithm
+
+    :param s: input bytes string
+    :type s: bytes
+    :param blocksize:
+    :type blocksize: int
+    :return: padded string
+    :rtype: bytes
+    """
+    ensure(isinstance(s, bytes), raising=exc.TypeError)
+    ensure(isinstance(blocksize, int), raising=exc.TypeError)
+    if blocksize <= 0:
+        raise exc.ValueError
+    s_len = len(s)
+    m_len = s_len + blocksize
+    buf = ffi.new("unsigned char []", m_len)
+    p_len = ffi.new("size_t []", 1)
+    ffi.memmove(buf, s, s_len)
+    rc = lib.sodium_pad(p_len, buf, s_len, blocksize, m_len)
+    ensure(rc == 0, "Padding failure", raising=exc.CryptoError)
+    return ffi.buffer(buf, p_len[0])[:]
+
+
+def sodium_unpad(s: bytes, blocksize: int) -> bytes:
+    """
+    Remove ISO/IEC 7816-4 padding from the input byte array ``s``
+
+    :param s: input bytes string
+    :type s: bytes
+    :param blocksize:
+    :type blocksize: int
+    :return: unpadded string
+    :rtype: bytes
+    """
+    ensure(isinstance(s, bytes), raising=exc.TypeError)
+    ensure(isinstance(blocksize, int), raising=exc.TypeError)
+    s_len = len(s)
+    u_len = ffi.new("size_t []", 1)
+    rc = lib.sodium_unpad(u_len, s, s_len, blocksize)
+    if rc != 0:
+        raise exc.CryptoError("Unpadding failure")
+    return s[: u_len[0]]
+
+
+def sodium_increment(inp: bytes) -> bytes:
+    """
+    Increment the value of a byte-sequence interpreted
+    as the little-endian representation of a unsigned big integer.
+
+    :param inp: input bytes buffer
+    :type inp: bytes
+    :return: a byte-sequence representing, as a little-endian
+             unsigned big integer, the value ``to_int(inp)``
+             incremented by one.
+    :rtype: bytes
+
+    """
+    ensure(isinstance(inp, bytes), raising=exc.TypeError)
+
+    ln = len(inp)
+    buf = ffi.new("unsigned char []", ln)
+
+    ffi.memmove(buf, inp, ln)
+
+    lib.sodium_increment(buf, ln)
+
+    return ffi.buffer(buf, ln)[:]
+
+
+def sodium_add(a: bytes, b: bytes) -> bytes:
+    """
+    Given a couple of *same-sized* byte sequences, interpreted as the
+    little-endian representation of two unsigned integers, compute
+    the modular addition of the represented values, in constant time for
+    a given common length of the byte sequences.
+
+    :param a: input bytes buffer
+    :type a: bytes
+    :param b: input bytes buffer
+    :type b: bytes
+    :return: a byte-sequence representing, as a little-endian big integer,
+             the integer value of ``(to_int(a) + to_int(b)) mod 2^(8*len(a))``
+    :rtype: bytes
+    """
+    ensure(isinstance(a, bytes), raising=exc.TypeError)
+    ensure(isinstance(b, bytes), raising=exc.TypeError)
+    ln = len(a)
+    ensure(len(b) == ln, raising=exc.TypeError)
+
+    buf_a = ffi.new("unsigned char []", ln)
+    buf_b = ffi.new("unsigned char []", ln)
+
+    ffi.memmove(buf_a, a, ln)
+    ffi.memmove(buf_b, b, ln)
+
+    lib.sodium_add(buf_a, buf_b, ln)
+
+    return ffi.buffer(buf_a, ln)[:]
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/encoding.py b/TP03/TP03/lib/python3.9/site-packages/nacl/encoding.py
new file mode 100644
index 0000000000000000000000000000000000000000..6740cfb31c2d5e9dfd7ea50cc29560d15b45301f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/encoding.py
@@ -0,0 +1,105 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 base64
+import binascii
+from abc import ABCMeta, abstractmethod
+from typing import SupportsBytes, Type
+
+
+# TODO: when the minimum supported version of Python is 3.8, we can import
+# Protocol from typing, and replace Encoder with a Protocol instead.
+class _Encoder(metaclass=ABCMeta):
+    @staticmethod
+    @abstractmethod
+    def encode(data: bytes) -> bytes:
+        """Transform raw data to encoded data."""
+
+    @staticmethod
+    @abstractmethod
+    def decode(data: bytes) -> bytes:
+        """Transform encoded data back to raw data.
+
+        Decoding after encoding should be a no-op, i.e. `decode(encode(x)) == x`.
+        """
+
+
+# Functions that use encoders are passed a subclass of _Encoder, not an instance
+# (because the methods are all static). Let's gloss over that detail by defining
+# an alias for Type[_Encoder].
+Encoder = Type[_Encoder]
+
+
+class RawEncoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return data
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return data
+
+
+class HexEncoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return binascii.hexlify(data)
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return binascii.unhexlify(data)
+
+
+class Base16Encoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return base64.b16encode(data)
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return base64.b16decode(data)
+
+
+class Base32Encoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return base64.b32encode(data)
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return base64.b32decode(data)
+
+
+class Base64Encoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return base64.b64encode(data)
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return base64.b64decode(data)
+
+
+class URLSafeBase64Encoder(_Encoder):
+    @staticmethod
+    def encode(data: bytes) -> bytes:
+        return base64.urlsafe_b64encode(data)
+
+    @staticmethod
+    def decode(data: bytes) -> bytes:
+        return base64.urlsafe_b64decode(data)
+
+
+class Encodable:
+    def encode(self: SupportsBytes, encoder: Encoder = RawEncoder) -> bytes:
+        return encoder.encode(bytes(self))
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/exceptions.py b/TP03/TP03/lib/python3.9/site-packages/nacl/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..e321df7bde364dee597f68b89ed99afc86369422
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/exceptions.py
@@ -0,0 +1,88 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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.
+
+
+# We create a clone of various builtin Exception types which additionally
+# inherit from CryptoError. Below, we refer to the parent types via the
+# `builtins` namespace, so mypy can distinguish between (e.g.)
+# `nacl.exceptions.RuntimeError` and `builtins.RuntimeError`.
+import builtins
+from typing import Type
+
+
+class CryptoError(Exception):
+    """
+    Base exception for all nacl related errors
+    """
+
+
+class BadSignatureError(CryptoError):
+    """
+    Raised when the signature was forged or otherwise corrupt.
+    """
+
+
+class RuntimeError(builtins.RuntimeError, CryptoError):
+    pass
+
+
+class AssertionError(builtins.AssertionError, CryptoError):
+    pass
+
+
+class TypeError(builtins.TypeError, CryptoError):
+    pass
+
+
+class ValueError(builtins.ValueError, CryptoError):
+    pass
+
+
+class InvalidkeyError(CryptoError):
+    pass
+
+
+class CryptPrefixError(InvalidkeyError):
+    pass
+
+
+class UnavailableError(RuntimeError):
+    """
+    is a subclass of :class:`~nacl.exceptions.RuntimeError`, raised when
+    trying to call functions not available in a minimal build of
+    libsodium.
+    """
+
+    pass
+
+
+def ensure(cond: bool, *args: object, **kwds: Type[Exception]) -> None:
+    """
+    Return if a condition is true, otherwise raise a caller-configurable
+    :py:class:`Exception`
+    :param bool cond: the condition to be checked
+    :param sequence args: the arguments to be passed to the exception's
+                          constructor
+    The only accepted named parameter is `raising` used to configure the
+    exception to be raised if `cond` is not `True`
+    """
+    _CHK_UNEXP = "check_condition() got an unexpected keyword argument {0}"
+
+    raising = kwds.pop("raising", AssertionError)
+    if kwds:
+        raise TypeError(_CHK_UNEXP.format(repr(kwds.popitem()[0])))
+
+    if cond is True:
+        return
+    raise raising(*args)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/hash.py b/TP03/TP03/lib/python3.9/site-packages/nacl/hash.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb8cff6b156d60bb89757eb8bd8bb6bca2805680
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/hash.py
@@ -0,0 +1,182 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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.
+"""
+The :mod:`nacl.hash` module exposes one-shot interfaces
+for libsodium selected hash primitives and the constants needed
+for their usage.
+"""
+
+
+import nacl.bindings
+import nacl.encoding
+
+
+BLAKE2B_BYTES = nacl.bindings.crypto_generichash_BYTES
+"""Default digest size for :func:`blake2b` hash"""
+BLAKE2B_BYTES_MIN = nacl.bindings.crypto_generichash_BYTES_MIN
+"""Minimum allowed digest size for :func:`blake2b` hash"""
+BLAKE2B_BYTES_MAX = nacl.bindings.crypto_generichash_BYTES_MAX
+"""Maximum allowed digest size for :func:`blake2b` hash"""
+BLAKE2B_KEYBYTES = nacl.bindings.crypto_generichash_KEYBYTES
+"""Default size of the ``key`` byte array for :func:`blake2b` hash"""
+BLAKE2B_KEYBYTES_MIN = nacl.bindings.crypto_generichash_KEYBYTES_MIN
+"""Minimum allowed size of the ``key`` byte array for :func:`blake2b` hash"""
+BLAKE2B_KEYBYTES_MAX = nacl.bindings.crypto_generichash_KEYBYTES_MAX
+"""Maximum allowed size of the ``key`` byte array for :func:`blake2b` hash"""
+BLAKE2B_SALTBYTES = nacl.bindings.crypto_generichash_SALTBYTES
+"""Maximum allowed length of the ``salt`` byte array for
+:func:`blake2b` hash"""
+BLAKE2B_PERSONALBYTES = nacl.bindings.crypto_generichash_PERSONALBYTES
+"""Maximum allowed length of the ``personalization``
+byte array for :func:`blake2b` hash"""
+
+SIPHASH_BYTES = nacl.bindings.crypto_shorthash_siphash24_BYTES
+"""Size of the :func:`siphash24` digest"""
+SIPHASH_KEYBYTES = nacl.bindings.crypto_shorthash_siphash24_KEYBYTES
+"""Size of the secret ``key`` used by the :func:`siphash24` MAC"""
+
+SIPHASHX_AVAILABLE = nacl.bindings.has_crypto_shorthash_siphashx24
+"""``True`` if :func:`siphashx24` is available to be called"""
+
+SIPHASHX_BYTES = nacl.bindings.crypto_shorthash_siphashx24_BYTES
+"""Size of the :func:`siphashx24` digest"""
+SIPHASHX_KEYBYTES = nacl.bindings.crypto_shorthash_siphashx24_KEYBYTES
+"""Size of the secret ``key`` used by the :func:`siphashx24` MAC"""
+
+_b2b_hash = nacl.bindings.crypto_generichash_blake2b_salt_personal
+_sip_hash = nacl.bindings.crypto_shorthash_siphash24
+_sip_hashx = nacl.bindings.crypto_shorthash_siphashx24
+
+
+def sha256(
+    message: bytes, encoder: nacl.encoding.Encoder = nacl.encoding.HexEncoder
+) -> bytes:
+    """
+    Hashes ``message`` with SHA256.
+
+    :param message: The message to hash.
+    :type message: bytes
+    :param encoder: A class that is able to encode the hashed message.
+    :returns: The hashed message.
+    :rtype: bytes
+    """
+    return encoder.encode(nacl.bindings.crypto_hash_sha256(message))
+
+
+def sha512(
+    message: bytes, encoder: nacl.encoding.Encoder = nacl.encoding.HexEncoder
+) -> bytes:
+    """
+    Hashes ``message`` with SHA512.
+
+    :param message: The message to hash.
+    :type message: bytes
+    :param encoder: A class that is able to encode the hashed message.
+    :returns: The hashed message.
+    :rtype: bytes
+    """
+    return encoder.encode(nacl.bindings.crypto_hash_sha512(message))
+
+
+def blake2b(
+    data: bytes,
+    digest_size: int = BLAKE2B_BYTES,
+    key: bytes = b"",
+    salt: bytes = b"",
+    person: bytes = b"",
+    encoder: nacl.encoding.Encoder = nacl.encoding.HexEncoder,
+) -> bytes:
+    """
+    Hashes ``data`` with blake2b.
+
+    :param data: the digest input byte sequence
+    :type data: bytes
+    :param digest_size: the requested digest size; must be at most
+                        :const:`BLAKE2B_BYTES_MAX`;
+                        the default digest size is
+                        :const:`BLAKE2B_BYTES`
+    :type digest_size: int
+    :param key: the key to be set for keyed MAC/PRF usage; if set, the key
+                must be at most :data:`~nacl.hash.BLAKE2B_KEYBYTES_MAX` long
+    :type key: bytes
+    :param salt: an initialization salt at most
+                 :const:`BLAKE2B_SALTBYTES` long;
+                 it will be zero-padded if needed
+    :type salt: bytes
+    :param person: a personalization string at most
+                   :const:`BLAKE2B_PERSONALBYTES` long;
+                   it will be zero-padded if needed
+    :type person: bytes
+    :param encoder: the encoder to use on returned digest
+    :type encoder: class
+    :returns: The hashed message.
+    :rtype: bytes
+    """
+
+    digest = _b2b_hash(
+        data, digest_size=digest_size, key=key, salt=salt, person=person
+    )
+    return encoder.encode(digest)
+
+
+generichash = blake2b
+
+
+def siphash24(
+    message: bytes,
+    key: bytes = b"",
+    encoder: nacl.encoding.Encoder = nacl.encoding.HexEncoder,
+) -> bytes:
+    """
+    Computes a keyed MAC of ``message`` using the short-input-optimized
+    siphash-2-4 construction.
+
+    :param message: The message to hash.
+    :type message: bytes
+    :param key: the message authentication key for the siphash MAC construct
+    :type key: bytes(:const:`SIPHASH_KEYBYTES`)
+    :param encoder: A class that is able to encode the hashed message.
+    :returns: The hashed message.
+    :rtype: bytes(:const:`SIPHASH_BYTES`)
+    """
+    digest = _sip_hash(message, key)
+    return encoder.encode(digest)
+
+
+shorthash = siphash24
+
+
+def siphashx24(
+    message: bytes,
+    key: bytes = b"",
+    encoder: nacl.encoding.Encoder = nacl.encoding.HexEncoder,
+) -> bytes:
+    """
+    Computes a keyed MAC of ``message`` using the 128 bit variant of the
+    siphash-2-4 construction.
+
+    :param message: The message to hash.
+    :type message: bytes
+    :param key: the message authentication key for the siphash MAC construct
+    :type key: bytes(:const:`SIPHASHX_KEYBYTES`)
+    :param encoder: A class that is able to encode the hashed message.
+    :returns: The hashed message.
+    :rtype: bytes(:const:`SIPHASHX_BYTES`)
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+
+    .. versionadded:: 1.2
+    """
+    digest = _sip_hashx(message, key)
+    return encoder.encode(digest)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/hashlib.py b/TP03/TP03/lib/python3.9/site-packages/nacl/hashlib.py
new file mode 100644
index 0000000000000000000000000000000000000000..4fd4a976b4d285f6d92e6133e3d69c96c282fcea
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/hashlib.py
@@ -0,0 +1,143 @@
+# Copyright 2016-2019 Donald Stufft and individual contributors
+#
+# 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 binascii
+from typing import NoReturn
+
+import nacl.bindings
+from nacl.utils import bytes_as_string
+
+BYTES = nacl.bindings.crypto_generichash_BYTES
+BYTES_MIN = nacl.bindings.crypto_generichash_BYTES_MIN
+BYTES_MAX = nacl.bindings.crypto_generichash_BYTES_MAX
+KEYBYTES = nacl.bindings.crypto_generichash_KEYBYTES
+KEYBYTES_MIN = nacl.bindings.crypto_generichash_KEYBYTES_MIN
+KEYBYTES_MAX = nacl.bindings.crypto_generichash_KEYBYTES_MAX
+SALTBYTES = nacl.bindings.crypto_generichash_SALTBYTES
+PERSONALBYTES = nacl.bindings.crypto_generichash_PERSONALBYTES
+
+SCRYPT_AVAILABLE = nacl.bindings.has_crypto_pwhash_scryptsalsa208sha256
+
+_b2b_init = nacl.bindings.crypto_generichash_blake2b_init
+_b2b_final = nacl.bindings.crypto_generichash_blake2b_final
+_b2b_update = nacl.bindings.crypto_generichash_blake2b_update
+
+
+class blake2b:
+    """
+    :py:mod:`hashlib` API compatible blake2b algorithm implementation
+    """
+
+    MAX_DIGEST_SIZE = BYTES
+    MAX_KEY_SIZE = KEYBYTES_MAX
+    PERSON_SIZE = PERSONALBYTES
+    SALT_SIZE = SALTBYTES
+
+    def __init__(
+        self,
+        data: bytes = b"",
+        digest_size: int = BYTES,
+        key: bytes = b"",
+        salt: bytes = b"",
+        person: bytes = b"",
+    ):
+        """
+        :py:class:`.blake2b` algorithm initializer
+
+        :param data:
+        :type data: bytes
+        :param int digest_size: the requested digest size; must be
+                                at most :py:attr:`.MAX_DIGEST_SIZE`;
+                                the default digest size is :py:data:`.BYTES`
+        :param key: the key to be set for keyed MAC/PRF usage; if set,
+                    the key must be at most :py:data:`.KEYBYTES_MAX` long
+        :type key: bytes
+        :param salt: a initialization salt at most
+                     :py:attr:`.SALT_SIZE` long; it will be zero-padded
+                     if needed
+        :type salt: bytes
+        :param person: a personalization string at most
+                       :py:attr:`.PERSONAL_SIZE` long; it will be zero-padded
+                       if needed
+        :type person: bytes
+        """
+
+        self._state = _b2b_init(
+            key=key, salt=salt, person=person, digest_size=digest_size
+        )
+        self._digest_size = digest_size
+
+        if data:
+            self.update(data)
+
+    @property
+    def digest_size(self) -> int:
+        return self._digest_size
+
+    @property
+    def block_size(self) -> int:
+        return 128
+
+    @property
+    def name(self) -> str:
+        return "blake2b"
+
+    def update(self, data: bytes) -> None:
+        _b2b_update(self._state, data)
+
+    def digest(self) -> bytes:
+        _st = self._state.copy()
+        return _b2b_final(_st)
+
+    def hexdigest(self) -> str:
+        return bytes_as_string(binascii.hexlify(self.digest()))
+
+    def copy(self) -> "blake2b":
+        _cp = type(self)(digest_size=self.digest_size)
+        _st = self._state.copy()
+        _cp._state = _st
+        return _cp
+
+    def __reduce__(self) -> NoReturn:
+        """
+        Raise the same exception as hashlib's blake implementation
+        on copy.copy()
+        """
+        raise TypeError(
+            "can't pickle {} objects".format(self.__class__.__name__)
+        )
+
+
+def scrypt(
+    password: bytes,
+    salt: bytes = b"",
+    n: int = 2 ** 20,
+    r: int = 8,
+    p: int = 1,
+    maxmem: int = 2 ** 25,
+    dklen: int = 64,
+) -> bytes:
+    """
+    Derive a cryptographic key using the scrypt KDF.
+
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+
+    Implements the same signature as the ``hashlib.scrypt`` implemented
+    in cpython version 3.6
+    """
+    return nacl.bindings.crypto_pwhash_scryptsalsa208sha256_ll(
+        password, salt, n, r, p, maxmem=maxmem, dklen=dklen
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/public.py b/TP03/TP03/lib/python3.9/site-packages/nacl/public.py
new file mode 100644
index 0000000000000000000000000000000000000000..be9410fce0a93c7060a7b5c8e459d9faefcfb502
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/public.py
@@ -0,0 +1,423 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 ClassVar, Generic, Optional, Type, TypeVar
+
+import nacl.bindings
+from nacl import encoding
+from nacl import exceptions as exc
+from nacl.encoding import Encoder
+from nacl.utils import EncryptedMessage, StringFixer, random
+
+
+class PublicKey(encoding.Encodable, StringFixer):
+    """
+    The public key counterpart to an Curve25519 :class:`nacl.public.PrivateKey`
+    for encrypting messages.
+
+    :param public_key: [:class:`bytes`] Encoded Curve25519 public key
+    :param encoder: A class that is able to decode the `public_key`
+
+    :cvar SIZE: The size that the public key is required to be
+    """
+
+    SIZE: ClassVar[int] = nacl.bindings.crypto_box_PUBLICKEYBYTES
+
+    def __init__(
+        self,
+        public_key: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ):
+        self._public_key = encoder.decode(public_key)
+        if not isinstance(self._public_key, bytes):
+            raise exc.TypeError("PublicKey must be created from 32 bytes")
+
+        if len(self._public_key) != self.SIZE:
+            raise exc.ValueError(
+                "The public key must be exactly {} bytes long".format(
+                    self.SIZE
+                )
+            )
+
+    def __bytes__(self) -> bytes:
+        return self._public_key
+
+    def __hash__(self) -> int:
+        return hash(bytes(self))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, self.__class__):
+            return False
+        return nacl.bindings.sodium_memcmp(bytes(self), bytes(other))
+
+    def __ne__(self, other: object) -> bool:
+        return not (self == other)
+
+
+class PrivateKey(encoding.Encodable, StringFixer):
+    """
+    Private key for decrypting messages using the Curve25519 algorithm.
+
+    .. warning:: This **must** be protected and remain secret. Anyone who
+        knows the value of your :class:`~nacl.public.PrivateKey` can decrypt
+        any message encrypted by the corresponding
+        :class:`~nacl.public.PublicKey`
+
+    :param private_key: The private key used to decrypt messages
+    :param encoder: The encoder class used to decode the given keys
+
+    :cvar SIZE: The size that the private key is required to be
+    :cvar SEED_SIZE: The size that the seed used to generate the
+                     private key is required to be
+    """
+
+    SIZE: ClassVar[int] = nacl.bindings.crypto_box_SECRETKEYBYTES
+    SEED_SIZE: ClassVar[int] = nacl.bindings.crypto_box_SEEDBYTES
+
+    def __init__(
+        self,
+        private_key: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ):
+        # Decode the secret_key
+        private_key = encoder.decode(private_key)
+        # verify the given secret key type and size are correct
+        if not (
+            isinstance(private_key, bytes) and len(private_key) == self.SIZE
+        ):
+            raise exc.TypeError(
+                (
+                    "PrivateKey must be created from a {} "
+                    "bytes long raw secret key"
+                ).format(self.SIZE)
+            )
+
+        raw_public_key = nacl.bindings.crypto_scalarmult_base(private_key)
+
+        self._private_key = private_key
+        self.public_key = PublicKey(raw_public_key)
+
+    @classmethod
+    def from_seed(
+        cls,
+        seed: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> "PrivateKey":
+        """
+        Generate a PrivateKey using a deterministic construction
+        starting from a caller-provided seed
+
+        .. warning:: The seed **must** be high-entropy; therefore,
+            its generator **must** be a cryptographic quality
+            random function like, for example, :func:`~nacl.utils.random`.
+
+        .. warning:: The seed **must** be protected and remain secret.
+            Anyone who knows the seed is really in possession of
+            the corresponding PrivateKey.
+
+        :param seed: The seed used to generate the private key
+        :rtype: :class:`~nacl.public.PrivateKey`
+        """
+        # decode the seed
+        seed = encoder.decode(seed)
+        # Verify the given seed type and size are correct
+        if not (isinstance(seed, bytes) and len(seed) == cls.SEED_SIZE):
+            raise exc.TypeError(
+                (
+                    "PrivateKey seed must be a {} bytes long "
+                    "binary sequence"
+                ).format(cls.SEED_SIZE)
+            )
+        # generate a raw keypair from the given seed
+        raw_pk, raw_sk = nacl.bindings.crypto_box_seed_keypair(seed)
+        # construct a instance from the raw secret key
+        return cls(raw_sk)
+
+    def __bytes__(self) -> bytes:
+        return self._private_key
+
+    def __hash__(self) -> int:
+        return hash((type(self), bytes(self.public_key)))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, self.__class__):
+            return False
+        return self.public_key == other.public_key
+
+    def __ne__(self, other: object) -> bool:
+        return not (self == other)
+
+    @classmethod
+    def generate(cls) -> "PrivateKey":
+        """
+        Generates a random :class:`~nacl.public.PrivateKey` object
+
+        :rtype: :class:`~nacl.public.PrivateKey`
+        """
+        return cls(random(PrivateKey.SIZE), encoder=encoding.RawEncoder)
+
+
+_Box = TypeVar("_Box", bound="Box")
+
+
+class Box(encoding.Encodable, StringFixer):
+    """
+    The Box class boxes and unboxes messages between a pair of keys
+
+    The ciphertexts generated by :class:`~nacl.public.Box` include a 16
+    byte authenticator which is checked as part of the decryption. An invalid
+    authenticator will cause the decrypt function to raise an exception. The
+    authenticator is not a signature. Once you've decrypted the message you've
+    demonstrated the ability to create arbitrary valid message, so messages you
+    send are repudiable. For non-repudiable messages, sign them after
+    encryption.
+
+    :param private_key: :class:`~nacl.public.PrivateKey` used to encrypt and
+        decrypt messages
+    :param public_key: :class:`~nacl.public.PublicKey` used to encrypt and
+        decrypt messages
+
+    :cvar NONCE_SIZE: The size that the nonce is required to be.
+    """
+
+    NONCE_SIZE: ClassVar[int] = nacl.bindings.crypto_box_NONCEBYTES
+    _shared_key: bytes
+
+    def __init__(self, private_key: PrivateKey, public_key: PublicKey):
+        if not isinstance(private_key, PrivateKey) or not isinstance(
+            public_key, PublicKey
+        ):
+            raise exc.TypeError(
+                "Box must be created from a PrivateKey and a PublicKey"
+            )
+        self._shared_key = nacl.bindings.crypto_box_beforenm(
+            public_key.encode(encoder=encoding.RawEncoder),
+            private_key.encode(encoder=encoding.RawEncoder),
+        )
+
+    def __bytes__(self) -> bytes:
+        return self._shared_key
+
+    @classmethod
+    def decode(
+        cls: Type[_Box], encoded: bytes, encoder: Encoder = encoding.RawEncoder
+    ) -> _Box:
+        """
+        Alternative constructor. Creates a Box from an existing Box's shared key.
+        """
+        # Create an empty box
+        box: _Box = cls.__new__(cls)
+
+        # Assign our decoded value to the shared key of the box
+        box._shared_key = encoder.decode(encoded)
+
+        return box
+
+    def encrypt(
+        self,
+        plaintext: bytes,
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> EncryptedMessage:
+        """
+        Encrypts the plaintext message using the given `nonce` (or generates
+        one randomly if omitted) and returns the ciphertext encoded with the
+        encoder.
+
+        .. warning:: It is **VITALLY** important that the nonce is a nonce,
+            i.e. it is a number used only once for any given key. If you fail
+            to do this, you compromise the privacy of the messages encrypted.
+
+        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
+        :param nonce: [:class:`bytes`] The nonce to use in the encryption
+        :param encoder: The encoder to use to encode the ciphertext
+        :rtype: [:class:`nacl.utils.EncryptedMessage`]
+        """
+        if nonce is None:
+            nonce = random(self.NONCE_SIZE)
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE
+            )
+
+        ciphertext = nacl.bindings.crypto_box_afternm(
+            plaintext,
+            nonce,
+            self._shared_key,
+        )
+
+        encoded_nonce = encoder.encode(nonce)
+        encoded_ciphertext = encoder.encode(ciphertext)
+
+        return EncryptedMessage._from_parts(
+            encoded_nonce,
+            encoded_ciphertext,
+            encoder.encode(nonce + ciphertext),
+        )
+
+    def decrypt(
+        self,
+        ciphertext: bytes,
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Decrypts the ciphertext using the `nonce` (explicitly, when passed as a
+        parameter or implicitly, when omitted, as part of the ciphertext) and
+        returns the plaintext message.
+
+        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
+        :param nonce: [:class:`bytes`] The nonce used when encrypting the
+            ciphertext
+        :param encoder: The encoder used to decode the ciphertext.
+        :rtype: [:class:`bytes`]
+        """
+        # Decode our ciphertext
+        ciphertext = encoder.decode(ciphertext)
+
+        if nonce is None:
+            # If we were given the nonce and ciphertext combined, split them.
+            nonce = ciphertext[: self.NONCE_SIZE]
+            ciphertext = ciphertext[self.NONCE_SIZE :]
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE
+            )
+
+        plaintext = nacl.bindings.crypto_box_open_afternm(
+            ciphertext,
+            nonce,
+            self._shared_key,
+        )
+
+        return plaintext
+
+    def shared_key(self) -> bytes:
+        """
+        Returns the Curve25519 shared secret, that can then be used as a key in
+        other symmetric ciphers.
+
+        .. warning:: It is **VITALLY** important that you use a nonce with your
+            symmetric cipher. If you fail to do this, you compromise the
+            privacy of the messages encrypted. Ensure that the key length of
+            your cipher is 32 bytes.
+        :rtype: [:class:`bytes`]
+        """
+
+        return self._shared_key
+
+
+_Key = TypeVar("_Key", PublicKey, PrivateKey)
+
+
+class SealedBox(Generic[_Key], encoding.Encodable, StringFixer):
+    """
+    The SealedBox class boxes and unboxes messages addressed to
+    a specified key-pair by using ephemeral sender's keypairs,
+    whose private part will be discarded just after encrypting
+    a single plaintext message.
+
+    The ciphertexts generated by :class:`~nacl.public.SecretBox` include
+    the public part of the ephemeral key before the :class:`~nacl.public.Box`
+    ciphertext.
+
+    :param recipient_key: a :class:`~nacl.public.PublicKey` used to encrypt
+        messages and derive nonces, or a :class:`~nacl.public.PrivateKey` used
+        to decrypt messages.
+
+    .. versionadded:: 1.2
+    """
+
+    _public_key: bytes
+    _private_key: Optional[bytes]
+
+    def __init__(self, recipient_key: _Key):
+        if isinstance(recipient_key, PublicKey):
+            self._public_key = recipient_key.encode(
+                encoder=encoding.RawEncoder
+            )
+            self._private_key = None
+        elif isinstance(recipient_key, PrivateKey):
+            self._private_key = recipient_key.encode(
+                encoder=encoding.RawEncoder
+            )
+            self._public_key = recipient_key.public_key.encode(
+                encoder=encoding.RawEncoder
+            )
+        else:
+            raise exc.TypeError(
+                "SealedBox must be created from a PublicKey or a PrivateKey"
+            )
+
+    def __bytes__(self) -> bytes:
+        return self._public_key
+
+    def encrypt(
+        self,
+        plaintext: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Encrypts the plaintext message using a random-generated ephemeral
+        keypair and returns a "composed ciphertext", containing both
+        the public part of the keypair and the ciphertext proper,
+        encoded with the encoder.
+
+        The private part of the ephemeral key-pair will be scrubbed before
+        returning the ciphertext, therefore, the sender will not be able to
+        decrypt the generated ciphertext.
+
+        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
+        :param encoder: The encoder to use to encode the ciphertext
+        :return bytes: encoded ciphertext
+        """
+
+        ciphertext = nacl.bindings.crypto_box_seal(plaintext, self._public_key)
+
+        encoded_ciphertext = encoder.encode(ciphertext)
+
+        return encoded_ciphertext
+
+    def decrypt(
+        self: "SealedBox[PrivateKey]",
+        ciphertext: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Decrypts the ciphertext using the ephemeral public key enclosed
+        in the ciphertext and the SealedBox private key, returning
+        the plaintext message.
+
+        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
+        :param encoder: The encoder used to decode the ciphertext.
+        :return bytes: The original plaintext
+        :raises TypeError: if this SealedBox was created with a
+            :class:`~nacl.public.PublicKey` rather than a
+            :class:`~nacl.public.PrivateKey`.
+        """
+        # Decode our ciphertext
+        ciphertext = encoder.decode(ciphertext)
+
+        if self._private_key is None:
+            raise TypeError(
+                "SealedBoxes created with a public key cannot decrypt"
+            )
+        plaintext = nacl.bindings.crypto_box_seal_open(
+            ciphertext,
+            self._public_key,
+            self._private_key,
+        )
+
+        return plaintext
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__init__.py b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffd76a64c5ab9b7649f276c8d8a182ae76db9389
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__init__.py
@@ -0,0 +1,75 @@
+# Copyright 2017 Donald Stufft and individual contributors
+#
+# 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 nacl.exceptions import CryptPrefixError
+
+from . import _argon2, argon2i, argon2id, scrypt
+
+STRPREFIX = argon2id.STRPREFIX
+
+PWHASH_SIZE = argon2id.PWHASH_SIZE
+
+assert _argon2.ALG_ARGON2_DEFAULT == _argon2.ALG_ARGON2ID13
+# since version 1.0.15 of libsodium
+
+PASSWD_MIN = argon2id.PASSWD_MIN
+PASSWD_MAX = argon2id.PASSWD_MAX
+MEMLIMIT_MAX = argon2id.MEMLIMIT_MAX
+MEMLIMIT_MIN = argon2id.MEMLIMIT_MIN
+OPSLIMIT_MAX = argon2id.OPSLIMIT_MAX
+OPSLIMIT_MIN = argon2id.OPSLIMIT_MIN
+OPSLIMIT_INTERACTIVE = argon2id.OPSLIMIT_INTERACTIVE
+MEMLIMIT_INTERACTIVE = argon2id.MEMLIMIT_INTERACTIVE
+OPSLIMIT_MODERATE = argon2id.OPSLIMIT_MODERATE
+MEMLIMIT_MODERATE = argon2id.MEMLIMIT_MODERATE
+OPSLIMIT_SENSITIVE = argon2id.OPSLIMIT_SENSITIVE
+MEMLIMIT_SENSITIVE = argon2id.MEMLIMIT_SENSITIVE
+
+str = argon2id.str
+
+assert argon2i.ALG != argon2id.ALG
+
+SCRYPT_SALTBYTES = scrypt.SALTBYTES
+SCRYPT_PWHASH_SIZE = scrypt.PWHASH_SIZE
+SCRYPT_OPSLIMIT_INTERACTIVE = scrypt.OPSLIMIT_INTERACTIVE
+SCRYPT_MEMLIMIT_INTERACTIVE = scrypt.MEMLIMIT_INTERACTIVE
+SCRYPT_OPSLIMIT_SENSITIVE = scrypt.OPSLIMIT_SENSITIVE
+SCRYPT_MEMLIMIT_SENSITIVE = scrypt.MEMLIMIT_SENSITIVE
+
+
+kdf_scryptsalsa208sha256 = scrypt.kdf
+scryptsalsa208sha256_str = scrypt.str
+verify_scryptsalsa208sha256 = scrypt.verify
+
+
+def verify(password_hash: bytes, password: bytes) -> bool:
+    """
+    Takes a modular crypt encoded stored password hash derived using one
+    of the algorithms supported by `libsodium` and checks if the user provided
+    password will hash to the same string when using the parameters saved
+    in the stored hash
+    """
+    if password_hash.startswith(argon2id.STRPREFIX):
+        return argon2id.verify(password_hash, password)
+    elif password_hash.startswith(argon2i.STRPREFIX):
+        return argon2id.verify(password_hash, password)
+    elif scrypt.AVAILABLE and password_hash.startswith(scrypt.STRPREFIX):
+        return scrypt.verify(password_hash, password)
+    else:
+        raise (
+            CryptPrefixError(
+                "given password_hash is not in a supported format"
+            )
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..42820fe76500c941be482e4c98c5dc98b4623b1a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/_argon2.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/_argon2.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..75d5a000fd61b4fc8dfe33c88e8328106208cee4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/_argon2.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2i.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2i.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b0cab48745a2b8c4eb90800804c0dd026a87deba
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2i.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2id.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2id.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bd40d3d3696a5415cad4e50e87fb9bda55e5c7d8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/argon2id.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/scrypt.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/scrypt.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ca33717f3a20e79d85b8414222c657feab416866
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/__pycache__/scrypt.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/_argon2.py b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/_argon2.py
new file mode 100644
index 0000000000000000000000000000000000000000..856eda04ea6afe5fa41ae44519f1de1bf662960e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/_argon2.py
@@ -0,0 +1,49 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl.bindings
+
+_argon2_strbytes_plus_one = nacl.bindings.crypto_pwhash_STRBYTES
+
+PWHASH_SIZE = _argon2_strbytes_plus_one - 1
+SALTBYTES = nacl.bindings.crypto_pwhash_SALTBYTES
+
+PASSWD_MIN = nacl.bindings.crypto_pwhash_PASSWD_MIN
+PASSWD_MAX = nacl.bindings.crypto_pwhash_PASSWD_MAX
+
+PWHASH_SIZE = _argon2_strbytes_plus_one - 1
+
+BYTES_MAX = nacl.bindings.crypto_pwhash_BYTES_MAX
+BYTES_MIN = nacl.bindings.crypto_pwhash_BYTES_MIN
+
+ALG_ARGON2I13 = nacl.bindings.crypto_pwhash_ALG_ARGON2I13
+ALG_ARGON2ID13 = nacl.bindings.crypto_pwhash_ALG_ARGON2ID13
+ALG_ARGON2_DEFAULT = nacl.bindings.crypto_pwhash_ALG_DEFAULT
+
+
+def verify(password_hash: bytes, password: bytes) -> bool:
+    """
+    Takes a modular crypt encoded argon2i or argon2id stored password hash
+    and checks if the user provided password will hash to the same string
+    when using the stored parameters
+
+    :param password_hash: password hash serialized in modular crypt() format
+    :type password_hash: bytes
+    :param password: user provided password
+    :type password: bytes
+    :rtype: boolean
+
+    .. versionadded:: 1.2
+    """
+    return nacl.bindings.crypto_pwhash_str_verify(password_hash, password)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2i.py b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2i.py
new file mode 100644
index 0000000000000000000000000000000000000000..f9b3af7f0a6499099cf50b223d78129bfb371142
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2i.py
@@ -0,0 +1,132 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl.bindings
+import nacl.encoding
+
+from . import _argon2
+
+ALG = _argon2.ALG_ARGON2I13
+STRPREFIX = nacl.bindings.crypto_pwhash_argon2i_STRPREFIX
+
+SALTBYTES = _argon2.SALTBYTES
+
+PASSWD_MIN = _argon2.PASSWD_MIN
+PASSWD_MAX = _argon2.PASSWD_MAX
+
+PWHASH_SIZE = _argon2.PWHASH_SIZE
+
+BYTES_MIN = _argon2.BYTES_MIN
+BYTES_MAX = _argon2.BYTES_MAX
+
+verify = _argon2.verify
+
+MEMLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MAX
+MEMLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MIN
+OPSLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MAX
+OPSLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MIN
+
+OPSLIMIT_INTERACTIVE = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_INTERACTIVE
+MEMLIMIT_INTERACTIVE = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_INTERACTIVE
+OPSLIMIT_SENSITIVE = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_SENSITIVE
+MEMLIMIT_SENSITIVE = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_SENSITIVE
+
+OPSLIMIT_MODERATE = nacl.bindings.crypto_pwhash_argon2i_OPSLIMIT_MODERATE
+MEMLIMIT_MODERATE = nacl.bindings.crypto_pwhash_argon2i_MEMLIMIT_MODERATE
+
+
+def kdf(
+    size: int,
+    password: bytes,
+    salt: bytes,
+    opslimit: int = OPSLIMIT_SENSITIVE,
+    memlimit: int = MEMLIMIT_SENSITIVE,
+    encoder: nacl.encoding.Encoder = nacl.encoding.RawEncoder,
+) -> bytes:
+    """
+    Derive a ``size`` bytes long key from a caller-supplied
+    ``password`` and ``salt`` pair using the argon2i
+    memory-hard construct.
+
+    the enclosing module provides the constants
+
+        - :py:const:`.OPSLIMIT_INTERACTIVE`
+        - :py:const:`.MEMLIMIT_INTERACTIVE`
+        - :py:const:`.OPSLIMIT_MODERATE`
+        - :py:const:`.MEMLIMIT_MODERATE`
+        - :py:const:`.OPSLIMIT_SENSITIVE`
+        - :py:const:`.MEMLIMIT_SENSITIVE`
+
+    as a guidance for correct settings.
+
+    :param size: derived key size, must be between
+                 :py:const:`.BYTES_MIN` and
+                 :py:const:`.BYTES_MAX`
+    :type size: int
+    :param password: password used to seed the key derivation procedure;
+                     it length must be between
+                     :py:const:`.PASSWD_MIN` and
+                     :py:const:`.PASSWD_MAX`
+    :type password: bytes
+    :param salt: **RANDOM** salt used in the key derivation procedure;
+                 its length must be exactly :py:const:`.SALTBYTES`
+    :type salt: bytes
+    :param opslimit: the time component (operation count)
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.OPSLIMIT_MIN` and
+                     :py:const:`.OPSLIMIT_MAX`
+    :type opslimit: int
+    :param memlimit: the memory occupation component
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.MEMLIMIT_MIN` and
+                     :py:const:`.MEMLIMIT_MAX`
+    :type memlimit: int
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+
+    return encoder.encode(
+        nacl.bindings.crypto_pwhash_alg(
+            size, password, salt, opslimit, memlimit, ALG
+        )
+    )
+
+
+def str(
+    password: bytes,
+    opslimit: int = OPSLIMIT_INTERACTIVE,
+    memlimit: int = MEMLIMIT_INTERACTIVE,
+) -> bytes:
+    """
+    Hashes a password with a random salt, using the memory-hard
+    argon2i construct and returning an ascii string that has all
+    the needed info to check against a future password
+
+
+    The default settings for opslimit and memlimit are those deemed
+    correct for the interactive user login case.
+
+    :param bytes password:
+    :param int opslimit:
+    :param int memlimit:
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+    return nacl.bindings.crypto_pwhash_str_alg(
+        password, opslimit, memlimit, ALG
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2id.py b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2id.py
new file mode 100644
index 0000000000000000000000000000000000000000..1b86d69e141b453a1bafd50197103923ff400d69
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/argon2id.py
@@ -0,0 +1,135 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 nacl.bindings
+import nacl.encoding
+
+from . import _argon2
+
+ALG = _argon2.ALG_ARGON2ID13
+STRPREFIX = nacl.bindings.crypto_pwhash_argon2id_STRPREFIX
+
+SALTBYTES = _argon2.SALTBYTES
+
+PASSWD_MIN = _argon2.PASSWD_MIN
+PASSWD_MAX = _argon2.PASSWD_MAX
+
+PWHASH_SIZE = _argon2.PWHASH_SIZE
+
+BYTES_MIN = _argon2.BYTES_MIN
+BYTES_MAX = _argon2.BYTES_MAX
+
+verify = _argon2.verify
+
+MEMLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MIN
+MEMLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MAX
+OPSLIMIT_MIN = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MIN
+OPSLIMIT_MAX = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MAX
+
+OPSLIMIT_INTERACTIVE = (
+    nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_INTERACTIVE
+)
+MEMLIMIT_INTERACTIVE = (
+    nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_INTERACTIVE
+)
+OPSLIMIT_SENSITIVE = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_SENSITIVE
+MEMLIMIT_SENSITIVE = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_SENSITIVE
+
+OPSLIMIT_MODERATE = nacl.bindings.crypto_pwhash_argon2id_OPSLIMIT_MODERATE
+MEMLIMIT_MODERATE = nacl.bindings.crypto_pwhash_argon2id_MEMLIMIT_MODERATE
+
+
+def kdf(
+    size: int,
+    password: bytes,
+    salt: bytes,
+    opslimit: int = OPSLIMIT_SENSITIVE,
+    memlimit: int = MEMLIMIT_SENSITIVE,
+    encoder: nacl.encoding.Encoder = nacl.encoding.RawEncoder,
+) -> bytes:
+    """
+    Derive a ``size`` bytes long key from a caller-supplied
+    ``password`` and ``salt`` pair using the argon2i
+    memory-hard construct.
+
+    the enclosing module provides the constants
+
+        - :py:const:`.OPSLIMIT_INTERACTIVE`
+        - :py:const:`.MEMLIMIT_INTERACTIVE`
+        - :py:const:`.OPSLIMIT_MODERATE`
+        - :py:const:`.MEMLIMIT_MODERATE`
+        - :py:const:`.OPSLIMIT_SENSITIVE`
+        - :py:const:`.MEMLIMIT_SENSITIVE`
+
+    as a guidance for correct settings.
+
+    :param size: derived key size, must be between
+                 :py:const:`.BYTES_MIN` and
+                 :py:const:`.BYTES_MAX`
+    :type size: int
+    :param password: password used to seed the key derivation procedure;
+                     it length must be between
+                     :py:const:`.PASSWD_MIN` and
+                     :py:const:`.PASSWD_MAX`
+    :type password: bytes
+    :param salt: **RANDOM** salt used in the key derivation procedure;
+                 its length must be exactly :py:const:`.SALTBYTES`
+    :type salt: bytes
+    :param opslimit: the time component (operation count)
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.OPSLIMIT_MIN` and
+                     :py:const:`.OPSLIMIT_MAX`
+    :type opslimit: int
+    :param memlimit: the memory occupation component
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.MEMLIMIT_MIN` and
+                     :py:const:`.MEMLIMIT_MAX`
+    :type memlimit: int
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+
+    return encoder.encode(
+        nacl.bindings.crypto_pwhash_alg(
+            size, password, salt, opslimit, memlimit, ALG
+        )
+    )
+
+
+def str(
+    password: bytes,
+    opslimit: int = OPSLIMIT_INTERACTIVE,
+    memlimit: int = MEMLIMIT_INTERACTIVE,
+) -> bytes:
+    """
+    Hashes a password with a random salt, using the memory-hard
+    argon2id construct and returning an ascii string that has all
+    the needed info to check against a future password
+
+    The default settings for opslimit and memlimit are those deemed
+    correct for the interactive user login case.
+
+    :param bytes password:
+    :param int opslimit:
+    :param int memlimit:
+    :rtype: bytes
+
+    .. versionadded:: 1.2
+    """
+    return nacl.bindings.crypto_pwhash_str_alg(
+        password, opslimit, memlimit, ALG
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/scrypt.py b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/scrypt.py
new file mode 100644
index 0000000000000000000000000000000000000000..55bdf498a1d14bc63089e428375e9e7a6a06130e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/pwhash/scrypt.py
@@ -0,0 +1,211 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 cast
+
+import nacl.bindings
+import nacl.encoding
+from nacl import exceptions as exc
+from nacl.exceptions import ensure
+
+_strbytes_plus_one = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_STRBYTES
+
+AVAILABLE = nacl.bindings.has_crypto_pwhash_scryptsalsa208sha256
+
+STRPREFIX = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_STRPREFIX
+
+SALTBYTES = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_SALTBYTES
+
+PASSWD_MIN = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_PASSWD_MIN
+PASSWD_MAX = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_PASSWD_MAX
+
+PWHASH_SIZE = _strbytes_plus_one - 1
+
+BYTES_MIN = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_BYTES_MIN
+BYTES_MAX = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_BYTES_MAX
+
+MEMLIMIT_MIN = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MIN
+MEMLIMIT_MAX = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_MAX
+OPSLIMIT_MIN = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MIN
+OPSLIMIT_MAX = nacl.bindings.crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_MAX
+
+OPSLIMIT_INTERACTIVE = (
+    nacl.bindings.crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_INTERACTIVE
+)
+MEMLIMIT_INTERACTIVE = (
+    nacl.bindings.crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_INTERACTIVE
+)
+OPSLIMIT_SENSITIVE = (
+    nacl.bindings.crypto_pwhash_scryptsalsa208sha256_OPSLIMIT_SENSITIVE
+)
+MEMLIMIT_SENSITIVE = (
+    nacl.bindings.crypto_pwhash_scryptsalsa208sha256_MEMLIMIT_SENSITIVE
+)
+
+OPSLIMIT_MODERATE = 8 * OPSLIMIT_INTERACTIVE
+MEMLIMIT_MODERATE = 8 * MEMLIMIT_INTERACTIVE
+
+
+def kdf(
+    size: int,
+    password: bytes,
+    salt: bytes,
+    opslimit: int = OPSLIMIT_SENSITIVE,
+    memlimit: int = MEMLIMIT_SENSITIVE,
+    encoder: nacl.encoding.Encoder = nacl.encoding.RawEncoder,
+) -> bytes:
+    """
+    Derive a ``size`` bytes long key from a caller-supplied
+    ``password`` and ``salt`` pair using the scryptsalsa208sha256
+    memory-hard construct.
+
+
+    the enclosing module provides the constants
+
+        - :py:const:`.OPSLIMIT_INTERACTIVE`
+        - :py:const:`.MEMLIMIT_INTERACTIVE`
+        - :py:const:`.OPSLIMIT_SENSITIVE`
+        - :py:const:`.MEMLIMIT_SENSITIVE`
+        - :py:const:`.OPSLIMIT_MODERATE`
+        - :py:const:`.MEMLIMIT_MODERATE`
+
+    as a guidance for correct settings respectively for the
+    interactive login and the long term key protecting sensitive data
+    use cases.
+
+    :param size: derived key size, must be between
+                 :py:const:`.BYTES_MIN` and
+                 :py:const:`.BYTES_MAX`
+    :type size: int
+    :param password: password used to seed the key derivation procedure;
+                     it length must be between
+                     :py:const:`.PASSWD_MIN` and
+                     :py:const:`.PASSWD_MAX`
+    :type password: bytes
+    :param salt: **RANDOM** salt used in the key derivation procedure;
+                 its length must be exactly :py:const:`.SALTBYTES`
+    :type salt: bytes
+    :param opslimit: the time component (operation count)
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.OPSLIMIT_MIN` and
+                     :py:const:`.OPSLIMIT_MAX`
+    :type opslimit: int
+    :param memlimit: the memory occupation component
+                     of the key derivation procedure's computational cost;
+                     it must be between
+                     :py:const:`.MEMLIMIT_MIN` and
+                     :py:const:`.MEMLIMIT_MAX`
+    :type memlimit: int
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+
+    .. versionadded:: 1.2
+    """
+    ensure(
+        AVAILABLE,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        len(salt) == SALTBYTES,
+        "The salt must be exactly %s, not %s bytes long"
+        % (SALTBYTES, len(salt)),
+        raising=exc.ValueError,
+    )
+
+    n_log2, r, p = nacl.bindings.nacl_bindings_pick_scrypt_params(
+        opslimit, memlimit
+    )
+    maxmem = memlimit + (2 ** 16)
+
+    return encoder.encode(
+        nacl.bindings.crypto_pwhash_scryptsalsa208sha256_ll(
+            password,
+            salt,
+            # Cast safety: n_log2 is a positive integer, and so 2 ** n_log2 is also
+            # a positive integer. Mypy+typeshed can't deduce this, because there's no
+            # way to for them to know that n_log2: int is positive.
+            cast(int, 2 ** n_log2),
+            r,
+            p,
+            maxmem=maxmem,
+            dklen=size,
+        )
+    )
+
+
+def str(
+    password: bytes,
+    opslimit: int = OPSLIMIT_INTERACTIVE,
+    memlimit: int = MEMLIMIT_INTERACTIVE,
+) -> bytes:
+    """
+    Hashes a password with a random salt, using the memory-hard
+    scryptsalsa208sha256 construct and returning an ascii string
+    that has all the needed info to check against a future password
+
+    The default settings for opslimit and memlimit are those deemed
+    correct for the interactive user login case.
+
+    :param bytes password:
+    :param int opslimit:
+    :param int memlimit:
+    :rtype: bytes
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+
+    .. versionadded:: 1.2
+    """
+    ensure(
+        AVAILABLE,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    return nacl.bindings.crypto_pwhash_scryptsalsa208sha256_str(
+        password, opslimit, memlimit
+    )
+
+
+def verify(password_hash: bytes, password: bytes) -> bool:
+    """
+    Takes the output of scryptsalsa208sha256 and compares it against
+    a user provided password to see if they are the same
+
+    :param password_hash: bytes
+    :param password: bytes
+    :rtype: boolean
+    :raises nacl.exceptions.UnavailableError: If called when using a
+        minimal build of libsodium.
+
+    .. versionadded:: 1.2
+    """
+    ensure(
+        AVAILABLE,
+        "Not available in minimal build",
+        raising=exc.UnavailableError,
+    )
+
+    ensure(
+        len(password_hash) == PWHASH_SIZE,
+        "The password hash must be exactly %s bytes long"
+        % nacl.bindings.crypto_pwhash_scryptsalsa208sha256_STRBYTES,
+        raising=exc.ValueError,
+    )
+
+    return nacl.bindings.crypto_pwhash_scryptsalsa208sha256_str_verify(
+        password_hash, password
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/py.typed b/TP03/TP03/lib/python3.9/site-packages/nacl/py.typed
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/secret.py b/TP03/TP03/lib/python3.9/site-packages/nacl/secret.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba536a27d440b4f453f0fac62d860280d321769a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/secret.py
@@ -0,0 +1,305 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 ClassVar, Optional
+
+import nacl.bindings
+from nacl import encoding
+from nacl import exceptions as exc
+from nacl.utils import EncryptedMessage, StringFixer, random
+
+
+class SecretBox(encoding.Encodable, StringFixer):
+    """
+    The SecretBox class encrypts and decrypts messages using the given secret
+    key.
+
+    The ciphertexts generated by :class:`~nacl.secret.Secretbox` include a 16
+    byte authenticator which is checked as part of the decryption. An invalid
+    authenticator will cause the decrypt function to raise an exception. The
+    authenticator is not a signature. Once you've decrypted the message you've
+    demonstrated the ability to create arbitrary valid message, so messages you
+    send are repudiable. For non-repudiable messages, sign them after
+    encryption.
+
+    Encryption is done using `XSalsa20-Poly1305`_, and there are no practical
+    limits on the number or size of messages (up to 2⁶⁴ messages, each up to 2⁶⁴
+    bytes).
+
+    .. _XSalsa20-Poly1305: https://doc.libsodium.org/secret-key_cryptography/secretbox#algorithm-details
+
+    :param key: The secret key used to encrypt and decrypt messages
+    :param encoder: The encoder class used to decode the given key
+
+    :cvar KEY_SIZE: The size that the key is required to be.
+    :cvar NONCE_SIZE: The size that the nonce is required to be.
+    :cvar MACBYTES: The size of the authentication MAC tag in bytes.
+    :cvar MESSAGEBYTES_MAX: The maximum size of a message which can be
+                            safely encrypted with a single key/nonce
+                            pair.
+    """
+
+    KEY_SIZE: ClassVar[int] = nacl.bindings.crypto_secretbox_KEYBYTES
+    NONCE_SIZE: ClassVar[int] = nacl.bindings.crypto_secretbox_NONCEBYTES
+    MACBYTES: ClassVar[int] = nacl.bindings.crypto_secretbox_MACBYTES
+    MESSAGEBYTES_MAX: ClassVar[
+        int
+    ] = nacl.bindings.crypto_secretbox_MESSAGEBYTES_MAX
+
+    def __init__(
+        self, key: bytes, encoder: encoding.Encoder = encoding.RawEncoder
+    ):
+        key = encoder.decode(key)
+        if not isinstance(key, bytes):
+            raise exc.TypeError("SecretBox must be created from 32 bytes")
+
+        if len(key) != self.KEY_SIZE:
+            raise exc.ValueError(
+                "The key must be exactly %s bytes long" % self.KEY_SIZE,
+            )
+
+        self._key = key
+
+    def __bytes__(self) -> bytes:
+        return self._key
+
+    def encrypt(
+        self,
+        plaintext: bytes,
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> EncryptedMessage:
+        """
+        Encrypts the plaintext message using the given `nonce` (or generates
+        one randomly if omitted) and returns the ciphertext encoded with the
+        encoder.
+
+        .. warning:: It is **VITALLY** important that the nonce is a nonce,
+            i.e. it is a number used only once for any given key. If you fail
+            to do this, you compromise the privacy of the messages encrypted.
+            Give your nonces a different prefix, or have one side use an odd
+            counter and one an even counter. Just make sure they are different.
+
+        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
+        :param nonce: [:class:`bytes`] The nonce to use in the encryption
+        :param encoder: The encoder to use to encode the ciphertext
+        :rtype: [:class:`nacl.utils.EncryptedMessage`]
+        """
+        if nonce is None:
+            nonce = random(self.NONCE_SIZE)
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE,
+            )
+
+        ciphertext = nacl.bindings.crypto_secretbox(
+            plaintext, nonce, self._key
+        )
+
+        encoded_nonce = encoder.encode(nonce)
+        encoded_ciphertext = encoder.encode(ciphertext)
+
+        return EncryptedMessage._from_parts(
+            encoded_nonce,
+            encoded_ciphertext,
+            encoder.encode(nonce + ciphertext),
+        )
+
+    def decrypt(
+        self,
+        ciphertext: bytes,
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Decrypts the ciphertext using the `nonce` (explicitly, when passed as a
+        parameter or implicitly, when omitted, as part of the ciphertext) and
+        returns the plaintext message.
+
+        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
+        :param nonce: [:class:`bytes`] The nonce used when encrypting the
+            ciphertext
+        :param encoder: The encoder used to decode the ciphertext.
+        :rtype: [:class:`bytes`]
+        """
+        # Decode our ciphertext
+        ciphertext = encoder.decode(ciphertext)
+
+        if nonce is None:
+            # If we were given the nonce and ciphertext combined, split them.
+            nonce = ciphertext[: self.NONCE_SIZE]
+            ciphertext = ciphertext[self.NONCE_SIZE :]
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE,
+            )
+
+        plaintext = nacl.bindings.crypto_secretbox_open(
+            ciphertext, nonce, self._key
+        )
+
+        return plaintext
+
+
+class Aead(encoding.Encodable, StringFixer):
+    """
+    The AEAD class encrypts and decrypts messages using the given secret key.
+
+    Unlike :class:`~nacl.secret.SecretBox`, AEAD supports authenticating
+    non-confidential data received alongside the message, such as a length
+    or type tag.
+
+    Like :class:`~nacl.secret.Secretbox`, this class provides authenticated
+    encryption. An inauthentic message will cause the decrypt function to raise
+    an exception.
+
+    Likewise, the authenticator should not be mistaken for a (public-key)
+    signature: recipients (with the ability to decrypt messages) are capable of
+    creating arbitrary valid message; in particular, this means AEAD messages
+    are repudiable. For non-repudiable messages, sign them after encryption.
+
+    The cryptosystem used is `XChacha20-Poly1305`_ as specified for
+    `standardization`_. There are `no practical limits`_ to how much can safely
+    be encrypted under a given key (up to 2⁶⁴ messages each containing up
+    to 2⁶⁴ bytes).
+
+    .. _standardization: https://datatracker.ietf.org/doc/html/draft-irtf-cfrg-xchacha
+    .. _XChacha20-Poly1305: https://doc.libsodium.org/secret-key_cryptography/aead#xchacha-20-poly1305
+    .. _no practical limits: https://doc.libsodium.org/secret-key_cryptography/aead#limitations
+
+    :param key: The secret key used to encrypt and decrypt messages
+    :param encoder: The encoder class used to decode the given key
+
+    :cvar KEY_SIZE: The size that the key is required to be.
+    :cvar NONCE_SIZE: The size that the nonce is required to be.
+    :cvar MACBYTES: The size of the authentication MAC tag in bytes.
+    :cvar MESSAGEBYTES_MAX: The maximum size of a message which can be
+                            safely encrypted with a single key/nonce
+                            pair.
+    """
+
+    KEY_SIZE = nacl.bindings.crypto_aead_xchacha20poly1305_ietf_KEYBYTES
+    NONCE_SIZE = nacl.bindings.crypto_aead_xchacha20poly1305_ietf_NPUBBYTES
+    MACBYTES = nacl.bindings.crypto_aead_xchacha20poly1305_ietf_ABYTES
+    MESSAGEBYTES_MAX = (
+        nacl.bindings.crypto_aead_xchacha20poly1305_ietf_MESSAGEBYTES_MAX
+    )
+
+    def __init__(
+        self,
+        key: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ):
+        key = encoder.decode(key)
+        if not isinstance(key, bytes):
+            raise exc.TypeError("AEAD must be created from 32 bytes")
+
+        if len(key) != self.KEY_SIZE:
+            raise exc.ValueError(
+                "The key must be exactly %s bytes long" % self.KEY_SIZE,
+            )
+
+        self._key = key
+
+    def __bytes__(self) -> bytes:
+        return self._key
+
+    def encrypt(
+        self,
+        plaintext: bytes,
+        aad: bytes = b"",
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> EncryptedMessage:
+        """
+        Encrypts the plaintext message using the given `nonce` (or generates
+        one randomly if omitted) and returns the ciphertext encoded with the
+        encoder.
+
+        .. warning:: It is vitally important for :param nonce: to be unique.
+            By default, it is generated randomly; [:class:`Aead`] uses XChacha20
+            for extended (192b) nonce size, so the risk of reusing random nonces
+            is negligible.  It is *strongly recommended* to keep this behaviour,
+            as nonce reuse will compromise the privacy of encrypted messages.
+            Should implicit nonces be inadequate for your application, the
+            second best option is using split counters; e.g. if sending messages
+            encrypted under a shared key between 2 users, each user can use the
+            number of messages it sent so far, prefixed or suffixed with a 1bit
+            user id.  Note that the counter must **never** be rolled back (due
+            to overflow, on-disk state being rolled back to an earlier backup,
+            ...)
+
+        :param plaintext: [:class:`bytes`] The plaintext message to encrypt
+        :param nonce: [:class:`bytes`] The nonce to use in the encryption
+        :param encoder: The encoder to use to encode the ciphertext
+        :rtype: [:class:`nacl.utils.EncryptedMessage`]
+        """
+        if nonce is None:
+            nonce = random(self.NONCE_SIZE)
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE,
+            )
+
+        ciphertext = nacl.bindings.crypto_aead_xchacha20poly1305_ietf_encrypt(
+            plaintext, aad, nonce, self._key
+        )
+
+        encoded_nonce = encoder.encode(nonce)
+        encoded_ciphertext = encoder.encode(ciphertext)
+
+        return EncryptedMessage._from_parts(
+            encoded_nonce,
+            encoded_ciphertext,
+            encoder.encode(nonce + ciphertext),
+        )
+
+    def decrypt(
+        self,
+        ciphertext: bytes,
+        aad: bytes = b"",
+        nonce: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Decrypts the ciphertext using the `nonce` (explicitly, when passed as a
+        parameter or implicitly, when omitted, as part of the ciphertext) and
+        returns the plaintext message.
+
+        :param ciphertext: [:class:`bytes`] The encrypted message to decrypt
+        :param nonce: [:class:`bytes`] The nonce used when encrypting the
+            ciphertext
+        :param encoder: The encoder used to decode the ciphertext.
+        :rtype: [:class:`bytes`]
+        """
+        # Decode our ciphertext
+        ciphertext = encoder.decode(ciphertext)
+
+        if nonce is None:
+            # If we were given the nonce and ciphertext combined, split them.
+            nonce = ciphertext[: self.NONCE_SIZE]
+            ciphertext = ciphertext[self.NONCE_SIZE :]
+
+        if len(nonce) != self.NONCE_SIZE:
+            raise exc.ValueError(
+                "The nonce must be exactly %s bytes long" % self.NONCE_SIZE,
+            )
+
+        plaintext = nacl.bindings.crypto_aead_xchacha20poly1305_ietf_decrypt(
+            ciphertext, aad, nonce, self._key
+        )
+
+        return plaintext
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/signing.py b/TP03/TP03/lib/python3.9/site-packages/nacl/signing.py
new file mode 100644
index 0000000000000000000000000000000000000000..12ec8ec477deed570897e8d41a36f672b5b8688f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/signing.py
@@ -0,0 +1,250 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 Optional
+
+import nacl.bindings
+from nacl import encoding
+from nacl import exceptions as exc
+from nacl.public import (
+    PrivateKey as _Curve25519_PrivateKey,
+    PublicKey as _Curve25519_PublicKey,
+)
+from nacl.utils import StringFixer, random
+
+
+class SignedMessage(bytes):
+    """
+    A bytes subclass that holds a messaged that has been signed by a
+    :class:`SigningKey`.
+    """
+
+    _signature: bytes
+    _message: bytes
+
+    @classmethod
+    def _from_parts(
+        cls, signature: bytes, message: bytes, combined: bytes
+    ) -> "SignedMessage":
+        obj = cls(combined)
+        obj._signature = signature
+        obj._message = message
+        return obj
+
+    @property
+    def signature(self) -> bytes:
+        """
+        The signature contained within the :class:`SignedMessage`.
+        """
+        return self._signature
+
+    @property
+    def message(self) -> bytes:
+        """
+        The message contained within the :class:`SignedMessage`.
+        """
+        return self._message
+
+
+class VerifyKey(encoding.Encodable, StringFixer):
+    """
+    The public key counterpart to an Ed25519 SigningKey for producing digital
+    signatures.
+
+    :param key: [:class:`bytes`] Serialized Ed25519 public key
+    :param encoder: A class that is able to decode the `key`
+    """
+
+    def __init__(
+        self, key: bytes, encoder: encoding.Encoder = encoding.RawEncoder
+    ):
+        # Decode the key
+        key = encoder.decode(key)
+        if not isinstance(key, bytes):
+            raise exc.TypeError("VerifyKey must be created from 32 bytes")
+
+        if len(key) != nacl.bindings.crypto_sign_PUBLICKEYBYTES:
+            raise exc.ValueError(
+                "The key must be exactly %s bytes long"
+                % nacl.bindings.crypto_sign_PUBLICKEYBYTES,
+            )
+
+        self._key = key
+
+    def __bytes__(self) -> bytes:
+        return self._key
+
+    def __hash__(self) -> int:
+        return hash(bytes(self))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, self.__class__):
+            return False
+        return nacl.bindings.sodium_memcmp(bytes(self), bytes(other))
+
+    def __ne__(self, other: object) -> bool:
+        return not (self == other)
+
+    def verify(
+        self,
+        smessage: bytes,
+        signature: Optional[bytes] = None,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> bytes:
+        """
+        Verifies the signature of a signed message, returning the message
+        if it has not been tampered with else raising
+        :class:`~nacl.signing.BadSignatureError`.
+
+        :param smessage: [:class:`bytes`] Either the original messaged or a
+            signature and message concated together.
+        :param signature: [:class:`bytes`] If an unsigned message is given for
+            smessage then the detached signature must be provided.
+        :param encoder: A class that is able to decode the secret message and
+            signature.
+        :rtype: :class:`bytes`
+        """
+        if signature is not None:
+            # If we were given the message and signature separately, validate
+            #   signature size and combine them.
+            if not isinstance(signature, bytes):
+                raise exc.TypeError(
+                    "Verification signature must be created from %d bytes"
+                    % nacl.bindings.crypto_sign_BYTES,
+                )
+
+            if len(signature) != nacl.bindings.crypto_sign_BYTES:
+                raise exc.ValueError(
+                    "The signature must be exactly %d bytes long"
+                    % nacl.bindings.crypto_sign_BYTES,
+                )
+
+            smessage = signature + encoder.decode(smessage)
+        else:
+            # Decode the signed message
+            smessage = encoder.decode(smessage)
+
+        return nacl.bindings.crypto_sign_open(smessage, self._key)
+
+    def to_curve25519_public_key(self) -> _Curve25519_PublicKey:
+        """
+        Converts a :class:`~nacl.signing.VerifyKey` to a
+        :class:`~nacl.public.PublicKey`
+
+        :rtype: :class:`~nacl.public.PublicKey`
+        """
+        raw_pk = nacl.bindings.crypto_sign_ed25519_pk_to_curve25519(self._key)
+        return _Curve25519_PublicKey(raw_pk)
+
+
+class SigningKey(encoding.Encodable, StringFixer):
+    """
+    Private key for producing digital signatures using the Ed25519 algorithm.
+
+    Signing keys are produced from a 32-byte (256-bit) random seed value. This
+    value can be passed into the :class:`~nacl.signing.SigningKey` as a
+    :func:`bytes` whose length is 32.
+
+    .. warning:: This **must** be protected and remain secret. Anyone who knows
+        the value of your :class:`~nacl.signing.SigningKey` or it's seed can
+        masquerade as you.
+
+    :param seed: [:class:`bytes`] Random 32-byte value (i.e. private key)
+    :param encoder: A class that is able to decode the seed
+
+    :ivar: verify_key: [:class:`~nacl.signing.VerifyKey`] The verify
+        (i.e. public) key that corresponds with this signing key.
+    """
+
+    def __init__(
+        self,
+        seed: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ):
+        # Decode the seed
+        seed = encoder.decode(seed)
+        if not isinstance(seed, bytes):
+            raise exc.TypeError(
+                "SigningKey must be created from a 32 byte seed"
+            )
+
+        # Verify that our seed is the proper size
+        if len(seed) != nacl.bindings.crypto_sign_SEEDBYTES:
+            raise exc.ValueError(
+                "The seed must be exactly %d bytes long"
+                % nacl.bindings.crypto_sign_SEEDBYTES
+            )
+
+        public_key, secret_key = nacl.bindings.crypto_sign_seed_keypair(seed)
+
+        self._seed = seed
+        self._signing_key = secret_key
+        self.verify_key = VerifyKey(public_key)
+
+    def __bytes__(self) -> bytes:
+        return self._seed
+
+    def __hash__(self) -> int:
+        return hash(bytes(self))
+
+    def __eq__(self, other: object) -> bool:
+        if not isinstance(other, self.__class__):
+            return False
+        return nacl.bindings.sodium_memcmp(bytes(self), bytes(other))
+
+    def __ne__(self, other: object) -> bool:
+        return not (self == other)
+
+    @classmethod
+    def generate(cls) -> "SigningKey":
+        """
+        Generates a random :class:`~nacl.signing.SigningKey` object.
+
+        :rtype: :class:`~nacl.signing.SigningKey`
+        """
+        return cls(
+            random(nacl.bindings.crypto_sign_SEEDBYTES),
+            encoder=encoding.RawEncoder,
+        )
+
+    def sign(
+        self,
+        message: bytes,
+        encoder: encoding.Encoder = encoding.RawEncoder,
+    ) -> SignedMessage:
+        """
+        Sign a message using this key.
+
+        :param message: [:class:`bytes`] The data to be signed.
+        :param encoder: A class that is used to encode the signed message.
+        :rtype: :class:`~nacl.signing.SignedMessage`
+        """
+        raw_signed = nacl.bindings.crypto_sign(message, self._signing_key)
+
+        crypto_sign_BYTES = nacl.bindings.crypto_sign_BYTES
+        signature = encoder.encode(raw_signed[:crypto_sign_BYTES])
+        message = encoder.encode(raw_signed[crypto_sign_BYTES:])
+        signed = encoder.encode(raw_signed)
+
+        return SignedMessage._from_parts(signature, message, signed)
+
+    def to_curve25519_private_key(self) -> _Curve25519_PrivateKey:
+        """
+        Converts a :class:`~nacl.signing.SigningKey` to a
+        :class:`~nacl.public.PrivateKey`
+
+        :rtype: :class:`~nacl.public.PrivateKey`
+        """
+        sk = self._signing_key
+        raw_private = nacl.bindings.crypto_sign_ed25519_sk_to_curve25519(sk)
+        return _Curve25519_PrivateKey(raw_private)
diff --git a/TP03/TP03/lib/python3.9/site-packages/nacl/utils.py b/TP03/TP03/lib/python3.9/site-packages/nacl/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..d19d236a47c47eca5de1de2a64eed9079317364e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/nacl/utils.py
@@ -0,0 +1,88 @@
+# Copyright 2013 Donald Stufft and individual contributors
+#
+# 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 os
+from typing import SupportsBytes, Type, TypeVar
+
+import nacl.bindings
+from nacl import encoding
+
+_EncryptedMessage = TypeVar("_EncryptedMessage", bound="EncryptedMessage")
+
+
+class EncryptedMessage(bytes):
+    """
+    A bytes subclass that holds a messaged that has been encrypted by a
+    :class:`SecretBox`.
+    """
+
+    _nonce: bytes
+    _ciphertext: bytes
+
+    @classmethod
+    def _from_parts(
+        cls: Type[_EncryptedMessage],
+        nonce: bytes,
+        ciphertext: bytes,
+        combined: bytes,
+    ) -> _EncryptedMessage:
+        obj = cls(combined)
+        obj._nonce = nonce
+        obj._ciphertext = ciphertext
+        return obj
+
+    @property
+    def nonce(self) -> bytes:
+        """
+        The nonce used during the encryption of the :class:`EncryptedMessage`.
+        """
+        return self._nonce
+
+    @property
+    def ciphertext(self) -> bytes:
+        """
+        The ciphertext contained within the :class:`EncryptedMessage`.
+        """
+        return self._ciphertext
+
+
+class StringFixer:
+    def __str__(self: SupportsBytes) -> str:
+        return str(self.__bytes__())
+
+
+def bytes_as_string(bytes_in: bytes) -> str:
+    return bytes_in.decode("ascii")
+
+
+def random(size: int = 32) -> bytes:
+    return os.urandom(size)
+
+
+def randombytes_deterministic(
+    size: int, seed: bytes, encoder: encoding.Encoder = encoding.RawEncoder
+) -> bytes:
+    """
+    Returns ``size`` number of deterministically generated pseudorandom bytes
+    from a seed
+
+    :param size: int
+    :param seed: bytes
+    :param encoder: The encoder class used to encode the produced bytes
+    :rtype: bytes
+    """
+    raw_data = nacl.bindings.randombytes_buf_deterministic(size, seed)
+
+    return encoder.encode(raw_data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..d12bef0c5a9d251034217ab1e404412f43023492
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/LICENSE
@@ -0,0 +1,504 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..5550172a696b96732e62c217af381d3a89d0d4e5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/METADATA
@@ -0,0 +1,99 @@
+Metadata-Version: 2.1
+Name: paramiko
+Version: 3.3.1
+Summary: SSH2 protocol library
+Home-page: https://paramiko.org
+Author: Jeff Forcier
+Author-email: jeff@bitprophet.org
+License: LGPL
+Project-URL: Docs, https://docs.paramiko.org
+Project-URL: Source, https://github.com/paramiko/paramiko
+Project-URL: Issues, https://github.com/paramiko/paramiko/issues
+Project-URL: Changelog, https://www.paramiko.org/changelog.html
+Project-URL: CI, https://app.circleci.com/pipelines/github/paramiko/paramiko
+Platform: Posix; MacOS X; Windows
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: License :: OSI Approved :: GNU Library or Lesser General Public License (LGPL)
+Classifier: Operating System :: OS Independent
+Classifier: Topic :: Internet
+Classifier: Topic :: Security :: Cryptography
+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
+Requires-Dist: bcrypt (>=3.2)
+Requires-Dist: cryptography (>=3.3)
+Requires-Dist: pynacl (>=1.5)
+Provides-Extra: all
+Requires-Dist: pyasn1 (>=0.1.7) ; extra == 'all'
+Requires-Dist: invoke (>=2.0) ; extra == 'all'
+Requires-Dist: gssapi (>=1.4.1) ; (platform_system != "Windows") and extra == 'all'
+Requires-Dist: pywin32 (>=2.1.8) ; (platform_system == "Windows") and extra == 'all'
+Provides-Extra: ed25519
+Provides-Extra: gssapi
+Requires-Dist: pyasn1 (>=0.1.7) ; extra == 'gssapi'
+Requires-Dist: gssapi (>=1.4.1) ; (platform_system != "Windows") and extra == 'gssapi'
+Requires-Dist: pywin32 (>=2.1.8) ; (platform_system == "Windows") and extra == 'gssapi'
+Provides-Extra: invoke
+Requires-Dist: invoke (>=2.0) ; extra == 'invoke'
+
+|version| |python| |license| |ci| |coverage|
+
+.. |version| image:: https://img.shields.io/pypi/v/paramiko
+    :target: https://pypi.org/project/paramiko/
+    :alt: PyPI - Package Version
+.. |python| image:: https://img.shields.io/pypi/pyversions/paramiko
+    :target: https://pypi.org/project/paramiko/
+    :alt: PyPI - Python Version
+.. |license| image:: https://img.shields.io/pypi/l/paramiko
+    :target: https://github.com/paramiko/paramiko/blob/main/LICENSE
+    :alt: PyPI - License
+.. |ci| image:: https://img.shields.io/circleci/build/github/paramiko/paramiko/main
+    :target: https://app.circleci.com/pipelines/github/paramiko/paramiko
+    :alt: CircleCI
+.. |coverage| image:: https://img.shields.io/codecov/c/gh/paramiko/paramiko
+    :target: https://app.codecov.io/gh/paramiko/paramiko
+    :alt: Codecov
+
+Welcome to Paramiko!
+====================
+
+Paramiko is a pure-Python [#]_ (3.6+) implementation of the SSHv2 protocol
+[#]_, providing both client and server functionality. It provides the
+foundation for the high-level SSH library `Fabric <https://fabfile.org>`_,
+which is what we recommend you use for common client use-cases such as running
+remote shell commands or transferring files.
+
+Direct use of Paramiko itself is only intended for users who need
+advanced/low-level primitives or want to run an in-Python sshd.
+
+For installation information, changelogs, FAQs and similar, please visit `our
+main project website <https://paramiko.org>`_; for API details, see `the
+versioned docs <https://docs.paramiko.org>`_. Additionally, the project
+maintainer keeps a `roadmap <http://bitprophet.org/projects#roadmap>`_ on his
+personal site.
+
+.. [#]
+    Paramiko relies on `cryptography <https://cryptography.io>`_ for crypto
+    functionality, which makes use of C and Rust extensions but has many
+    precompiled options available. See `our installation page
+    <https://www.paramiko.org/installing.html>`_ for details.
+
+.. [#]
+    OpenSSH's RFC specification page is a fantastic resource and collection of
+    links that we won't bother replicating here:
+    https://www.openssh.com/specs.html
+
+    OpenSSH itself also happens to be our primary reference implementation:
+    when in doubt, we consult how they do things, unless there are good reasons
+    not to. There are always some gaps, but we do our best to reconcile them
+    when possible.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..1110a7912ea54e558e5ea0478a65375fb1cf429a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/RECORD
@@ -0,0 +1,98 @@
+paramiko-3.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+paramiko-3.3.1.dist-info/LICENSE,sha256=X6Jb9fOV_SbnAcLh3kyn0WKBaYbceRwi-PQiaFetG7I,26436
+paramiko-3.3.1.dist-info/METADATA,sha256=58cv9F05f2DEuR8U7G8bhKz_88JJ9PayOVAIHZN48wY,4404
+paramiko-3.3.1.dist-info/RECORD,,
+paramiko-3.3.1.dist-info/WHEEL,sha256=G16H4A3IeoQmnOrYV4ueZGKSjhipXx8zc8nu9FGlvMA,92
+paramiko-3.3.1.dist-info/top_level.txt,sha256=R9n-eCc_1kx1DnijF7Glmm-H67k9jUz5rm2YoPL8n54,9
+paramiko/__init__.py,sha256=R8uJkIrEBHdqBj8G0TcMZH0uXqmUjIzHgJUVTvHDwro,4423
+paramiko/__pycache__/__init__.cpython-39.pyc,,
+paramiko/__pycache__/_version.cpython-39.pyc,,
+paramiko/__pycache__/_winapi.cpython-39.pyc,,
+paramiko/__pycache__/agent.cpython-39.pyc,,
+paramiko/__pycache__/auth_handler.cpython-39.pyc,,
+paramiko/__pycache__/auth_strategy.cpython-39.pyc,,
+paramiko/__pycache__/ber.cpython-39.pyc,,
+paramiko/__pycache__/buffered_pipe.cpython-39.pyc,,
+paramiko/__pycache__/channel.cpython-39.pyc,,
+paramiko/__pycache__/client.cpython-39.pyc,,
+paramiko/__pycache__/common.cpython-39.pyc,,
+paramiko/__pycache__/compress.cpython-39.pyc,,
+paramiko/__pycache__/config.cpython-39.pyc,,
+paramiko/__pycache__/dsskey.cpython-39.pyc,,
+paramiko/__pycache__/ecdsakey.cpython-39.pyc,,
+paramiko/__pycache__/ed25519key.cpython-39.pyc,,
+paramiko/__pycache__/file.cpython-39.pyc,,
+paramiko/__pycache__/hostkeys.cpython-39.pyc,,
+paramiko/__pycache__/kex_curve25519.cpython-39.pyc,,
+paramiko/__pycache__/kex_ecdh_nist.cpython-39.pyc,,
+paramiko/__pycache__/kex_gex.cpython-39.pyc,,
+paramiko/__pycache__/kex_group1.cpython-39.pyc,,
+paramiko/__pycache__/kex_group14.cpython-39.pyc,,
+paramiko/__pycache__/kex_group16.cpython-39.pyc,,
+paramiko/__pycache__/kex_gss.cpython-39.pyc,,
+paramiko/__pycache__/message.cpython-39.pyc,,
+paramiko/__pycache__/packet.cpython-39.pyc,,
+paramiko/__pycache__/pipe.cpython-39.pyc,,
+paramiko/__pycache__/pkey.cpython-39.pyc,,
+paramiko/__pycache__/primes.cpython-39.pyc,,
+paramiko/__pycache__/proxy.cpython-39.pyc,,
+paramiko/__pycache__/rsakey.cpython-39.pyc,,
+paramiko/__pycache__/server.cpython-39.pyc,,
+paramiko/__pycache__/sftp.cpython-39.pyc,,
+paramiko/__pycache__/sftp_attr.cpython-39.pyc,,
+paramiko/__pycache__/sftp_client.cpython-39.pyc,,
+paramiko/__pycache__/sftp_file.cpython-39.pyc,,
+paramiko/__pycache__/sftp_handle.cpython-39.pyc,,
+paramiko/__pycache__/sftp_server.cpython-39.pyc,,
+paramiko/__pycache__/sftp_si.cpython-39.pyc,,
+paramiko/__pycache__/ssh_exception.cpython-39.pyc,,
+paramiko/__pycache__/ssh_gss.cpython-39.pyc,,
+paramiko/__pycache__/transport.cpython-39.pyc,,
+paramiko/__pycache__/util.cpython-39.pyc,,
+paramiko/__pycache__/win_openssh.cpython-39.pyc,,
+paramiko/__pycache__/win_pageant.cpython-39.pyc,,
+paramiko/_version.py,sha256=e90hTKCN9mMx9TWRrV74Y0B6F05K_uKQY6CSQ897vPQ,80
+paramiko/_winapi.py,sha256=e4PyDmHmyLcAkZo4WAX7ah_I6fq4ex7A8FhxOPYAoA8,11204
+paramiko/agent.py,sha256=4vP4knAAzZiSblzSM_srbTYK2hVnUUT561vTBdCe2i4,15877
+paramiko/auth_handler.py,sha256=kMY00x5sUkrcR9uRHIIakQw4E6649oW1tMtIQPrFMFo,43006
+paramiko/auth_strategy.py,sha256=Pjcp8q64gUwk4CneGOnOhW0WBeKBRFURieWqC9AN0Ec,11437
+paramiko/ber.py,sha256=uFb-YokU4Rg2fKjyX8VMAu05STVk37YRgghlNHmdoYo,4369
+paramiko/buffered_pipe.py,sha256=AlkTLHYWbj4W-ZD7ORQZFjEFv7kC7QSvEYypfiHpwxw,7225
+paramiko/channel.py,sha256=q8sCj7wmDgoPyp_7_TABFsJ5ZoXbQAssxi2aS_Vhfog,49191
+paramiko/client.py,sha256=BjTberxDuu43FHdP273lGRfZI-kf183tQ3CIyB1z4Io,34492
+paramiko/common.py,sha256=sBJW8KJz_EE8TsT7wLWTPuUiL2nNsLa_cfrTCe9Fyio,7756
+paramiko/compress.py,sha256=RCHTino0cHz1dy1pLbOhFhdWfGl4u50VmBcbT7qBWNc,1282
+paramiko/config.py,sha256=QPzwsk4Vem-Ecg2NhjRu78O9SU5ZO6DmfxZTA6cHWco,27362
+paramiko/dsskey.py,sha256=jX9Q5gsKR1hUrvQKSHBZsa96At7NvEO_liT_8G64EP8,8248
+paramiko/ecdsakey.py,sha256=nK8oxORGgLP-zoC2REG46bAchVrlr35jfuxTn_Ac8sM,11653
+paramiko/ed25519key.py,sha256=FYurG0gqxmhNKh_22Hp3XEON5zuvzv-r5w8y9yJQgqY,7457
+paramiko/file.py,sha256=NgbhUjYgrLh-HQtsdYlPZ3CyvS0jhXqePk45GhHPMSo,19063
+paramiko/hostkeys.py,sha256=ErKfOnfzmp8MvonOqkgcySt_Ci9Mp6zDM2QF9aOT4Ms,13208
+paramiko/kex_curve25519.py,sha256=voEFDs_zkgEdWOqDakU-5DLYO3qotWcXYiqOCUP4GDo,4436
+paramiko/kex_ecdh_nist.py,sha256=RbHPwv8Gu5iR9LwMf-N0yUjXEQgRKKBLaAT3dacv44Q,5012
+paramiko/kex_gex.py,sha256=j5fPexu48CGObvpPKn0kZTjdn1onfz0iYhh8p8kIgM0,10320
+paramiko/kex_group1.py,sha256=HfzkLH1SKaIavnN-LGuF-lAMaAECB6Izj_TELhg4Omc,5740
+paramiko/kex_group14.py,sha256=AX7xrTCqMROrMQ_3Dp8WmLkNN8dTovhPjtWgaLLpRxs,1833
+paramiko/kex_group16.py,sha256=s7qB7tSDFkG5ztlg3mV958UVWnKgn1LIA-B2t-h1eX4,2288
+paramiko/kex_gss.py,sha256=BadM1nNN-ORDRuJmb93v0xBGQlce1n29lT4ihsnmY-4,24562
+paramiko/message.py,sha256=wHTWVU_Xgfq-djOOPVF5jAsE-XgADoH47G0iI5N69gY,9349
+paramiko/packet.py,sha256=crFZb0z1crHBKz7JCZPcm8MZghUq68WkT7_IOGNV734,21666
+paramiko/pipe.py,sha256=cmWwOyMdys62IGLC9lDznwTu11xLg6wB9mV-60lr86A,3902
+paramiko/pkey.py,sha256=bGFA-Zbk1xjsNaY6E_PtQQ7WVqW2zPmtWtnXnSySS-M,36007
+paramiko/primes.py,sha256=6Uv0fFsTmIJxInMqeNhryw9jrzvgNksKbA7ecBI0g5E,5107
+paramiko/proxy.py,sha256=I5XxN1aDren3Fw1f3SOoQLP4O9O7jeyey9meG6Og0q4,4648
+paramiko/rsakey.py,sha256=7xoDJvfcaZVVYRGlv8xamhO3zYvE-wI_Nd814L8TxzQ,7546
+paramiko/server.py,sha256=oNkI7t2gSMYIwLov5vl_BbHU-AwFC5LxP78YIXw7mq4,30457
+paramiko/sftp.py,sha256=pyZPnR0fv94YopfPDpslloTiYelu5GuM70cXUGOaKHM,6471
+paramiko/sftp_attr.py,sha256=AX-cG_FiPinftQQq8Ndo1Mc_bZz-AhXFQQpac-oV0wg,8258
+paramiko/sftp_client.py,sha256=e_zi6V233tjx3DH9TH7rRDKRO-TCZ_zyOkBw4sSRIjo,35855
+paramiko/sftp_file.py,sha256=NgVfDhxxURhFrEqniIJQgKQ6wlgCTgOVu5GwQczW_hk,21820
+paramiko/sftp_handle.py,sha256=ho-eyiEvhYHt-_VytznNzNeGktfaIsQX5l4bespWZAk,7424
+paramiko/sftp_server.py,sha256=yH-BgsYj7BuZNGn_EHpnLRPmoNGoYB9g_XxOlK4IcYA,19492
+paramiko/sftp_si.py,sha256=Uf90bFme6Jy6yl7k4jJ28IJboq6KiyPWLjXgP9DR6gk,12544
+paramiko/ssh_exception.py,sha256=UrlHSg4M0Vd9b7SleFOBw3dkeibl-ruMzuPEd58mXPw,7321
+paramiko/ssh_gss.py,sha256=eq_Dcs8Ga1R3xlP2SneSgHOlboY_WgaPJN503OeYCaA,28887
+paramiko/transport.py,sha256=N6sm1K9Q1rHiYkVeSb4TnMYxGp0V7kNHcxWg0F_PoXY,129637
+paramiko/util.py,sha256=v6fIp589sPWNFTaq58X6OhbJY7eOHuzjFz8M7p8PFNE,9550
+paramiko/win_openssh.py,sha256=DbWJT0hiE6UImAbMqehcGuVLDWIl-2rObe-AhaGuWpk,1918
+paramiko/win_pageant.py,sha256=i5TG472VzJKVnK08oxM4hK_qb9IzL_Fo96B8ouaxXHo,4177
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..becc9a66ea739ba941d48a749e248761cc6e658a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/WHEEL
@@ -0,0 +1,5 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.37.1)
+Root-Is-Purelib: true
+Tag: py3-none-any
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..8608c1b021f8e1b01ba7e0d6698102a06214a452
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko-3.3.1.dist-info/top_level.txt
@@ -0,0 +1 @@
+paramiko
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__init__.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..476062efd62dc700e0dd6c434bdea32571c49bf7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/__init__.py
@@ -0,0 +1,164 @@
+# Copyright (C) 2003-2011  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+# flake8: noqa
+import sys
+from paramiko._version import __version__, __version_info__
+from paramiko.transport import (
+    SecurityOptions,
+    Transport,
+    ServiceRequestingTransport,
+)
+from paramiko.client import (
+    SSHClient,
+    MissingHostKeyPolicy,
+    AutoAddPolicy,
+    RejectPolicy,
+    WarningPolicy,
+)
+from paramiko.auth_handler import AuthHandler
+from paramiko.auth_strategy import (
+    AuthFailure,
+    AuthStrategy,
+    AuthResult,
+    AuthSource,
+    InMemoryPrivateKey,
+    NoneAuth,
+    OnDiskPrivateKey,
+    Password,
+    PrivateKey,
+    SourceResult,
+)
+from paramiko.ssh_gss import GSSAuth, GSS_AUTH_AVAILABLE, GSS_EXCEPTIONS
+from paramiko.channel import (
+    Channel,
+    ChannelFile,
+    ChannelStderrFile,
+    ChannelStdinFile,
+)
+from paramiko.ssh_exception import (
+    AuthenticationException,
+    BadAuthenticationType,
+    BadHostKeyException,
+    ChannelException,
+    ConfigParseError,
+    CouldNotCanonicalize,
+    IncompatiblePeer,
+    PasswordRequiredException,
+    ProxyCommandFailure,
+    SSHException,
+)
+from paramiko.server import ServerInterface, SubsystemHandler, InteractiveQuery
+from paramiko.rsakey import RSAKey
+from paramiko.dsskey import DSSKey
+from paramiko.ecdsakey import ECDSAKey
+from paramiko.ed25519key import Ed25519Key
+from paramiko.sftp import SFTPError, BaseSFTP
+from paramiko.sftp_client import SFTP, SFTPClient
+from paramiko.sftp_server import SFTPServer
+from paramiko.sftp_attr import SFTPAttributes
+from paramiko.sftp_handle import SFTPHandle
+from paramiko.sftp_si import SFTPServerInterface
+from paramiko.sftp_file import SFTPFile
+from paramiko.message import Message
+from paramiko.packet import Packetizer
+from paramiko.file import BufferedFile
+from paramiko.agent import Agent, AgentKey
+from paramiko.pkey import PKey, PublicBlob, UnknownKeyType
+from paramiko.hostkeys import HostKeys
+from paramiko.config import SSHConfig, SSHConfigDict
+from paramiko.proxy import ProxyCommand
+
+from paramiko.common import (
+    AUTH_SUCCESSFUL,
+    AUTH_PARTIALLY_SUCCESSFUL,
+    AUTH_FAILED,
+    OPEN_SUCCEEDED,
+    OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED,
+    OPEN_FAILED_CONNECT_FAILED,
+    OPEN_FAILED_UNKNOWN_CHANNEL_TYPE,
+    OPEN_FAILED_RESOURCE_SHORTAGE,
+)
+
+from paramiko.sftp import (
+    SFTP_OK,
+    SFTP_EOF,
+    SFTP_NO_SUCH_FILE,
+    SFTP_PERMISSION_DENIED,
+    SFTP_FAILURE,
+    SFTP_BAD_MESSAGE,
+    SFTP_NO_CONNECTION,
+    SFTP_CONNECTION_LOST,
+    SFTP_OP_UNSUPPORTED,
+)
+
+from paramiko.common import io_sleep
+
+
+# TODO: I guess a real plugin system might be nice for future expansion...
+key_classes = [DSSKey, RSAKey, Ed25519Key, ECDSAKey]
+
+
+__author__ = "Jeff Forcier <jeff@bitprophet.org>"
+__license__ = "GNU Lesser General Public License (LGPL)"
+
+# TODO 4.0: remove this, jeez
+__all__ = [
+    "Agent",
+    "AgentKey",
+    "AuthenticationException",
+    "AutoAddPolicy",
+    "BadAuthenticationType",
+    "BadHostKeyException",
+    "BufferedFile",
+    "Channel",
+    "ChannelException",
+    "ConfigParseError",
+    "CouldNotCanonicalize",
+    "DSSKey",
+    "ECDSAKey",
+    "Ed25519Key",
+    "HostKeys",
+    "Message",
+    "MissingHostKeyPolicy",
+    "PKey",
+    "PasswordRequiredException",
+    "ProxyCommand",
+    "ProxyCommandFailure",
+    "RSAKey",
+    "RejectPolicy",
+    "SFTP",
+    "SFTPAttributes",
+    "SFTPClient",
+    "SFTPError",
+    "SFTPFile",
+    "SFTPHandle",
+    "SFTPServer",
+    "SFTPServerInterface",
+    "SSHClient",
+    "SSHConfig",
+    "SSHConfigDict",
+    "SSHException",
+    "SecurityOptions",
+    "ServerInterface",
+    "SubsystemHandler",
+    "Transport",
+    "WarningPolicy",
+    "io_sleep",
+    "util",
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d97474f696e67703d7d7a9f395e8f2b813f7f221
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9719f96c04305edd3350ee6c1f2870a87657e307
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_winapi.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_winapi.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1fe18c83bfc72a8c63995109b8cf6139ffe8d078
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/_winapi.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/agent.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/agent.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5b4bf437d7d8257d7a00e9a8f787a10e5ff34e80
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/agent.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_handler.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_handler.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7d89aa7f1d6ea1088ad2f4deb6fccef8ad6b31c7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_handler.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_strategy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_strategy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1cf7e63ae1f794869f2ffc1bf1f56b80ccd73f20
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/auth_strategy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ber.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ber.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4b242bab60c2749f2152e6b0738077277ab29215
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ber.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/buffered_pipe.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/buffered_pipe.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a21946d499ea1611bc0b3298c782e96249f05cf7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/buffered_pipe.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/channel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/channel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4fee58fd7c8bf248bf86d4c8c53a496bdcfe03af
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/channel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/client.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/client.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..25b497ca08c11f12c4a0cd1b1b993fcf00e7a383
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/client.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/common.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/common.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a7ea2260d14a5873ff181174403fa41442499a72
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/common.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/compress.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/compress.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..56e00258ce2abd93299597c7a7eaab9ed542ba0d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/compress.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/config.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/config.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..503515462a9d8f338bc3707da577fe46f67dc24f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/config.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/dsskey.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/dsskey.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bd6a3a24f2ca124ca64c4056870add88934ce86f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/dsskey.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ecdsakey.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ecdsakey.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e4e4a90d6f73d6c7af71623545ee1025d4cb110b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ecdsakey.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ed25519key.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ed25519key.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bee12c721f5e9dace55b2696b20e4109928ddde7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ed25519key.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/file.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/file.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0897e65f950d481c460c0d47901ed5c4318cf28e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/file.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/hostkeys.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/hostkeys.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..43cefdcd7ae977d3cdd15f2931b02ef6b958e8ab
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/hostkeys.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_curve25519.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_curve25519.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0d3436b0414b70b201b5bb5dde5a7da7c5fb076b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_curve25519.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_ecdh_nist.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_ecdh_nist.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7edb5e5d7cbf7d0b1fb39b4ed2d4d027cdd0ca46
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_ecdh_nist.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gex.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gex.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..77fc0263d216419ff15237dd3759015357ef0d5b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gex.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group1.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group1.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e5f35f57df906e529df6494dbf1e1d183423e50d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group1.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group14.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group14.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd4ce867fa2654705fd22292bb03dfdf030fb7dd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group14.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group16.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group16.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ffbcd35718ff82a917c910b6a5889840d470a957
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_group16.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gss.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gss.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1fb90c8e1ea6b69b9ef164e7d5f51001c6d7788d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/kex_gss.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/message.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/message.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..74ea2806f6cdc9e9f4ec9e3fee56f99bbe05ac45
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/message.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/packet.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/packet.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..90b145ec5034c6f706ba0e3375f27bd3a3f23887
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/packet.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pipe.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pipe.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..39c214b7b78cbf98481bcc116b558eef88c3c445
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pipe.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pkey.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pkey.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8af2212594ef6ccde5d38ca49f2cb8cf07ad4c58
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/pkey.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/primes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/primes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6f54d11590cfb5cc4bec3204e03dfcd9fc5b6ac4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/primes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/proxy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/proxy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1bd64962bead0c41a98f23df5774479b485bb02d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/proxy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/rsakey.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/rsakey.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3658c308342a53fb18de6d81cc8ac2112c4a50d1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/rsakey.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/server.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/server.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0c475bd5e1684d8e8bd41ac04bda986bb443ff40
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/server.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2f302e9e94ca6f81a2b4d10ab98a4a3daebe5768
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_attr.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_attr.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bdc022cbed4f37496d7eab11d6313fd59013fbbb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_attr.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_client.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_client.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bccb28199e3c55ded232e9c97c3384a86d9e53d7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_client.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_file.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_file.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ebcee4ab9d691e9a1defa16e283941dccaae3399
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_file.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_handle.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_handle.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0e92b256d2a5a39d21d0d0a1aef2019213aff857
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_handle.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_server.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_server.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3875cdf16f23d57024fb9414f0c38e2567143da8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_server.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_si.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_si.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e1313accb6fa638250a0ca0c62ed67e17ae85b91
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/sftp_si.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_exception.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_exception.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8652ce07422fba0a329b58609acb7fa405b55ce1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_exception.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_gss.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_gss.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dabcc6c42a732db55bcdea276b605d4b59513f4d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/ssh_gss.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/transport.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/transport.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f62af748034dccdb61831ac8b61b21820089019d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/transport.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/util.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/util.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..18776bcce35aaa0f490d95de34bf6bc82f542b76
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/util.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_openssh.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_openssh.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..55dcbd52e0452a1c0a33d73ef927cc4475ccc81e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_openssh.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_pageant.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_pageant.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..aab7e930eb573164a3819ab7530cbde932efca96
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/paramiko/__pycache__/win_pageant.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/_version.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/_version.py
new file mode 100644
index 0000000000000000000000000000000000000000..3184d18db9e92b1bb9f19fe3dcabfb1bb27d55b4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/_version.py
@@ -0,0 +1,2 @@
+__version_info__ = (3, 3, 1)
+__version__ = ".".join(map(str, __version_info__))
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/_winapi.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/_winapi.py
new file mode 100644
index 0000000000000000000000000000000000000000..42954574be43e801cf787e0d58b419e350047a9f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/_winapi.py
@@ -0,0 +1,413 @@
+"""
+Windows API functions implemented as ctypes functions and classes as found
+in jaraco.windows (3.4.1).
+
+If you encounter issues with this module, please consider reporting the issues
+in jaraco.windows and asking the author to port the fixes back here.
+"""
+
+import builtins
+import ctypes.wintypes
+
+from paramiko.util import u
+
+
+######################
+# jaraco.windows.error
+
+
+def format_system_message(errno):
+    """
+    Call FormatMessage with a system error number to retrieve
+    the descriptive error message.
+    """
+    # first some flags used by FormatMessageW
+    ALLOCATE_BUFFER = 0x100
+    FROM_SYSTEM = 0x1000
+
+    # Let FormatMessageW allocate the buffer (we'll free it below)
+    # Also, let it know we want a system error message.
+    flags = ALLOCATE_BUFFER | FROM_SYSTEM
+    source = None
+    message_id = errno
+    language_id = 0
+    result_buffer = ctypes.wintypes.LPWSTR()
+    buffer_size = 0
+    arguments = None
+    bytes = ctypes.windll.kernel32.FormatMessageW(
+        flags,
+        source,
+        message_id,
+        language_id,
+        ctypes.byref(result_buffer),
+        buffer_size,
+        arguments,
+    )
+    # note the following will cause an infinite loop if GetLastError
+    #  repeatedly returns an error that cannot be formatted, although
+    #  this should not happen.
+    handle_nonzero_success(bytes)
+    message = result_buffer.value
+    ctypes.windll.kernel32.LocalFree(result_buffer)
+    return message
+
+
+class WindowsError(builtins.WindowsError):
+    """more info about errors at
+    http://msdn.microsoft.com/en-us/library/ms681381(VS.85).aspx"""
+
+    def __init__(self, value=None):
+        if value is None:
+            value = ctypes.windll.kernel32.GetLastError()
+        strerror = format_system_message(value)
+        args = 0, strerror, None, value
+        super().__init__(*args)
+
+    @property
+    def message(self):
+        return self.strerror
+
+    @property
+    def code(self):
+        return self.winerror
+
+    def __str__(self):
+        return self.message
+
+    def __repr__(self):
+        return "{self.__class__.__name__}({self.winerror})".format(**vars())
+
+
+def handle_nonzero_success(result):
+    if result == 0:
+        raise WindowsError()
+
+
+###########################
+# jaraco.windows.api.memory
+
+GMEM_MOVEABLE = 0x2
+
+GlobalAlloc = ctypes.windll.kernel32.GlobalAlloc
+GlobalAlloc.argtypes = ctypes.wintypes.UINT, ctypes.c_size_t
+GlobalAlloc.restype = ctypes.wintypes.HANDLE
+
+GlobalLock = ctypes.windll.kernel32.GlobalLock
+GlobalLock.argtypes = (ctypes.wintypes.HGLOBAL,)
+GlobalLock.restype = ctypes.wintypes.LPVOID
+
+GlobalUnlock = ctypes.windll.kernel32.GlobalUnlock
+GlobalUnlock.argtypes = (ctypes.wintypes.HGLOBAL,)
+GlobalUnlock.restype = ctypes.wintypes.BOOL
+
+GlobalSize = ctypes.windll.kernel32.GlobalSize
+GlobalSize.argtypes = (ctypes.wintypes.HGLOBAL,)
+GlobalSize.restype = ctypes.c_size_t
+
+CreateFileMapping = ctypes.windll.kernel32.CreateFileMappingW
+CreateFileMapping.argtypes = [
+    ctypes.wintypes.HANDLE,
+    ctypes.c_void_p,
+    ctypes.wintypes.DWORD,
+    ctypes.wintypes.DWORD,
+    ctypes.wintypes.DWORD,
+    ctypes.wintypes.LPWSTR,
+]
+CreateFileMapping.restype = ctypes.wintypes.HANDLE
+
+MapViewOfFile = ctypes.windll.kernel32.MapViewOfFile
+MapViewOfFile.restype = ctypes.wintypes.HANDLE
+
+UnmapViewOfFile = ctypes.windll.kernel32.UnmapViewOfFile
+UnmapViewOfFile.argtypes = (ctypes.wintypes.HANDLE,)
+
+RtlMoveMemory = ctypes.windll.kernel32.RtlMoveMemory
+RtlMoveMemory.argtypes = (ctypes.c_void_p, ctypes.c_void_p, ctypes.c_size_t)
+
+ctypes.windll.kernel32.LocalFree.argtypes = (ctypes.wintypes.HLOCAL,)
+
+#####################
+# jaraco.windows.mmap
+
+
+class MemoryMap:
+    """
+    A memory map object which can have security attributes overridden.
+    """
+
+    def __init__(self, name, length, security_attributes=None):
+        self.name = name
+        self.length = length
+        self.security_attributes = security_attributes
+        self.pos = 0
+
+    def __enter__(self):
+        p_SA = (
+            ctypes.byref(self.security_attributes)
+            if self.security_attributes
+            else None
+        )
+        INVALID_HANDLE_VALUE = -1
+        PAGE_READWRITE = 0x4
+        FILE_MAP_WRITE = 0x2
+        filemap = ctypes.windll.kernel32.CreateFileMappingW(
+            INVALID_HANDLE_VALUE,
+            p_SA,
+            PAGE_READWRITE,
+            0,
+            self.length,
+            u(self.name),
+        )
+        handle_nonzero_success(filemap)
+        if filemap == INVALID_HANDLE_VALUE:
+            raise Exception("Failed to create file mapping")
+        self.filemap = filemap
+        self.view = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0)
+        return self
+
+    def seek(self, pos):
+        self.pos = pos
+
+    def write(self, msg):
+        assert isinstance(msg, bytes)
+        n = len(msg)
+        if self.pos + n >= self.length:  # A little safety.
+            raise ValueError(f"Refusing to write {n} bytes")
+        dest = self.view + self.pos
+        length = ctypes.c_size_t(n)
+        ctypes.windll.kernel32.RtlMoveMemory(dest, msg, length)
+        self.pos += n
+
+    def read(self, n):
+        """
+        Read n bytes from mapped view.
+        """
+        out = ctypes.create_string_buffer(n)
+        source = self.view + self.pos
+        length = ctypes.c_size_t(n)
+        ctypes.windll.kernel32.RtlMoveMemory(out, source, length)
+        self.pos += n
+        return out.raw
+
+    def __exit__(self, exc_type, exc_val, tb):
+        ctypes.windll.kernel32.UnmapViewOfFile(self.view)
+        ctypes.windll.kernel32.CloseHandle(self.filemap)
+
+
+#############################
+# jaraco.windows.api.security
+
+# from WinNT.h
+READ_CONTROL = 0x00020000
+STANDARD_RIGHTS_REQUIRED = 0x000F0000
+STANDARD_RIGHTS_READ = READ_CONTROL
+STANDARD_RIGHTS_WRITE = READ_CONTROL
+STANDARD_RIGHTS_EXECUTE = READ_CONTROL
+STANDARD_RIGHTS_ALL = 0x001F0000
+
+# from NTSecAPI.h
+POLICY_VIEW_LOCAL_INFORMATION = 0x00000001
+POLICY_VIEW_AUDIT_INFORMATION = 0x00000002
+POLICY_GET_PRIVATE_INFORMATION = 0x00000004
+POLICY_TRUST_ADMIN = 0x00000008
+POLICY_CREATE_ACCOUNT = 0x00000010
+POLICY_CREATE_SECRET = 0x00000020
+POLICY_CREATE_PRIVILEGE = 0x00000040
+POLICY_SET_DEFAULT_QUOTA_LIMITS = 0x00000080
+POLICY_SET_AUDIT_REQUIREMENTS = 0x00000100
+POLICY_AUDIT_LOG_ADMIN = 0x00000200
+POLICY_SERVER_ADMIN = 0x00000400
+POLICY_LOOKUP_NAMES = 0x00000800
+POLICY_NOTIFICATION = 0x00001000
+
+POLICY_ALL_ACCESS = (
+    STANDARD_RIGHTS_REQUIRED
+    | POLICY_VIEW_LOCAL_INFORMATION
+    | POLICY_VIEW_AUDIT_INFORMATION
+    | POLICY_GET_PRIVATE_INFORMATION
+    | POLICY_TRUST_ADMIN
+    | POLICY_CREATE_ACCOUNT
+    | POLICY_CREATE_SECRET
+    | POLICY_CREATE_PRIVILEGE
+    | POLICY_SET_DEFAULT_QUOTA_LIMITS
+    | POLICY_SET_AUDIT_REQUIREMENTS
+    | POLICY_AUDIT_LOG_ADMIN
+    | POLICY_SERVER_ADMIN
+    | POLICY_LOOKUP_NAMES
+)
+
+
+POLICY_READ = (
+    STANDARD_RIGHTS_READ
+    | POLICY_VIEW_AUDIT_INFORMATION
+    | POLICY_GET_PRIVATE_INFORMATION
+)
+
+POLICY_WRITE = (
+    STANDARD_RIGHTS_WRITE
+    | POLICY_TRUST_ADMIN
+    | POLICY_CREATE_ACCOUNT
+    | POLICY_CREATE_SECRET
+    | POLICY_CREATE_PRIVILEGE
+    | POLICY_SET_DEFAULT_QUOTA_LIMITS
+    | POLICY_SET_AUDIT_REQUIREMENTS
+    | POLICY_AUDIT_LOG_ADMIN
+    | POLICY_SERVER_ADMIN
+)
+
+POLICY_EXECUTE = (
+    STANDARD_RIGHTS_EXECUTE
+    | POLICY_VIEW_LOCAL_INFORMATION
+    | POLICY_LOOKUP_NAMES
+)
+
+
+class TokenAccess:
+    TOKEN_QUERY = 0x8
+
+
+class TokenInformationClass:
+    TokenUser = 1
+
+
+class TOKEN_USER(ctypes.Structure):
+    num = 1
+    _fields_ = [
+        ("SID", ctypes.c_void_p),
+        ("ATTRIBUTES", ctypes.wintypes.DWORD),
+    ]
+
+
+class SECURITY_DESCRIPTOR(ctypes.Structure):
+    """
+    typedef struct _SECURITY_DESCRIPTOR
+        {
+        UCHAR Revision;
+        UCHAR Sbz1;
+        SECURITY_DESCRIPTOR_CONTROL Control;
+        PSID Owner;
+        PSID Group;
+        PACL Sacl;
+        PACL Dacl;
+        }   SECURITY_DESCRIPTOR;
+    """
+
+    SECURITY_DESCRIPTOR_CONTROL = ctypes.wintypes.USHORT
+    REVISION = 1
+
+    _fields_ = [
+        ("Revision", ctypes.c_ubyte),
+        ("Sbz1", ctypes.c_ubyte),
+        ("Control", SECURITY_DESCRIPTOR_CONTROL),
+        ("Owner", ctypes.c_void_p),
+        ("Group", ctypes.c_void_p),
+        ("Sacl", ctypes.c_void_p),
+        ("Dacl", ctypes.c_void_p),
+    ]
+
+
+class SECURITY_ATTRIBUTES(ctypes.Structure):
+    """
+    typedef struct _SECURITY_ATTRIBUTES {
+        DWORD  nLength;
+        LPVOID lpSecurityDescriptor;
+        BOOL   bInheritHandle;
+    } SECURITY_ATTRIBUTES;
+    """
+
+    _fields_ = [
+        ("nLength", ctypes.wintypes.DWORD),
+        ("lpSecurityDescriptor", ctypes.c_void_p),
+        ("bInheritHandle", ctypes.wintypes.BOOL),
+    ]
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self.nLength = ctypes.sizeof(SECURITY_ATTRIBUTES)
+
+    @property
+    def descriptor(self):
+        return self._descriptor
+
+    @descriptor.setter
+    def descriptor(self, value):
+        self._descriptor = value
+        self.lpSecurityDescriptor = ctypes.addressof(value)
+
+
+ctypes.windll.advapi32.SetSecurityDescriptorOwner.argtypes = (
+    ctypes.POINTER(SECURITY_DESCRIPTOR),
+    ctypes.c_void_p,
+    ctypes.wintypes.BOOL,
+)
+
+#########################
+# jaraco.windows.security
+
+
+def GetTokenInformation(token, information_class):
+    """
+    Given a token, get the token information for it.
+    """
+    data_size = ctypes.wintypes.DWORD()
+    ctypes.windll.advapi32.GetTokenInformation(
+        token, information_class.num, 0, 0, ctypes.byref(data_size)
+    )
+    data = ctypes.create_string_buffer(data_size.value)
+    handle_nonzero_success(
+        ctypes.windll.advapi32.GetTokenInformation(
+            token,
+            information_class.num,
+            ctypes.byref(data),
+            ctypes.sizeof(data),
+            ctypes.byref(data_size),
+        )
+    )
+    return ctypes.cast(data, ctypes.POINTER(TOKEN_USER)).contents
+
+
+def OpenProcessToken(proc_handle, access):
+    result = ctypes.wintypes.HANDLE()
+    proc_handle = ctypes.wintypes.HANDLE(proc_handle)
+    handle_nonzero_success(
+        ctypes.windll.advapi32.OpenProcessToken(
+            proc_handle, access, ctypes.byref(result)
+        )
+    )
+    return result
+
+
+def get_current_user():
+    """
+    Return a TOKEN_USER for the owner of this process.
+    """
+    process = OpenProcessToken(
+        ctypes.windll.kernel32.GetCurrentProcess(), TokenAccess.TOKEN_QUERY
+    )
+    return GetTokenInformation(process, TOKEN_USER)
+
+
+def get_security_attributes_for_user(user=None):
+    """
+    Return a SECURITY_ATTRIBUTES structure with the SID set to the
+    specified user (uses current user if none is specified).
+    """
+    if user is None:
+        user = get_current_user()
+
+    assert isinstance(user, TOKEN_USER), "user must be TOKEN_USER instance"
+
+    SD = SECURITY_DESCRIPTOR()
+    SA = SECURITY_ATTRIBUTES()
+    # by attaching the actual security descriptor, it will be garbage-
+    # collected with the security attributes
+    SA.descriptor = SD
+    SA.bInheritHandle = 1
+
+    ctypes.windll.advapi32.InitializeSecurityDescriptor(
+        ctypes.byref(SD), SECURITY_DESCRIPTOR.REVISION
+    )
+    ctypes.windll.advapi32.SetSecurityDescriptorOwner(
+        ctypes.byref(SD), user.SID, 0
+    )
+    return SA
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/agent.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/agent.py
new file mode 100644
index 0000000000000000000000000000000000000000..b29a0d14c7c25a24c113064bb1a703cd9341bb88
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/agent.py
@@ -0,0 +1,497 @@
+# Copyright (C) 2003-2007  John Rochester <john@jrochester.org>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+SSH Agent interface
+"""
+
+import os
+import socket
+import struct
+import sys
+import threading
+import time
+import tempfile
+import stat
+from logging import DEBUG
+from select import select
+from paramiko.common import io_sleep, byte_chr
+
+from paramiko.ssh_exception import SSHException, AuthenticationException
+from paramiko.message import Message
+from paramiko.pkey import PKey, UnknownKeyType
+from paramiko.util import asbytes, get_logger
+
+cSSH2_AGENTC_REQUEST_IDENTITIES = byte_chr(11)
+SSH2_AGENT_IDENTITIES_ANSWER = 12
+cSSH2_AGENTC_SIGN_REQUEST = byte_chr(13)
+SSH2_AGENT_SIGN_RESPONSE = 14
+
+SSH_AGENT_RSA_SHA2_256 = 2
+SSH_AGENT_RSA_SHA2_512 = 4
+# NOTE: RFC mildly confusing; while these flags are OR'd together, OpenSSH at
+# least really treats them like "AND"s, in the sense that if it finds the
+# SHA256 flag set it won't continue looking at the SHA512 one; it
+# short-circuits right away.
+# Thus, we never want to eg submit 6 to say "either's good".
+ALGORITHM_FLAG_MAP = {
+    "rsa-sha2-256": SSH_AGENT_RSA_SHA2_256,
+    "rsa-sha2-512": SSH_AGENT_RSA_SHA2_512,
+}
+for key, value in list(ALGORITHM_FLAG_MAP.items()):
+    ALGORITHM_FLAG_MAP[f"{key}-cert-v01@openssh.com"] = value
+
+
+# TODO 4.0: rename all these - including making some of their methods public?
+class AgentSSH:
+    def __init__(self):
+        self._conn = None
+        self._keys = ()
+
+    def get_keys(self):
+        """
+        Return the list of keys available through the SSH agent, if any.  If
+        no SSH agent was running (or it couldn't be contacted), an empty list
+        will be returned.
+
+        This method performs no IO, just returns the list of keys retrieved
+        when the connection was made.
+
+        :return:
+            a tuple of `.AgentKey` objects representing keys available on the
+            SSH agent
+        """
+        return self._keys
+
+    def _connect(self, conn):
+        self._conn = conn
+        ptype, result = self._send_message(cSSH2_AGENTC_REQUEST_IDENTITIES)
+        if ptype != SSH2_AGENT_IDENTITIES_ANSWER:
+            raise SSHException("could not get keys from ssh-agent")
+        keys = []
+        for i in range(result.get_int()):
+            keys.append(
+                AgentKey(
+                    agent=self,
+                    blob=result.get_binary(),
+                    comment=result.get_text(),
+                )
+            )
+        self._keys = tuple(keys)
+
+    def _close(self):
+        if self._conn is not None:
+            self._conn.close()
+        self._conn = None
+        self._keys = ()
+
+    def _send_message(self, msg):
+        msg = asbytes(msg)
+        self._conn.send(struct.pack(">I", len(msg)) + msg)
+        data = self._read_all(4)
+        msg = Message(self._read_all(struct.unpack(">I", data)[0]))
+        return ord(msg.get_byte()), msg
+
+    def _read_all(self, wanted):
+        result = self._conn.recv(wanted)
+        while len(result) < wanted:
+            if len(result) == 0:
+                raise SSHException("lost ssh-agent")
+            extra = self._conn.recv(wanted - len(result))
+            if len(extra) == 0:
+                raise SSHException("lost ssh-agent")
+            result += extra
+        return result
+
+
+class AgentProxyThread(threading.Thread):
+    """
+    Class in charge of communication between two channels.
+    """
+
+    def __init__(self, agent):
+        threading.Thread.__init__(self, target=self.run)
+        self._agent = agent
+        self._exit = False
+
+    def run(self):
+        try:
+            (r, addr) = self.get_connection()
+            # Found that r should be either
+            # a socket from the socket library or None
+            self.__inr = r
+            # The address should be an IP address as a string? or None
+            self.__addr = addr
+            self._agent.connect()
+            if not isinstance(self._agent, int) and (
+                self._agent._conn is None
+                or not hasattr(self._agent._conn, "fileno")
+            ):
+                raise AuthenticationException("Unable to connect to SSH agent")
+            self._communicate()
+        except:
+            # XXX Not sure what to do here ... raise or pass ?
+            raise
+
+    def _communicate(self):
+        import fcntl
+
+        oldflags = fcntl.fcntl(self.__inr, fcntl.F_GETFL)
+        fcntl.fcntl(self.__inr, fcntl.F_SETFL, oldflags | os.O_NONBLOCK)
+        while not self._exit:
+            events = select([self._agent._conn, self.__inr], [], [], 0.5)
+            for fd in events[0]:
+                if self._agent._conn == fd:
+                    data = self._agent._conn.recv(512)
+                    if len(data) != 0:
+                        self.__inr.send(data)
+                    else:
+                        self._close()
+                        break
+                elif self.__inr == fd:
+                    data = self.__inr.recv(512)
+                    if len(data) != 0:
+                        self._agent._conn.send(data)
+                    else:
+                        self._close()
+                        break
+            time.sleep(io_sleep)
+
+    def _close(self):
+        self._exit = True
+        self.__inr.close()
+        self._agent._conn.close()
+
+
+class AgentLocalProxy(AgentProxyThread):
+    """
+    Class to be used when wanting to ask a local SSH Agent being
+    asked from a remote fake agent (so use a unix socket for ex.)
+    """
+
+    def __init__(self, agent):
+        AgentProxyThread.__init__(self, agent)
+
+    def get_connection(self):
+        """
+        Return a pair of socket object and string address.
+
+        May block!
+        """
+        conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+        try:
+            conn.bind(self._agent._get_filename())
+            conn.listen(1)
+            (r, addr) = conn.accept()
+            return r, addr
+        except:
+            raise
+
+
+class AgentRemoteProxy(AgentProxyThread):
+    """
+    Class to be used when wanting to ask a remote SSH Agent
+    """
+
+    def __init__(self, agent, chan):
+        AgentProxyThread.__init__(self, agent)
+        self.__chan = chan
+
+    def get_connection(self):
+        return self.__chan, None
+
+
+def get_agent_connection():
+    """
+    Returns some SSH agent object, or None if none were found/supported.
+
+    .. versionadded:: 2.10
+    """
+    if ("SSH_AUTH_SOCK" in os.environ) and (sys.platform != "win32"):
+        conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
+        try:
+            conn.connect(os.environ["SSH_AUTH_SOCK"])
+            return conn
+        except:
+            # probably a dangling env var: the ssh agent is gone
+            return
+    elif sys.platform == "win32":
+        from . import win_pageant, win_openssh
+
+        conn = None
+        if win_pageant.can_talk_to_agent():
+            conn = win_pageant.PageantConnection()
+        elif win_openssh.can_talk_to_agent():
+            conn = win_openssh.OpenSSHAgentConnection()
+        return conn
+    else:
+        # no agent support
+        return
+
+
+class AgentClientProxy:
+    """
+    Class proxying request as a client:
+
+    #. client ask for a request_forward_agent()
+    #. server creates a proxy and a fake SSH Agent
+    #. server ask for establishing a connection when needed,
+       calling the forward_agent_handler at client side.
+    #. the forward_agent_handler launch a thread for connecting
+       the remote fake agent and the local agent
+    #. Communication occurs ...
+    """
+
+    def __init__(self, chanRemote):
+        self._conn = None
+        self.__chanR = chanRemote
+        self.thread = AgentRemoteProxy(self, chanRemote)
+        self.thread.start()
+
+    def __del__(self):
+        self.close()
+
+    def connect(self):
+        """
+        Method automatically called by ``AgentProxyThread.run``.
+        """
+        conn = get_agent_connection()
+        if not conn:
+            return
+        self._conn = conn
+
+    def close(self):
+        """
+        Close the current connection and terminate the agent
+        Should be called manually
+        """
+        if hasattr(self, "thread"):
+            self.thread._exit = True
+            self.thread.join(1000)
+        if self._conn is not None:
+            self._conn.close()
+
+
+class AgentServerProxy(AgentSSH):
+    """
+    Allows an SSH server to access a forwarded agent.
+
+    This also creates a unix domain socket on the system to allow external
+    programs to also access the agent. For this reason, you probably only want
+    to create one of these.
+
+    :meth:`connect` must be called before it is usable. This will also load the
+    list of keys the agent contains. You must also call :meth:`close` in
+    order to clean up the unix socket and the thread that maintains it.
+    (:class:`contextlib.closing` might be helpful to you.)
+
+    :param .Transport t: Transport used for SSH Agent communication forwarding
+
+    :raises: `.SSHException` -- mostly if we lost the agent
+    """
+
+    def __init__(self, t):
+        AgentSSH.__init__(self)
+        self.__t = t
+        self._dir = tempfile.mkdtemp("sshproxy")
+        os.chmod(self._dir, stat.S_IRWXU)
+        self._file = self._dir + "/sshproxy.ssh"
+        self.thread = AgentLocalProxy(self)
+        self.thread.start()
+
+    def __del__(self):
+        self.close()
+
+    def connect(self):
+        conn_sock = self.__t.open_forward_agent_channel()
+        if conn_sock is None:
+            raise SSHException("lost ssh-agent")
+        conn_sock.set_name("auth-agent")
+        self._connect(conn_sock)
+
+    def close(self):
+        """
+        Terminate the agent, clean the files, close connections
+        Should be called manually
+        """
+        os.remove(self._file)
+        os.rmdir(self._dir)
+        self.thread._exit = True
+        self.thread.join(1000)
+        self._close()
+
+    def get_env(self):
+        """
+        Helper for the environment under unix
+
+        :return:
+            a dict containing the ``SSH_AUTH_SOCK`` environment variables
+        """
+        return {"SSH_AUTH_SOCK": self._get_filename()}
+
+    def _get_filename(self):
+        return self._file
+
+
+class AgentRequestHandler:
+    """
+    Primary/default implementation of SSH agent forwarding functionality.
+
+    Simply instantiate this class, handing it a live command-executing session
+    object, and it will handle forwarding any local SSH agent processes it
+    finds.
+
+    For example::
+
+        # Connect
+        client = SSHClient()
+        client.connect(host, port, username)
+        # Obtain session
+        session = client.get_transport().open_session()
+        # Forward local agent
+        AgentRequestHandler(session)
+        # Commands executed after this point will see the forwarded agent on
+        # the remote end.
+        session.exec_command("git clone https://my.git.repository/")
+    """
+
+    def __init__(self, chanClient):
+        self._conn = None
+        self.__chanC = chanClient
+        chanClient.request_forward_agent(self._forward_agent_handler)
+        self.__clientProxys = []
+
+    def _forward_agent_handler(self, chanRemote):
+        self.__clientProxys.append(AgentClientProxy(chanRemote))
+
+    def __del__(self):
+        self.close()
+
+    def close(self):
+        for p in self.__clientProxys:
+            p.close()
+
+
+class Agent(AgentSSH):
+    """
+    Client interface for using private keys from an SSH agent running on the
+    local machine.  If an SSH agent is running, this class can be used to
+    connect to it and retrieve `.PKey` objects which can be used when
+    attempting to authenticate to remote SSH servers.
+
+    Upon initialization, a session with the local machine's SSH agent is
+    opened, if one is running. If no agent is running, initialization will
+    succeed, but `get_keys` will return an empty tuple.
+
+    :raises: `.SSHException` --
+        if an SSH agent is found, but speaks an incompatible protocol
+
+    .. versionchanged:: 2.10
+        Added support for native openssh agent on windows (extending previous
+        putty pageant support)
+    """
+
+    def __init__(self):
+        AgentSSH.__init__(self)
+
+        conn = get_agent_connection()
+        if not conn:
+            return
+        self._connect(conn)
+
+    def close(self):
+        """
+        Close the SSH agent connection.
+        """
+        self._close()
+
+
+class AgentKey(PKey):
+    """
+    Private key held in a local SSH agent.  This type of key can be used for
+    authenticating to a remote server (signing).  Most other key operations
+    work as expected.
+
+    .. versionchanged:: 3.2
+        Added the ``comment`` kwarg and attribute.
+
+    .. versionchanged:: 3.2
+        Added the ``.inner_key`` attribute holding a reference to the 'real'
+        key instance this key is a proxy for, if one was obtainable, else None.
+    """
+
+    def __init__(self, agent, blob, comment=""):
+        self.agent = agent
+        self.blob = blob
+        self.comment = comment
+        msg = Message(blob)
+        self.name = msg.get_text()
+        self._logger = get_logger(__file__)
+        self.inner_key = None
+        try:
+            self.inner_key = PKey.from_type_string(
+                key_type=self.name, key_bytes=blob
+            )
+        except UnknownKeyType:
+            # Log, but don't explode, since inner_key is a best-effort thing.
+            err = "Unable to derive inner_key for agent key of type {!r}"
+            self.log(DEBUG, err.format(self.name))
+
+    def log(self, *args, **kwargs):
+        return self._logger.log(*args, **kwargs)
+
+    def asbytes(self):
+        # Prefer inner_key.asbytes, since that will differ for eg RSA-CERT
+        return self.inner_key.asbytes() if self.inner_key else self.blob
+
+    def get_name(self):
+        return self.name
+
+    def get_bits(self):
+        # Have to work around PKey's default get_bits being crap
+        if self.inner_key is not None:
+            return self.inner_key.get_bits()
+        return super().get_bits()
+
+    def __getattr__(self, name):
+        """
+        Proxy any un-implemented methods/properties to the inner_key.
+        """
+        if self.inner_key is None:  # nothing to proxy to
+            raise AttributeError(name)
+        return getattr(self.inner_key, name)
+
+    @property
+    def _fields(self):
+        fallback = [self.get_name(), self.blob]
+        return self.inner_key._fields if self.inner_key else fallback
+
+    def sign_ssh_data(self, data, algorithm=None):
+        msg = Message()
+        msg.add_byte(cSSH2_AGENTC_SIGN_REQUEST)
+        # NOTE: this used to be just self.blob, which is not entirely right for
+        # RSA-CERT 'keys' - those end up always degrading to ssh-rsa type
+        # signatures, for reasons probably internal to OpenSSH's agent code,
+        # even if everything else wants SHA2 (including our flag map).
+        msg.add_string(self.asbytes())
+        msg.add_string(data)
+        msg.add_int(ALGORITHM_FLAG_MAP.get(algorithm, 0))
+        ptype, result = self.agent._send_message(msg)
+        if ptype != SSH2_AGENT_SIGN_RESPONSE:
+            raise SSHException("key cannot be used for signing")
+        return result.get_binary()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_handler.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_handler.py
new file mode 100644
index 0000000000000000000000000000000000000000..bc7f298fec17b42d4dd5f9df9b812cc6f6340902
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_handler.py
@@ -0,0 +1,1092 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+`.AuthHandler`
+"""
+
+import weakref
+import threading
+import time
+import re
+
+from paramiko.common import (
+    cMSG_SERVICE_REQUEST,
+    cMSG_DISCONNECT,
+    DISCONNECT_SERVICE_NOT_AVAILABLE,
+    DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE,
+    cMSG_USERAUTH_REQUEST,
+    cMSG_SERVICE_ACCEPT,
+    DEBUG,
+    AUTH_SUCCESSFUL,
+    INFO,
+    cMSG_USERAUTH_SUCCESS,
+    cMSG_USERAUTH_FAILURE,
+    AUTH_PARTIALLY_SUCCESSFUL,
+    cMSG_USERAUTH_INFO_REQUEST,
+    WARNING,
+    AUTH_FAILED,
+    cMSG_USERAUTH_PK_OK,
+    cMSG_USERAUTH_INFO_RESPONSE,
+    MSG_SERVICE_REQUEST,
+    MSG_SERVICE_ACCEPT,
+    MSG_USERAUTH_REQUEST,
+    MSG_USERAUTH_SUCCESS,
+    MSG_USERAUTH_FAILURE,
+    MSG_USERAUTH_BANNER,
+    MSG_USERAUTH_INFO_REQUEST,
+    MSG_USERAUTH_INFO_RESPONSE,
+    cMSG_USERAUTH_GSSAPI_RESPONSE,
+    cMSG_USERAUTH_GSSAPI_TOKEN,
+    cMSG_USERAUTH_GSSAPI_MIC,
+    MSG_USERAUTH_GSSAPI_RESPONSE,
+    MSG_USERAUTH_GSSAPI_TOKEN,
+    MSG_USERAUTH_GSSAPI_ERROR,
+    MSG_USERAUTH_GSSAPI_ERRTOK,
+    MSG_USERAUTH_GSSAPI_MIC,
+    MSG_NAMES,
+    cMSG_USERAUTH_BANNER,
+)
+from paramiko.message import Message
+from paramiko.util import b, u
+from paramiko.ssh_exception import (
+    SSHException,
+    AuthenticationException,
+    BadAuthenticationType,
+    PartialAuthentication,
+)
+from paramiko.server import InteractiveQuery
+from paramiko.ssh_gss import GSSAuth, GSS_EXCEPTIONS
+
+
+class AuthHandler:
+    """
+    Internal class to handle the mechanics of authentication.
+    """
+
+    def __init__(self, transport):
+        self.transport = weakref.proxy(transport)
+        self.username = None
+        self.authenticated = False
+        self.auth_event = None
+        self.auth_method = ""
+        self.banner = None
+        self.password = None
+        self.private_key = None
+        self.interactive_handler = None
+        self.submethods = None
+        # for server mode:
+        self.auth_username = None
+        self.auth_fail_count = 0
+        # for GSSAPI
+        self.gss_host = None
+        self.gss_deleg_creds = True
+
+    def _log(self, *args):
+        return self.transport._log(*args)
+
+    def is_authenticated(self):
+        return self.authenticated
+
+    def get_username(self):
+        if self.transport.server_mode:
+            return self.auth_username
+        else:
+            return self.username
+
+    def auth_none(self, username, event):
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "none"
+            self.username = username
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def auth_publickey(self, username, key, event):
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "publickey"
+            self.username = username
+            self.private_key = key
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def auth_password(self, username, password, event):
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "password"
+            self.username = username
+            self.password = password
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def auth_interactive(self, username, handler, event, submethods=""):
+        """
+        response_list = handler(title, instructions, prompt_list)
+        """
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "keyboard-interactive"
+            self.username = username
+            self.interactive_handler = handler
+            self.submethods = submethods
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def auth_gssapi_with_mic(self, username, gss_host, gss_deleg_creds, event):
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "gssapi-with-mic"
+            self.username = username
+            self.gss_host = gss_host
+            self.gss_deleg_creds = gss_deleg_creds
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def auth_gssapi_keyex(self, username, event):
+        self.transport.lock.acquire()
+        try:
+            self.auth_event = event
+            self.auth_method = "gssapi-keyex"
+            self.username = username
+            self._request_auth()
+        finally:
+            self.transport.lock.release()
+
+    def abort(self):
+        if self.auth_event is not None:
+            self.auth_event.set()
+
+    # ...internals...
+
+    def _request_auth(self):
+        m = Message()
+        m.add_byte(cMSG_SERVICE_REQUEST)
+        m.add_string("ssh-userauth")
+        self.transport._send_message(m)
+
+    def _disconnect_service_not_available(self):
+        m = Message()
+        m.add_byte(cMSG_DISCONNECT)
+        m.add_int(DISCONNECT_SERVICE_NOT_AVAILABLE)
+        m.add_string("Service not available")
+        m.add_string("en")
+        self.transport._send_message(m)
+        self.transport.close()
+
+    def _disconnect_no_more_auth(self):
+        m = Message()
+        m.add_byte(cMSG_DISCONNECT)
+        m.add_int(DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE)
+        m.add_string("No more auth methods available")
+        m.add_string("en")
+        self.transport._send_message(m)
+        self.transport.close()
+
+    def _get_key_type_and_bits(self, key):
+        """
+        Given any key, return its type/algorithm & bits-to-sign.
+
+        Intended for input to or verification of, key signatures.
+        """
+        # Use certificate contents, if available, plain pubkey otherwise
+        if key.public_blob:
+            return key.public_blob.key_type, key.public_blob.key_blob
+        else:
+            return key.get_name(), key
+
+    def _get_session_blob(self, key, service, username, algorithm):
+        m = Message()
+        m.add_string(self.transport.session_id)
+        m.add_byte(cMSG_USERAUTH_REQUEST)
+        m.add_string(username)
+        m.add_string(service)
+        m.add_string("publickey")
+        m.add_boolean(True)
+        _, bits = self._get_key_type_and_bits(key)
+        m.add_string(algorithm)
+        m.add_string(bits)
+        return m.asbytes()
+
+    def wait_for_response(self, event):
+        max_ts = None
+        if self.transport.auth_timeout is not None:
+            max_ts = time.time() + self.transport.auth_timeout
+        while True:
+            event.wait(0.1)
+            if not self.transport.is_active():
+                e = self.transport.get_exception()
+                if (e is None) or issubclass(e.__class__, EOFError):
+                    e = AuthenticationException(
+                        "Authentication failed: transport shut down or saw EOF"
+                    )
+                raise e
+            if event.is_set():
+                break
+            if max_ts is not None and max_ts <= time.time():
+                raise AuthenticationException("Authentication timeout.")
+
+        if not self.is_authenticated():
+            e = self.transport.get_exception()
+            if e is None:
+                e = AuthenticationException("Authentication failed.")
+            # this is horrible.  Python Exception isn't yet descended from
+            # object, so type(e) won't work. :(
+            # TODO 4.0: lol. just lmao.
+            if issubclass(e.__class__, PartialAuthentication):
+                return e.allowed_types
+            raise e
+        return []
+
+    def _parse_service_request(self, m):
+        service = m.get_text()
+        if self.transport.server_mode and (service == "ssh-userauth"):
+            # accepted
+            m = Message()
+            m.add_byte(cMSG_SERVICE_ACCEPT)
+            m.add_string(service)
+            self.transport._send_message(m)
+            banner, language = self.transport.server_object.get_banner()
+            if banner:
+                m = Message()
+                m.add_byte(cMSG_USERAUTH_BANNER)
+                m.add_string(banner)
+                m.add_string(language)
+                self.transport._send_message(m)
+            return
+        # dunno this one
+        self._disconnect_service_not_available()
+
+    def _generate_key_from_request(self, algorithm, keyblob):
+        # For use in server mode.
+        options = self.transport.preferred_pubkeys
+        if algorithm.replace("-cert-v01@openssh.com", "") not in options:
+            err = (
+                "Auth rejected: pubkey algorithm '{}' unsupported or disabled"
+            )
+            self._log(INFO, err.format(algorithm))
+            return None
+        return self.transport._key_info[algorithm](Message(keyblob))
+
+    def _choose_fallback_pubkey_algorithm(self, key_type, my_algos):
+        # Fallback: first one in our (possibly tweaked by caller) list
+        pubkey_algo = my_algos[0]
+        msg = "Server did not send a server-sig-algs list; defaulting to our first preferred algo ({!r})"  # noqa
+        self._log(DEBUG, msg.format(pubkey_algo))
+        self._log(
+            DEBUG,
+            "NOTE: you may use the 'disabled_algorithms' SSHClient/Transport init kwarg to disable that or other algorithms if your server does not support them!",  # noqa
+        )
+        return pubkey_algo
+
+    def _finalize_pubkey_algorithm(self, key_type):
+        # Short-circuit for non-RSA keys
+        if "rsa" not in key_type:
+            return key_type
+        self._log(
+            DEBUG,
+            "Finalizing pubkey algorithm for key of type {!r}".format(
+                key_type
+            ),
+        )
+        # NOTE re #2017: When the key is an RSA cert and the remote server is
+        # OpenSSH 7.7 or earlier, always use ssh-rsa-cert-v01@openssh.com.
+        # Those versions of the server won't support rsa-sha2 family sig algos
+        # for certs specifically, and in tandem with various server bugs
+        # regarding server-sig-algs, it's impossible to fit this into the rest
+        # of the logic here.
+        if key_type.endswith("-cert-v01@openssh.com") and re.search(
+            r"-OpenSSH_(?:[1-6]|7\.[0-7])", self.transport.remote_version
+        ):
+            pubkey_algo = "ssh-rsa-cert-v01@openssh.com"
+            self.transport._agreed_pubkey_algorithm = pubkey_algo
+            self._log(DEBUG, "OpenSSH<7.8 + RSA cert = forcing ssh-rsa!")
+            self._log(
+                DEBUG, "Agreed upon {!r} pubkey algorithm".format(pubkey_algo)
+            )
+            return pubkey_algo
+        # Normal attempts to handshake follow from here.
+        # Only consider RSA algos from our list, lest we agree on another!
+        my_algos = [x for x in self.transport.preferred_pubkeys if "rsa" in x]
+        self._log(DEBUG, "Our pubkey algorithm list: {}".format(my_algos))
+        # Short-circuit negatively if user disabled all RSA algos (heh)
+        if not my_algos:
+            raise SSHException(
+                "An RSA key was specified, but no RSA pubkey algorithms are configured!"  # noqa
+            )
+        # Check for server-sig-algs if supported & sent
+        server_algo_str = u(
+            self.transport.server_extensions.get("server-sig-algs", b(""))
+        )
+        pubkey_algo = None
+        # Prefer to match against server-sig-algs
+        if server_algo_str:
+            server_algos = server_algo_str.split(",")
+            self._log(
+                DEBUG, "Server-side algorithm list: {}".format(server_algos)
+            )
+            # Only use algos from our list that the server likes, in our own
+            # preference order. (NOTE: purposefully using same style as in
+            # Transport...expect to refactor later)
+            agreement = list(filter(server_algos.__contains__, my_algos))
+            if agreement:
+                pubkey_algo = agreement[0]
+                self._log(
+                    DEBUG,
+                    "Agreed upon {!r} pubkey algorithm".format(pubkey_algo),
+                )
+            else:
+                self._log(DEBUG, "No common pubkey algorithms exist! Dying.")
+                # TODO: MAY want to use IncompatiblePeer again here but that's
+                # technically for initial key exchange, not pubkey auth.
+                err = "Unable to agree on a pubkey algorithm for signing a {!r} key!"  # noqa
+                raise AuthenticationException(err.format(key_type))
+        # Fallback to something based purely on the key & our configuration
+        else:
+            pubkey_algo = self._choose_fallback_pubkey_algorithm(
+                key_type, my_algos
+            )
+        if key_type.endswith("-cert-v01@openssh.com"):
+            pubkey_algo += "-cert-v01@openssh.com"
+        self.transport._agreed_pubkey_algorithm = pubkey_algo
+        return pubkey_algo
+
+    def _parse_service_accept(self, m):
+        service = m.get_text()
+        if service == "ssh-userauth":
+            self._log(DEBUG, "userauth is OK")
+            m = Message()
+            m.add_byte(cMSG_USERAUTH_REQUEST)
+            m.add_string(self.username)
+            m.add_string("ssh-connection")
+            m.add_string(self.auth_method)
+            if self.auth_method == "password":
+                m.add_boolean(False)
+                password = b(self.password)
+                m.add_string(password)
+            elif self.auth_method == "publickey":
+                m.add_boolean(True)
+                key_type, bits = self._get_key_type_and_bits(self.private_key)
+                algorithm = self._finalize_pubkey_algorithm(key_type)
+                m.add_string(algorithm)
+                m.add_string(bits)
+                blob = self._get_session_blob(
+                    self.private_key,
+                    "ssh-connection",
+                    self.username,
+                    algorithm,
+                )
+                sig = self.private_key.sign_ssh_data(blob, algorithm)
+                m.add_string(sig)
+            elif self.auth_method == "keyboard-interactive":
+                m.add_string("")
+                m.add_string(self.submethods)
+            elif self.auth_method == "gssapi-with-mic":
+                sshgss = GSSAuth(self.auth_method, self.gss_deleg_creds)
+                m.add_bytes(sshgss.ssh_gss_oids())
+                # send the supported GSSAPI OIDs to the server
+                self.transport._send_message(m)
+                ptype, m = self.transport.packetizer.read_message()
+                if ptype == MSG_USERAUTH_BANNER:
+                    self._parse_userauth_banner(m)
+                    ptype, m = self.transport.packetizer.read_message()
+                if ptype == MSG_USERAUTH_GSSAPI_RESPONSE:
+                    # Read the mechanism selected by the server. We send just
+                    # the Kerberos V5 OID, so the server can only respond with
+                    # this OID.
+                    mech = m.get_string()
+                    m = Message()
+                    m.add_byte(cMSG_USERAUTH_GSSAPI_TOKEN)
+                    try:
+                        m.add_string(
+                            sshgss.ssh_init_sec_context(
+                                self.gss_host, mech, self.username
+                            )
+                        )
+                    except GSS_EXCEPTIONS as e:
+                        return self._handle_local_gss_failure(e)
+                    self.transport._send_message(m)
+                    while True:
+                        ptype, m = self.transport.packetizer.read_message()
+                        if ptype == MSG_USERAUTH_GSSAPI_TOKEN:
+                            srv_token = m.get_string()
+                            try:
+                                next_token = sshgss.ssh_init_sec_context(
+                                    self.gss_host,
+                                    mech,
+                                    self.username,
+                                    srv_token,
+                                )
+                            except GSS_EXCEPTIONS as e:
+                                return self._handle_local_gss_failure(e)
+                            # After this step the GSSAPI should not return any
+                            # token. If it does, we keep sending the token to
+                            # the server until no more token is returned.
+                            if next_token is None:
+                                break
+                            else:
+                                m = Message()
+                                m.add_byte(cMSG_USERAUTH_GSSAPI_TOKEN)
+                                m.add_string(next_token)
+                                self.transport.send_message(m)
+                    else:
+                        raise SSHException(
+                            "Received Package: {}".format(MSG_NAMES[ptype])
+                        )
+                    m = Message()
+                    m.add_byte(cMSG_USERAUTH_GSSAPI_MIC)
+                    # send the MIC to the server
+                    m.add_string(sshgss.ssh_get_mic(self.transport.session_id))
+                elif ptype == MSG_USERAUTH_GSSAPI_ERRTOK:
+                    # RFC 4462 says we are not required to implement GSS-API
+                    # error messages.
+                    # See RFC 4462 Section 3.8 in
+                    # http://www.ietf.org/rfc/rfc4462.txt
+                    raise SSHException("Server returned an error token")
+                elif ptype == MSG_USERAUTH_GSSAPI_ERROR:
+                    maj_status = m.get_int()
+                    min_status = m.get_int()
+                    err_msg = m.get_string()
+                    m.get_string()  # Lang tag - discarded
+                    raise SSHException(
+                        """GSS-API Error:
+Major Status: {}
+Minor Status: {}
+Error Message: {}
+""".format(
+                            maj_status, min_status, err_msg
+                        )
+                    )
+                elif ptype == MSG_USERAUTH_FAILURE:
+                    self._parse_userauth_failure(m)
+                    return
+                else:
+                    raise SSHException(
+                        "Received Package: {}".format(MSG_NAMES[ptype])
+                    )
+            elif (
+                self.auth_method == "gssapi-keyex"
+                and self.transport.gss_kex_used
+            ):
+                kexgss = self.transport.kexgss_ctxt
+                kexgss.set_username(self.username)
+                mic_token = kexgss.ssh_get_mic(self.transport.session_id)
+                m.add_string(mic_token)
+            elif self.auth_method == "none":
+                pass
+            else:
+                raise SSHException(
+                    'Unknown auth method "{}"'.format(self.auth_method)
+                )
+            self.transport._send_message(m)
+        else:
+            self._log(
+                DEBUG, 'Service request "{}" accepted (?)'.format(service)
+            )
+
+    def _send_auth_result(self, username, method, result):
+        # okay, send result
+        m = Message()
+        if result == AUTH_SUCCESSFUL:
+            self._log(INFO, "Auth granted ({}).".format(method))
+            m.add_byte(cMSG_USERAUTH_SUCCESS)
+            self.authenticated = True
+        else:
+            self._log(INFO, "Auth rejected ({}).".format(method))
+            m.add_byte(cMSG_USERAUTH_FAILURE)
+            m.add_string(
+                self.transport.server_object.get_allowed_auths(username)
+            )
+            if result == AUTH_PARTIALLY_SUCCESSFUL:
+                m.add_boolean(True)
+            else:
+                m.add_boolean(False)
+                self.auth_fail_count += 1
+        self.transport._send_message(m)
+        if self.auth_fail_count >= 10:
+            self._disconnect_no_more_auth()
+        if result == AUTH_SUCCESSFUL:
+            self.transport._auth_trigger()
+
+    def _interactive_query(self, q):
+        # make interactive query instead of response
+        m = Message()
+        m.add_byte(cMSG_USERAUTH_INFO_REQUEST)
+        m.add_string(q.name)
+        m.add_string(q.instructions)
+        m.add_string(bytes())
+        m.add_int(len(q.prompts))
+        for p in q.prompts:
+            m.add_string(p[0])
+            m.add_boolean(p[1])
+        self.transport._send_message(m)
+
+    def _parse_userauth_request(self, m):
+        if not self.transport.server_mode:
+            # er, uh... what?
+            m = Message()
+            m.add_byte(cMSG_USERAUTH_FAILURE)
+            m.add_string("none")
+            m.add_boolean(False)
+            self.transport._send_message(m)
+            return
+        if self.authenticated:
+            # ignore
+            return
+        username = m.get_text()
+        service = m.get_text()
+        method = m.get_text()
+        self._log(
+            DEBUG,
+            "Auth request (type={}) service={}, username={}".format(
+                method, service, username
+            ),
+        )
+        if service != "ssh-connection":
+            self._disconnect_service_not_available()
+            return
+        if (self.auth_username is not None) and (
+            self.auth_username != username
+        ):
+            self._log(
+                WARNING,
+                "Auth rejected because the client attempted to change username in mid-flight",  # noqa
+            )
+            self._disconnect_no_more_auth()
+            return
+        self.auth_username = username
+        # check if GSS-API authentication is enabled
+        gss_auth = self.transport.server_object.enable_auth_gssapi()
+
+        if method == "none":
+            result = self.transport.server_object.check_auth_none(username)
+        elif method == "password":
+            changereq = m.get_boolean()
+            password = m.get_binary()
+            try:
+                password = password.decode("UTF-8")
+            except UnicodeError:
+                # some clients/servers expect non-utf-8 passwords!
+                # in this case, just return the raw byte string.
+                pass
+            if changereq:
+                # always treated as failure, since we don't support changing
+                # passwords, but collect the list of valid auth types from
+                # the callback anyway
+                self._log(DEBUG, "Auth request to change passwords (rejected)")
+                newpassword = m.get_binary()
+                try:
+                    newpassword = newpassword.decode("UTF-8", "replace")
+                except UnicodeError:
+                    pass
+                result = AUTH_FAILED
+            else:
+                result = self.transport.server_object.check_auth_password(
+                    username, password
+                )
+        elif method == "publickey":
+            sig_attached = m.get_boolean()
+            # NOTE: server never wants to guess a client's algo, they're
+            # telling us directly. No need for _finalize_pubkey_algorithm
+            # anywhere in this flow.
+            algorithm = m.get_text()
+            keyblob = m.get_binary()
+            try:
+                key = self._generate_key_from_request(algorithm, keyblob)
+            except SSHException as e:
+                self._log(INFO, "Auth rejected: public key: {}".format(str(e)))
+                key = None
+            except Exception as e:
+                msg = "Auth rejected: unsupported or mangled public key ({}: {})"  # noqa
+                self._log(INFO, msg.format(e.__class__.__name__, e))
+                key = None
+            if key is None:
+                self._disconnect_no_more_auth()
+                return
+            # first check if this key is okay... if not, we can skip the verify
+            result = self.transport.server_object.check_auth_publickey(
+                username, key
+            )
+            if result != AUTH_FAILED:
+                # key is okay, verify it
+                if not sig_attached:
+                    # client wants to know if this key is acceptable, before it
+                    # signs anything...  send special "ok" message
+                    m = Message()
+                    m.add_byte(cMSG_USERAUTH_PK_OK)
+                    m.add_string(algorithm)
+                    m.add_string(keyblob)
+                    self.transport._send_message(m)
+                    return
+                sig = Message(m.get_binary())
+                blob = self._get_session_blob(
+                    key, service, username, algorithm
+                )
+                if not key.verify_ssh_sig(blob, sig):
+                    self._log(INFO, "Auth rejected: invalid signature")
+                    result = AUTH_FAILED
+        elif method == "keyboard-interactive":
+            submethods = m.get_string()
+            result = self.transport.server_object.check_auth_interactive(
+                username, submethods
+            )
+            if isinstance(result, InteractiveQuery):
+                # make interactive query instead of response
+                self._interactive_query(result)
+                return
+        elif method == "gssapi-with-mic" and gss_auth:
+            sshgss = GSSAuth(method)
+            # Read the number of OID mechanisms supported by the client.
+            # OpenSSH sends just one OID. It's the Kerveros V5 OID and that's
+            # the only OID we support.
+            mechs = m.get_int()
+            # We can't accept more than one OID, so if the SSH client sends
+            # more than one, disconnect.
+            if mechs > 1:
+                self._log(
+                    INFO,
+                    "Disconnect: Received more than one GSS-API OID mechanism",
+                )
+                self._disconnect_no_more_auth()
+            desired_mech = m.get_string()
+            mech_ok = sshgss.ssh_check_mech(desired_mech)
+            # if we don't support the mechanism, disconnect.
+            if not mech_ok:
+                self._log(
+                    INFO,
+                    "Disconnect: Received an invalid GSS-API OID mechanism",
+                )
+                self._disconnect_no_more_auth()
+            # send the Kerberos V5 GSSAPI OID to the client
+            supported_mech = sshgss.ssh_gss_oids("server")
+            # RFC 4462 says we are not required to implement GSS-API error
+            # messages. See section 3.8 in http://www.ietf.org/rfc/rfc4462.txt
+            m = Message()
+            m.add_byte(cMSG_USERAUTH_GSSAPI_RESPONSE)
+            m.add_bytes(supported_mech)
+            self.transport.auth_handler = GssapiWithMicAuthHandler(
+                self, sshgss
+            )
+            self.transport._expected_packet = (
+                MSG_USERAUTH_GSSAPI_TOKEN,
+                MSG_USERAUTH_REQUEST,
+                MSG_SERVICE_REQUEST,
+            )
+            self.transport._send_message(m)
+            return
+        elif method == "gssapi-keyex" and gss_auth:
+            mic_token = m.get_string()
+            sshgss = self.transport.kexgss_ctxt
+            if sshgss is None:
+                # If there is no valid context, we reject the authentication
+                result = AUTH_FAILED
+                self._send_auth_result(username, method, result)
+            try:
+                sshgss.ssh_check_mic(
+                    mic_token, self.transport.session_id, self.auth_username
+                )
+            except Exception:
+                result = AUTH_FAILED
+                self._send_auth_result(username, method, result)
+                raise
+            result = AUTH_SUCCESSFUL
+            self.transport.server_object.check_auth_gssapi_keyex(
+                username, result
+            )
+        else:
+            result = self.transport.server_object.check_auth_none(username)
+        # okay, send result
+        self._send_auth_result(username, method, result)
+
+    def _parse_userauth_success(self, m):
+        self._log(
+            INFO, "Authentication ({}) successful!".format(self.auth_method)
+        )
+        self.authenticated = True
+        self.transport._auth_trigger()
+        if self.auth_event is not None:
+            self.auth_event.set()
+
+    def _parse_userauth_failure(self, m):
+        authlist = m.get_list()
+        # TODO 4.0: we aren't giving callers access to authlist _unless_ it's
+        # partial authentication, so eg authtype=none can't work unless we
+        # tweak this.
+        partial = m.get_boolean()
+        if partial:
+            self._log(INFO, "Authentication continues...")
+            self._log(DEBUG, "Methods: " + str(authlist))
+            self.transport.saved_exception = PartialAuthentication(authlist)
+        elif self.auth_method not in authlist:
+            for msg in (
+                "Authentication type ({}) not permitted.".format(
+                    self.auth_method
+                ),
+                "Allowed methods: {}".format(authlist),
+            ):
+                self._log(DEBUG, msg)
+            self.transport.saved_exception = BadAuthenticationType(
+                "Bad authentication type", authlist
+            )
+        else:
+            self._log(
+                INFO, "Authentication ({}) failed.".format(self.auth_method)
+            )
+        self.authenticated = False
+        self.username = None
+        if self.auth_event is not None:
+            self.auth_event.set()
+
+    def _parse_userauth_banner(self, m):
+        banner = m.get_string()
+        self.banner = banner
+        self._log(INFO, "Auth banner: {}".format(banner))
+        # who cares.
+
+    def _parse_userauth_info_request(self, m):
+        if self.auth_method != "keyboard-interactive":
+            raise SSHException("Illegal info request from server")
+        title = m.get_text()
+        instructions = m.get_text()
+        m.get_binary()  # lang
+        prompts = m.get_int()
+        prompt_list = []
+        for i in range(prompts):
+            prompt_list.append((m.get_text(), m.get_boolean()))
+        response_list = self.interactive_handler(
+            title, instructions, prompt_list
+        )
+
+        m = Message()
+        m.add_byte(cMSG_USERAUTH_INFO_RESPONSE)
+        m.add_int(len(response_list))
+        for r in response_list:
+            m.add_string(r)
+        self.transport._send_message(m)
+
+    def _parse_userauth_info_response(self, m):
+        if not self.transport.server_mode:
+            raise SSHException("Illegal info response from server")
+        n = m.get_int()
+        responses = []
+        for i in range(n):
+            responses.append(m.get_text())
+        result = self.transport.server_object.check_auth_interactive_response(
+            responses
+        )
+        if isinstance(result, InteractiveQuery):
+            # make interactive query instead of response
+            self._interactive_query(result)
+            return
+        self._send_auth_result(
+            self.auth_username, "keyboard-interactive", result
+        )
+
+    def _handle_local_gss_failure(self, e):
+        self.transport.saved_exception = e
+        self._log(DEBUG, "GSSAPI failure: {}".format(e))
+        self._log(INFO, "Authentication ({}) failed.".format(self.auth_method))
+        self.authenticated = False
+        self.username = None
+        if self.auth_event is not None:
+            self.auth_event.set()
+        return
+
+    # TODO 4.0: MAY make sense to make these tables into actual
+    # classes/instances that can be fed a mode bool or whatever. Or,
+    # alternately (both?) make the message types small classes or enums that
+    # embed this info within themselves (which could also then tidy up the
+    # current 'integer -> human readable short string' stuff in common.py).
+    # TODO: if we do that, also expose 'em publicly.
+
+    # Messages which should be handled _by_ servers (sent by clients)
+    @property
+    def _server_handler_table(self):
+        return {
+            # TODO 4.0: MSG_SERVICE_REQUEST ought to eventually move into
+            # Transport's server mode like the client side did, just for
+            # consistency.
+            MSG_SERVICE_REQUEST: self._parse_service_request,
+            MSG_USERAUTH_REQUEST: self._parse_userauth_request,
+            MSG_USERAUTH_INFO_RESPONSE: self._parse_userauth_info_response,
+        }
+
+    # Messages which should be handled _by_ clients (sent by servers)
+    @property
+    def _client_handler_table(self):
+        return {
+            MSG_SERVICE_ACCEPT: self._parse_service_accept,
+            MSG_USERAUTH_SUCCESS: self._parse_userauth_success,
+            MSG_USERAUTH_FAILURE: self._parse_userauth_failure,
+            MSG_USERAUTH_BANNER: self._parse_userauth_banner,
+            MSG_USERAUTH_INFO_REQUEST: self._parse_userauth_info_request,
+        }
+
+    # NOTE: prior to the fix for #1283, this was a static dict instead of a
+    # property. Should be backwards compatible in most/all cases.
+    @property
+    def _handler_table(self):
+        if self.transport.server_mode:
+            return self._server_handler_table
+        else:
+            return self._client_handler_table
+
+
+class GssapiWithMicAuthHandler:
+    """A specialized Auth handler for gssapi-with-mic
+
+    During the GSSAPI token exchange we need a modified dispatch table,
+    because the packet type numbers are not unique.
+    """
+
+    method = "gssapi-with-mic"
+
+    def __init__(self, delegate, sshgss):
+        self._delegate = delegate
+        self.sshgss = sshgss
+
+    def abort(self):
+        self._restore_delegate_auth_handler()
+        return self._delegate.abort()
+
+    @property
+    def transport(self):
+        return self._delegate.transport
+
+    @property
+    def _send_auth_result(self):
+        return self._delegate._send_auth_result
+
+    @property
+    def auth_username(self):
+        return self._delegate.auth_username
+
+    @property
+    def gss_host(self):
+        return self._delegate.gss_host
+
+    def _restore_delegate_auth_handler(self):
+        self.transport.auth_handler = self._delegate
+
+    def _parse_userauth_gssapi_token(self, m):
+        client_token = m.get_string()
+        # use the client token as input to establish a secure
+        # context.
+        sshgss = self.sshgss
+        try:
+            token = sshgss.ssh_accept_sec_context(
+                self.gss_host, client_token, self.auth_username
+            )
+        except Exception as e:
+            self.transport.saved_exception = e
+            result = AUTH_FAILED
+            self._restore_delegate_auth_handler()
+            self._send_auth_result(self.auth_username, self.method, result)
+            raise
+        if token is not None:
+            m = Message()
+            m.add_byte(cMSG_USERAUTH_GSSAPI_TOKEN)
+            m.add_string(token)
+            self.transport._expected_packet = (
+                MSG_USERAUTH_GSSAPI_TOKEN,
+                MSG_USERAUTH_GSSAPI_MIC,
+                MSG_USERAUTH_REQUEST,
+            )
+            self.transport._send_message(m)
+
+    def _parse_userauth_gssapi_mic(self, m):
+        mic_token = m.get_string()
+        sshgss = self.sshgss
+        username = self.auth_username
+        self._restore_delegate_auth_handler()
+        try:
+            sshgss.ssh_check_mic(
+                mic_token, self.transport.session_id, username
+            )
+        except Exception as e:
+            self.transport.saved_exception = e
+            result = AUTH_FAILED
+            self._send_auth_result(username, self.method, result)
+            raise
+        # TODO: Implement client credential saving.
+        # The OpenSSH server is able to create a TGT with the delegated
+        # client credentials, but this is not supported by GSS-API.
+        result = AUTH_SUCCESSFUL
+        self.transport.server_object.check_auth_gssapi_with_mic(
+            username, result
+        )
+        # okay, send result
+        self._send_auth_result(username, self.method, result)
+
+    def _parse_service_request(self, m):
+        self._restore_delegate_auth_handler()
+        return self._delegate._parse_service_request(m)
+
+    def _parse_userauth_request(self, m):
+        self._restore_delegate_auth_handler()
+        return self._delegate._parse_userauth_request(m)
+
+    __handler_table = {
+        MSG_SERVICE_REQUEST: _parse_service_request,
+        MSG_USERAUTH_REQUEST: _parse_userauth_request,
+        MSG_USERAUTH_GSSAPI_TOKEN: _parse_userauth_gssapi_token,
+        MSG_USERAUTH_GSSAPI_MIC: _parse_userauth_gssapi_mic,
+    }
+
+    @property
+    def _handler_table(self):
+        # TODO: determine if we can cut this up like we did for the primary
+        # AuthHandler class.
+        return self.__handler_table
+
+
+class AuthOnlyHandler(AuthHandler):
+    """
+    AuthHandler, and just auth, no service requests!
+
+    .. versionadded:: 3.2
+    """
+
+    # NOTE: this purposefully duplicates some of the parent class in order to
+    # modernize, refactor, etc. The intent is that eventually we will collapse
+    # this one onto the parent in a backwards incompatible release.
+
+    @property
+    def _client_handler_table(self):
+        my_table = super()._client_handler_table.copy()
+        del my_table[MSG_SERVICE_ACCEPT]
+        return my_table
+
+    def send_auth_request(self, username, method, finish_message=None):
+        """
+        Submit a userauth request message & wait for response.
+
+        Performs the transport message send call, sets self.auth_event, and
+        will lock-n-block as necessary to both send, and wait for response to,
+        the USERAUTH_REQUEST.
+
+        Most callers will want to supply a callback to ``finish_message``,
+        which accepts a Message ``m`` and may call mutator methods on it to add
+        more fields.
+        """
+        # Store a few things for reference in handlers, including auth failure
+        # handler (which needs to know if we were using a bad method, etc)
+        self.auth_method = method
+        self.username = username
+        # Generic userauth request fields
+        m = Message()
+        m.add_byte(cMSG_USERAUTH_REQUEST)
+        m.add_string(username)
+        m.add_string("ssh-connection")
+        m.add_string(method)
+        # Caller usually has more to say, such as injecting password, key etc
+        finish_message(m)
+        # TODO 4.0: seems odd to have the client handle the lock and not
+        # Transport; that _may_ have been an artifact of allowing user
+        # threading event injection? Regardless, we don't want to move _this_
+        # locking into Transport._send_message now, because lots of other
+        # untouched code also uses that method and we might end up
+        # double-locking (?) but 4.0 would be a good time to revisit.
+        with self.transport.lock:
+            self.transport._send_message(m)
+        # We have cut out the higher level event args, but self.auth_event is
+        # still required for self.wait_for_response to function correctly (it's
+        # the mechanism used by the auth success/failure handlers, the abort
+        # handler, and a few other spots like in gssapi.
+        # TODO: interestingly, wait_for_response itself doesn't actually
+        # enforce that its event argument and self.auth_event are the same...
+        self.auth_event = threading.Event()
+        return self.wait_for_response(self.auth_event)
+
+    def auth_none(self, username):
+        return self.send_auth_request(username, "none")
+
+    def auth_publickey(self, username, key):
+        key_type, bits = self._get_key_type_and_bits(key)
+        algorithm = self._finalize_pubkey_algorithm(key_type)
+        blob = self._get_session_blob(
+            key,
+            "ssh-connection",
+            username,
+            algorithm,
+        )
+
+        def finish(m):
+            # This field doesn't appear to be named, but is False when querying
+            # for permission (ie knowing whether to even prompt a user for
+            # passphrase, etc) or True when just going for it. Paramiko has
+            # never bothered with the former type of message, apparently.
+            m.add_boolean(True)
+            m.add_string(algorithm)
+            m.add_string(bits)
+            m.add_string(key.sign_ssh_data(blob, algorithm))
+
+        return self.send_auth_request(username, "publickey", finish)
+
+    def auth_password(self, username, password):
+        def finish(m):
+            # Unnamed field that equates to "I am changing my password", which
+            # Paramiko clientside never supported and serverside only sort of
+            # supported.
+            m.add_boolean(False)
+            m.add_string(b(password))
+
+        return self.send_auth_request(username, "password", finish)
+
+    def auth_interactive(self, username, handler, submethods=""):
+        """
+        response_list = handler(title, instructions, prompt_list)
+        """
+        # Unlike most siblings, this auth method _does_ require other
+        # superclass handlers (eg userauth info request) to understand
+        # what's going on, so we still set some self attributes.
+        self.auth_method = "keyboard_interactive"
+        self.interactive_handler = handler
+
+        def finish(m):
+            # Empty string for deprecated language tag field, per RFC 4256:
+            # https://www.rfc-editor.org/rfc/rfc4256#section-3.1
+            m.add_string("")
+            m.add_string(submethods)
+
+        return self.send_auth_request(username, "keyboard-interactive", finish)
+
+    # NOTE: not strictly 'auth only' related, but allows users to opt-in.
+    def _choose_fallback_pubkey_algorithm(self, key_type, my_algos):
+        msg = "Server did not send a server-sig-algs list; defaulting to something in our preferred algorithms list"  # noqa
+        self._log(DEBUG, msg)
+        noncert_key_type = key_type.replace("-cert-v01@openssh.com", "")
+        if key_type in my_algos or noncert_key_type in my_algos:
+            actual = key_type if key_type in my_algos else noncert_key_type
+            msg = f"Current key type, {actual!r}, is in our preferred list; using that"  # noqa
+            algo = actual
+        else:
+            algo = my_algos[0]
+            msg = f"{key_type!r} not in our list - trying first list item instead, {algo!r}"  # noqa
+        self._log(DEBUG, msg)
+        return algo
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_strategy.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_strategy.py
new file mode 100644
index 0000000000000000000000000000000000000000..03c1d87749f2fba8e270f91ce1512f23e373ba93
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/auth_strategy.py
@@ -0,0 +1,306 @@
+"""
+Modern, adaptable authentication machinery.
+
+Replaces certain parts of `.SSHClient`. For a concrete implementation, see the
+``OpenSSHAuthStrategy`` class in `Fabric <https://fabfile.org>`_.
+"""
+
+from collections import namedtuple
+
+from .agent import AgentKey
+from .util import get_logger
+from .ssh_exception import AuthenticationException
+
+
+class AuthSource:
+    """
+    Some SSH authentication source, such as a password, private key, or agent.
+
+    See subclasses in this module for concrete implementations.
+
+    All implementations must accept at least a ``username`` (``str``) kwarg.
+    """
+
+    def __init__(self, username):
+        self.username = username
+
+    def _repr(self, **kwargs):
+        # TODO: are there any good libs for this? maybe some helper from
+        # structlog?
+        pairs = [f"{k}={v!r}" for k, v in kwargs.items()]
+        joined = ", ".join(pairs)
+        return f"{self.__class__.__name__}({joined})"
+
+    def __repr__(self):
+        return self._repr()
+
+    def authenticate(self, transport):
+        """
+        Perform authentication.
+        """
+        raise NotImplementedError
+
+
+class NoneAuth(AuthSource):
+    """
+    Auth type "none", ie https://www.rfc-editor.org/rfc/rfc4252#section-5.2 .
+    """
+
+    def authenticate(self, transport):
+        return transport.auth_none(self.username)
+
+
+class Password(AuthSource):
+    """
+    Password authentication.
+
+    :param callable password_getter:
+        A lazy callable that should return a `str` password value at
+        authentication time, such as a `functools.partial` wrapping
+        `getpass.getpass`, an API call to a secrets store, or similar.
+
+        If you already know the password at instantiation time, you should
+        simply use something like ``lambda: "my literal"`` (for a literal, but
+        also, shame on you!) or ``lambda: variable_name`` (for something stored
+        in a variable).
+    """
+
+    def __init__(self, username, password_getter):
+        super().__init__(username=username)
+        self.password_getter = password_getter
+
+    def __repr__(self):
+        # Password auth is marginally more 'username-caring' than pkeys, so may
+        # as well log that info here.
+        return super()._repr(user=self.username)
+
+    def authenticate(self, transport):
+        # Lazily get the password, in case it's prompting a user
+        # TODO: be nice to log source _of_ the password?
+        password = self.password_getter()
+        return transport.auth_password(self.username, password)
+
+
+# TODO 4.0: twiddle this, or PKey, or both, so they're more obviously distinct.
+# TODO 4.0: the obvious is to make this more wordy (PrivateKeyAuth), the
+# minimalist approach might be to rename PKey to just Key (esp given all the
+# subclasses are WhateverKey and not WhateverPKey)
+class PrivateKey(AuthSource):
+    """
+    Essentially a mixin for private keys.
+
+    Knows how to auth, but leaves key material discovery/loading/decryption to
+    subclasses.
+
+    Subclasses **must** ensure that they've set ``self.pkey`` to a decrypted
+    `.PKey` instance before calling ``super().authenticate``; typically
+    either in their ``__init__``, or in an overridden ``authenticate`` prior to
+    its `super` call.
+    """
+
+    def authenticate(self, transport):
+        return transport.auth_publickey(self.username, self.pkey)
+
+
+class InMemoryPrivateKey(PrivateKey):
+    """
+    An in-memory, decrypted `.PKey` object.
+    """
+
+    def __init__(self, username, pkey):
+        super().__init__(username=username)
+        # No decryption (presumably) necessary!
+        self.pkey = pkey
+
+    def __repr__(self):
+        # NOTE: most of interesting repr-bits for private keys is in PKey.
+        # TODO: tacking on agent-ness like this is a bit awkward, but, eh?
+        rep = super()._repr(pkey=self.pkey)
+        if isinstance(self.pkey, AgentKey):
+            rep += " [agent]"
+        return rep
+
+
+class OnDiskPrivateKey(PrivateKey):
+    """
+    Some on-disk private key that needs opening and possibly decrypting.
+
+    :param str source:
+        String tracking where this key's path was specified; should be one of
+        ``"ssh-config"``, ``"python-config"``, or ``"implicit-home"``.
+    :param Path path:
+        The filesystem path this key was loaded from.
+    :param PKey pkey:
+        The `PKey` object this auth source uses/represents.
+    """
+
+    def __init__(self, username, source, path, pkey):
+        super().__init__(username=username)
+        self.source = source
+        allowed = ("ssh-config", "python-config", "implicit-home")
+        if source not in allowed:
+            raise ValueError(f"source argument must be one of: {allowed!r}")
+        self.path = path
+        # Superclass wants .pkey, other two are mostly for display/debugging.
+        self.pkey = pkey
+
+    def __repr__(self):
+        return self._repr(
+            key=self.pkey, source=self.source, path=str(self.path)
+        )
+
+
+# TODO re sources: is there anything in an OpenSSH config file that doesn't fit
+# into what Paramiko already had kwargs for?
+
+
+SourceResult = namedtuple("SourceResult", ["source", "result"])
+
+# TODO: tempting to make this an OrderedDict, except the keys essentially want
+# to be rich objects (AuthSources) which do not make for useful user indexing?
+# TODO: members being vanilla tuples is pretty old-school/expedient; they
+# "really" want to be something that's type friendlier (unless the tuple's 2nd
+# member being a Union of two types is "fine"?), which I assume means yet more
+# classes, eg an abstract SourceResult with concrete AuthSuccess and
+# AuthFailure children?
+# TODO: arguably we want __init__ typechecking of the members (or to leverage
+# mypy by classifying this literally as list-of-AuthSource?)
+class AuthResult(list):
+    """
+    Represents a partial or complete SSH authentication attempt.
+
+    This class conceptually extends `AuthStrategy` by pairing the former's
+    authentication **sources** with the **results** of trying to authenticate
+    with them.
+
+    `AuthResult` is a (subclass of) `list` of `namedtuple`, which are of the
+    form ``namedtuple('SourceResult', 'source', 'result')`` (where the
+    ``source`` member is an `AuthSource` and the ``result`` member is either a
+    return value from the relevant `.Transport` method, or an exception
+    object).
+
+    .. note::
+        Transport auth method results are always themselves a ``list`` of "next
+        allowable authentication methods".
+
+        In the simple case of "you just authenticated successfully", it's an
+        empty list; if your auth was rejected but you're allowed to try again,
+        it will be a list of string method names like ``pubkey`` or
+        ``password``.
+
+        The ``__str__`` of this class represents the empty-list scenario as the
+        word ``success``, which should make reading the result of an
+        authentication session more obvious to humans.
+
+    Instances also have a `strategy` attribute referencing the `AuthStrategy`
+    which was attempted.
+    """
+
+    def __init__(self, strategy, *args, **kwargs):
+        self.strategy = strategy
+        super().__init__(*args, **kwargs)
+
+    def __str__(self):
+        # NOTE: meaningfully distinct from __repr__, which still wants to use
+        # superclass' implementation.
+        # TODO: go hog wild, use rich.Table? how is that on degraded term's?
+        # TODO: test this lol
+        return "\n".join(
+            f"{x.source} -> {x.result or 'success'}" for x in self
+        )
+
+
+# TODO 4.0: descend from SSHException or even just Exception
+class AuthFailure(AuthenticationException):
+    """
+    Basic exception wrapping an `AuthResult` indicating overall auth failure.
+
+    Note that `AuthFailure` descends from `AuthenticationException` but is
+    generally "higher level"; the latter is now only raised by individual
+    `AuthSource` attempts and should typically only be seen by users when
+    encapsulated in this class. It subclasses `AuthenticationException`
+    primarily for backwards compatibility reasons.
+    """
+
+    def __init__(self, result):
+        self.result = result
+
+    def __str__(self):
+        return "\n" + str(self.result)
+
+
+class AuthStrategy:
+    """
+    This class represents one or more attempts to auth with an SSH server.
+
+    By default, subclasses must at least accept an ``ssh_config``
+    (`.SSHConfig`) keyword argument, but may opt to accept more as needed for
+    their particular strategy.
+    """
+
+    def __init__(
+        self,
+        ssh_config,
+    ):
+        self.ssh_config = ssh_config
+        self.log = get_logger(__name__)
+
+    def get_sources(self):
+        """
+        Generator yielding `AuthSource` instances, in the order to try.
+
+        This is the primary override point for subclasses: you figure out what
+        sources you need, and ``yield`` them.
+
+        Subclasses _of_ subclasses may find themselves wanting to do things
+        like filtering or discarding around a call to `super`.
+        """
+        raise NotImplementedError
+
+    def authenticate(self, transport):
+        """
+        Handles attempting `AuthSource` instances yielded from `get_sources`.
+
+        You *normally* won't need to override this, but it's an option for
+        advanced users.
+        """
+        succeeded = False
+        overall_result = AuthResult(strategy=self)
+        # TODO: arguably we could fit in a "send none auth, record allowed auth
+        # types sent back" thing here as OpenSSH-client does, but that likely
+        # wants to live in fabric.OpenSSHAuthStrategy as not all target servers
+        # will implement it!
+        # TODO: needs better "server told us too many attempts" checking!
+        for source in self.get_sources():
+            self.log.debug(f"Trying {source}")
+            try:  # NOTE: this really wants to _only_ wrap the authenticate()!
+                result = source.authenticate(transport)
+                succeeded = True
+            # TODO: 'except PartialAuthentication' is needed for 2FA and
+            # similar, as per old SSHClient.connect - it is the only way
+            # AuthHandler supplies access to the 'name-list' field from
+            # MSG_USERAUTH_FAILURE, at present.
+            except Exception as e:
+                result = e
+                # TODO: look at what this could possibly raise, we don't really
+                # want Exception here, right? just SSHException subclasses? or
+                # do we truly want to capture anything at all with assumption
+                # it's easy enough for users to look afterwards?
+                # NOTE: showing type, not message, for tersity & also most of
+                # the time it's basically just "Authentication failed."
+                source_class = e.__class__.__name__
+                self.log.info(
+                    f"Authentication via {source} failed with {source_class}"
+                )
+            overall_result.append(SourceResult(source, result))
+            if succeeded:
+                break
+        # Gotta die here if nothing worked, otherwise Transport's main loop
+        # just kinda hangs out until something times out!
+        if not succeeded:
+            raise AuthFailure(result=overall_result)
+        # Success: give back what was done, in case they care.
+        return overall_result
+
+    # TODO: is there anything OpenSSH client does which _can't_ cleanly map to
+    # iterating a generator?
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/ber.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/ber.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8287f5de3ef2e207d84cb9853a82134a25c0d29
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/ber.py
@@ -0,0 +1,139 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+from paramiko.common import max_byte, zero_byte, byte_ord, byte_chr
+
+import paramiko.util as util
+from paramiko.util import b
+from paramiko.sftp import int64
+
+
+class BERException(Exception):
+    pass
+
+
+class BER:
+    """
+    Robey's tiny little attempt at a BER decoder.
+    """
+
+    def __init__(self, content=bytes()):
+        self.content = b(content)
+        self.idx = 0
+
+    def asbytes(self):
+        return self.content
+
+    def __str__(self):
+        return self.asbytes()
+
+    def __repr__(self):
+        return "BER('" + repr(self.content) + "')"
+
+    def decode(self):
+        return self.decode_next()
+
+    def decode_next(self):
+        if self.idx >= len(self.content):
+            return None
+        ident = byte_ord(self.content[self.idx])
+        self.idx += 1
+        if (ident & 31) == 31:
+            # identifier > 30
+            ident = 0
+            while self.idx < len(self.content):
+                t = byte_ord(self.content[self.idx])
+                self.idx += 1
+                ident = (ident << 7) | (t & 0x7F)
+                if not (t & 0x80):
+                    break
+        if self.idx >= len(self.content):
+            return None
+        # now fetch length
+        size = byte_ord(self.content[self.idx])
+        self.idx += 1
+        if size & 0x80:
+            # more complimicated...
+            # FIXME: theoretically should handle indefinite-length (0x80)
+            t = size & 0x7F
+            if self.idx + t > len(self.content):
+                return None
+            size = util.inflate_long(
+                self.content[self.idx : self.idx + t], True
+            )
+            self.idx += t
+        if self.idx + size > len(self.content):
+            # can't fit
+            return None
+        data = self.content[self.idx : self.idx + size]
+        self.idx += size
+        # now switch on id
+        if ident == 0x30:
+            # sequence
+            return self.decode_sequence(data)
+        elif ident == 2:
+            # int
+            return util.inflate_long(data)
+        else:
+            # 1: boolean (00 false, otherwise true)
+            msg = "Unknown ber encoding type {:d} (robey is lazy)"
+            raise BERException(msg.format(ident))
+
+    @staticmethod
+    def decode_sequence(data):
+        out = []
+        ber = BER(data)
+        while True:
+            x = ber.decode_next()
+            if x is None:
+                break
+            out.append(x)
+        return out
+
+    def encode_tlv(self, ident, val):
+        # no need to support ident > 31 here
+        self.content += byte_chr(ident)
+        if len(val) > 0x7F:
+            lenstr = util.deflate_long(len(val))
+            self.content += byte_chr(0x80 + len(lenstr)) + lenstr
+        else:
+            self.content += byte_chr(len(val))
+        self.content += val
+
+    def encode(self, x):
+        if type(x) is bool:
+            if x:
+                self.encode_tlv(1, max_byte)
+            else:
+                self.encode_tlv(1, zero_byte)
+        elif (type(x) is int) or (type(x) is int64):
+            self.encode_tlv(2, util.deflate_long(x))
+        elif type(x) is str:
+            self.encode_tlv(4, x)
+        elif (type(x) is list) or (type(x) is tuple):
+            self.encode_tlv(0x30, self.encode_sequence(x))
+        else:
+            raise BERException(
+                "Unknown type for encoding: {!r}".format(type(x))
+            )
+
+    @staticmethod
+    def encode_sequence(data):
+        ber = BER()
+        for item in data:
+            ber.encode(item)
+        return ber.asbytes()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/buffered_pipe.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/buffered_pipe.py
new file mode 100644
index 0000000000000000000000000000000000000000..c19279c0236088f1ef109288e14cdeb82bccccb6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/buffered_pipe.py
@@ -0,0 +1,212 @@
+# Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Attempt to generalize the "feeder" part of a `.Channel`: an object which can be
+read from and closed, but is reading from a buffer fed by another thread.  The
+read operations are blocking and can have a timeout set.
+"""
+
+import array
+import threading
+import time
+from paramiko.util import b
+
+
+class PipeTimeout(IOError):
+    """
+    Indicates that a timeout was reached on a read from a `.BufferedPipe`.
+    """
+
+    pass
+
+
+class BufferedPipe:
+    """
+    A buffer that obeys normal read (with timeout) & close semantics for a
+    file or socket, but is fed data from another thread.  This is used by
+    `.Channel`.
+    """
+
+    def __init__(self):
+        self._lock = threading.Lock()
+        self._cv = threading.Condition(self._lock)
+        self._event = None
+        self._buffer = array.array("B")
+        self._closed = False
+
+    def _buffer_frombytes(self, data):
+        self._buffer.frombytes(data)
+
+    def _buffer_tobytes(self, limit=None):
+        return self._buffer[:limit].tobytes()
+
+    def set_event(self, event):
+        """
+        Set an event on this buffer.  When data is ready to be read (or the
+        buffer has been closed), the event will be set.  When no data is
+        ready, the event will be cleared.
+
+        :param threading.Event event: the event to set/clear
+        """
+        self._lock.acquire()
+        try:
+            self._event = event
+            # Make sure the event starts in `set` state if we appear to already
+            # be closed; otherwise, if we start in `clear` state & are closed,
+            # nothing will ever call `.feed` and the event (& OS pipe, if we're
+            # wrapping one - see `Channel.fileno`) will permanently stay in
+            # `clear`, causing deadlock if e.g. `select`ed upon.
+            if self._closed or len(self._buffer) > 0:
+                event.set()
+            else:
+                event.clear()
+        finally:
+            self._lock.release()
+
+    def feed(self, data):
+        """
+        Feed new data into this pipe.  This method is assumed to be called
+        from a separate thread, so synchronization is done.
+
+        :param data: the data to add, as a ``str`` or ``bytes``
+        """
+        self._lock.acquire()
+        try:
+            if self._event is not None:
+                self._event.set()
+            self._buffer_frombytes(b(data))
+            self._cv.notify_all()
+        finally:
+            self._lock.release()
+
+    def read_ready(self):
+        """
+        Returns true if data is buffered and ready to be read from this
+        feeder.  A ``False`` result does not mean that the feeder has closed;
+        it means you may need to wait before more data arrives.
+
+        :return:
+            ``True`` if a `read` call would immediately return at least one
+            byte; ``False`` otherwise.
+        """
+        self._lock.acquire()
+        try:
+            if len(self._buffer) == 0:
+                return False
+            return True
+        finally:
+            self._lock.release()
+
+    def read(self, nbytes, timeout=None):
+        """
+        Read data from the pipe.  The return value is a string representing
+        the data received.  The maximum amount of data to be received at once
+        is specified by ``nbytes``.  If a string of length zero is returned,
+        the pipe has been closed.
+
+        The optional ``timeout`` argument can be a nonnegative float expressing
+        seconds, or ``None`` for no timeout.  If a float is given, a
+        `.PipeTimeout` will be raised if the timeout period value has elapsed
+        before any data arrives.
+
+        :param int nbytes: maximum number of bytes to read
+        :param float timeout:
+            maximum seconds to wait (or ``None``, the default, to wait forever)
+        :return: the read data, as a ``str`` or ``bytes``
+
+        :raises:
+            `.PipeTimeout` -- if a timeout was specified and no data was ready
+            before that timeout
+        """
+        out = bytes()
+        self._lock.acquire()
+        try:
+            if len(self._buffer) == 0:
+                if self._closed:
+                    return out
+                # should we block?
+                if timeout == 0.0:
+                    raise PipeTimeout()
+                # loop here in case we get woken up but a different thread has
+                # grabbed everything in the buffer.
+                while (len(self._buffer) == 0) and not self._closed:
+                    then = time.time()
+                    self._cv.wait(timeout)
+                    if timeout is not None:
+                        timeout -= time.time() - then
+                        if timeout <= 0.0:
+                            raise PipeTimeout()
+
+            # something's in the buffer and we have the lock!
+            if len(self._buffer) <= nbytes:
+                out = self._buffer_tobytes()
+                del self._buffer[:]
+                if (self._event is not None) and not self._closed:
+                    self._event.clear()
+            else:
+                out = self._buffer_tobytes(nbytes)
+                del self._buffer[:nbytes]
+        finally:
+            self._lock.release()
+
+        return out
+
+    def empty(self):
+        """
+        Clear out the buffer and return all data that was in it.
+
+        :return:
+            any data that was in the buffer prior to clearing it out, as a
+            `str`
+        """
+        self._lock.acquire()
+        try:
+            out = self._buffer_tobytes()
+            del self._buffer[:]
+            if (self._event is not None) and not self._closed:
+                self._event.clear()
+            return out
+        finally:
+            self._lock.release()
+
+    def close(self):
+        """
+        Close this pipe object.  Future calls to `read` after the buffer
+        has been emptied will return immediately with an empty string.
+        """
+        self._lock.acquire()
+        try:
+            self._closed = True
+            self._cv.notify_all()
+            if self._event is not None:
+                self._event.set()
+        finally:
+            self._lock.release()
+
+    def __len__(self):
+        """
+        Return the number of bytes buffered.
+
+        :return: number (`int`) of bytes buffered
+        """
+        self._lock.acquire()
+        try:
+            return len(self._buffer)
+        finally:
+            self._lock.release()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/channel.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/channel.py
new file mode 100644
index 0000000000000000000000000000000000000000..2757450b768b79ce3261eaa1955915532c071fb1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/channel.py
@@ -0,0 +1,1390 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Abstraction for an SSH2 channel.
+"""
+
+import binascii
+import os
+import socket
+import time
+import threading
+
+from functools import wraps
+
+from paramiko import util
+from paramiko.common import (
+    cMSG_CHANNEL_REQUEST,
+    cMSG_CHANNEL_WINDOW_ADJUST,
+    cMSG_CHANNEL_DATA,
+    cMSG_CHANNEL_EXTENDED_DATA,
+    DEBUG,
+    ERROR,
+    cMSG_CHANNEL_SUCCESS,
+    cMSG_CHANNEL_FAILURE,
+    cMSG_CHANNEL_EOF,
+    cMSG_CHANNEL_CLOSE,
+)
+from paramiko.message import Message
+from paramiko.ssh_exception import SSHException
+from paramiko.file import BufferedFile
+from paramiko.buffered_pipe import BufferedPipe, PipeTimeout
+from paramiko import pipe
+from paramiko.util import ClosingContextManager
+
+
+def open_only(func):
+    """
+    Decorator for `.Channel` methods which performs an openness check.
+
+    :raises:
+        `.SSHException` -- If the wrapped method is called on an unopened
+        `.Channel`.
+    """
+
+    @wraps(func)
+    def _check(self, *args, **kwds):
+        if (
+            self.closed
+            or self.eof_received
+            or self.eof_sent
+            or not self.active
+        ):
+            raise SSHException("Channel is not open")
+        return func(self, *args, **kwds)
+
+    return _check
+
+
+class Channel(ClosingContextManager):
+    """
+    A secure tunnel across an SSH `.Transport`.  A Channel is meant to behave
+    like a socket, and has an API that should be indistinguishable from the
+    Python socket API.
+
+    Because SSH2 has a windowing kind of flow control, if you stop reading data
+    from a Channel and its buffer fills up, the server will be unable to send
+    you any more data until you read some of it.  (This won't affect other
+    channels on the same transport -- all channels on a single transport are
+    flow-controlled independently.)  Similarly, if the server isn't reading
+    data you send, calls to `send` may block, unless you set a timeout.  This
+    is exactly like a normal network socket, so it shouldn't be too surprising.
+
+    Instances of this class may be used as context managers.
+    """
+
+    def __init__(self, chanid):
+        """
+        Create a new channel.  The channel is not associated with any
+        particular session or `.Transport` until the Transport attaches it.
+        Normally you would only call this method from the constructor of a
+        subclass of `.Channel`.
+
+        :param int chanid:
+            the ID of this channel, as passed by an existing `.Transport`.
+        """
+        #: Channel ID
+        self.chanid = chanid
+        #: Remote channel ID
+        self.remote_chanid = 0
+        #: `.Transport` managing this channel
+        self.transport = None
+        #: Whether the connection is presently active
+        self.active = False
+        self.eof_received = 0
+        self.eof_sent = 0
+        self.in_buffer = BufferedPipe()
+        self.in_stderr_buffer = BufferedPipe()
+        self.timeout = None
+        #: Whether the connection has been closed
+        self.closed = False
+        self.ultra_debug = False
+        self.lock = threading.Lock()
+        self.out_buffer_cv = threading.Condition(self.lock)
+        self.in_window_size = 0
+        self.out_window_size = 0
+        self.in_max_packet_size = 0
+        self.out_max_packet_size = 0
+        self.in_window_threshold = 0
+        self.in_window_sofar = 0
+        self.status_event = threading.Event()
+        self._name = str(chanid)
+        self.logger = util.get_logger("paramiko.transport")
+        self._pipe = None
+        self.event = threading.Event()
+        self.event_ready = False
+        self.combine_stderr = False
+        self.exit_status = -1
+        self.origin_addr = None
+
+    def __del__(self):
+        try:
+            self.close()
+        except:
+            pass
+
+    def __repr__(self):
+        """
+        Return a string representation of this object, for debugging.
+        """
+        out = "<paramiko.Channel {}".format(self.chanid)
+        if self.closed:
+            out += " (closed)"
+        elif self.active:
+            if self.eof_received:
+                out += " (EOF received)"
+            if self.eof_sent:
+                out += " (EOF sent)"
+            out += " (open) window={}".format(self.out_window_size)
+            if len(self.in_buffer) > 0:
+                out += " in-buffer={}".format(len(self.in_buffer))
+        out += " -> " + repr(self.transport)
+        out += ">"
+        return out
+
+    @open_only
+    def get_pty(
+        self,
+        term="vt100",
+        width=80,
+        height=24,
+        width_pixels=0,
+        height_pixels=0,
+    ):
+        """
+        Request a pseudo-terminal from the server.  This is usually used right
+        after creating a client channel, to ask the server to provide some
+        basic terminal semantics for a shell invoked with `invoke_shell`.
+        It isn't necessary (or desirable) to call this method if you're going
+        to execute a single command with `exec_command`.
+
+        :param str term: the terminal type to emulate
+            (for example, ``'vt100'``)
+        :param int width: width (in characters) of the terminal screen
+        :param int height: height (in characters) of the terminal screen
+        :param int width_pixels: width (in pixels) of the terminal screen
+        :param int height_pixels: height (in pixels) of the terminal screen
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("pty-req")
+        m.add_boolean(True)
+        m.add_string(term)
+        m.add_int(width)
+        m.add_int(height)
+        m.add_int(width_pixels)
+        m.add_int(height_pixels)
+        m.add_string(bytes())
+        self._event_pending()
+        self.transport._send_user_message(m)
+        self._wait_for_event()
+
+    @open_only
+    def invoke_shell(self):
+        """
+        Request an interactive shell session on this channel.  If the server
+        allows it, the channel will then be directly connected to the stdin,
+        stdout, and stderr of the shell.
+
+        Normally you would call `get_pty` before this, in which case the
+        shell will operate through the pty, and the channel will be connected
+        to the stdin and stdout of the pty.
+
+        When the shell exits, the channel will be closed and can't be reused.
+        You must open a new channel if you wish to open another shell.
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("shell")
+        m.add_boolean(True)
+        self._event_pending()
+        self.transport._send_user_message(m)
+        self._wait_for_event()
+
+    @open_only
+    def exec_command(self, command):
+        """
+        Execute a command on the server.  If the server allows it, the channel
+        will then be directly connected to the stdin, stdout, and stderr of
+        the command being executed.
+
+        When the command finishes executing, the channel will be closed and
+        can't be reused.  You must open a new channel if you wish to execute
+        another command.
+
+        :param str command: a shell command to execute.
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("exec")
+        m.add_boolean(True)
+        m.add_string(command)
+        self._event_pending()
+        self.transport._send_user_message(m)
+        self._wait_for_event()
+
+    @open_only
+    def invoke_subsystem(self, subsystem):
+        """
+        Request a subsystem on the server (for example, ``sftp``).  If the
+        server allows it, the channel will then be directly connected to the
+        requested subsystem.
+
+        When the subsystem finishes, the channel will be closed and can't be
+        reused.
+
+        :param str subsystem: name of the subsystem being requested.
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("subsystem")
+        m.add_boolean(True)
+        m.add_string(subsystem)
+        self._event_pending()
+        self.transport._send_user_message(m)
+        self._wait_for_event()
+
+    @open_only
+    def resize_pty(self, width=80, height=24, width_pixels=0, height_pixels=0):
+        """
+        Resize the pseudo-terminal.  This can be used to change the width and
+        height of the terminal emulation created in a previous `get_pty` call.
+
+        :param int width: new width (in characters) of the terminal screen
+        :param int height: new height (in characters) of the terminal screen
+        :param int width_pixels: new width (in pixels) of the terminal screen
+        :param int height_pixels: new height (in pixels) of the terminal screen
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("window-change")
+        m.add_boolean(False)
+        m.add_int(width)
+        m.add_int(height)
+        m.add_int(width_pixels)
+        m.add_int(height_pixels)
+        self.transport._send_user_message(m)
+
+    @open_only
+    def update_environment(self, environment):
+        """
+        Updates this channel's remote shell environment.
+
+        .. note::
+            This operation is additive - i.e. the current environment is not
+            reset before the given environment variables are set.
+
+        .. warning::
+            Servers may silently reject some environment variables; see the
+            warning in `set_environment_variable` for details.
+
+        :param dict environment:
+            a dictionary containing the name and respective values to set
+        :raises:
+            `.SSHException` -- if any of the environment variables was rejected
+            by the server or the channel was closed
+        """
+        for name, value in environment.items():
+            try:
+                self.set_environment_variable(name, value)
+            except SSHException as e:
+                err = 'Failed to set environment variable "{}".'
+                raise SSHException(err.format(name), e)
+
+    @open_only
+    def set_environment_variable(self, name, value):
+        """
+        Set the value of an environment variable.
+
+        .. warning::
+            The server may reject this request depending on its ``AcceptEnv``
+            setting; such rejections will fail silently (which is common client
+            practice for this particular request type). Make sure you
+            understand your server's configuration before using!
+
+        :param str name: name of the environment variable
+        :param str value: value of the environment variable
+
+        :raises:
+            `.SSHException` -- if the request was rejected or the channel was
+            closed
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("env")
+        m.add_boolean(False)
+        m.add_string(name)
+        m.add_string(value)
+        self.transport._send_user_message(m)
+
+    def exit_status_ready(self):
+        """
+        Return true if the remote process has exited and returned an exit
+        status. You may use this to poll the process status if you don't
+        want to block in `recv_exit_status`. Note that the server may not
+        return an exit status in some cases (like bad servers).
+
+        :return:
+            ``True`` if `recv_exit_status` will return immediately, else
+            ``False``.
+
+        .. versionadded:: 1.7.3
+        """
+        return self.closed or self.status_event.is_set()
+
+    def recv_exit_status(self):
+        """
+        Return the exit status from the process on the server.  This is
+        mostly useful for retrieving the results of an `exec_command`.
+        If the command hasn't finished yet, this method will wait until
+        it does, or until the channel is closed.  If no exit status is
+        provided by the server, -1 is returned.
+
+        .. warning::
+            In some situations, receiving remote output larger than the current
+            `.Transport` or session's ``window_size`` (e.g. that set by the
+            ``default_window_size`` kwarg for `.Transport.__init__`) will cause
+            `.recv_exit_status` to hang indefinitely if it is called prior to a
+            sufficiently large `.Channel.recv` (or if there are no threads
+            calling `.Channel.recv` in the background).
+
+            In these cases, ensuring that `.recv_exit_status` is called *after*
+            `.Channel.recv` (or, again, using threads) can avoid the hang.
+
+        :return: the exit code (as an `int`) of the process on the server.
+
+        .. versionadded:: 1.2
+        """
+        self.status_event.wait()
+        assert self.status_event.is_set()
+        return self.exit_status
+
+    def send_exit_status(self, status):
+        """
+        Send the exit status of an executed command to the client.  (This
+        really only makes sense in server mode.)  Many clients expect to
+        get some sort of status code back from an executed command after
+        it completes.
+
+        :param int status: the exit code of the process
+
+        .. versionadded:: 1.2
+        """
+        # in many cases, the channel will not still be open here.
+        # that's fine.
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("exit-status")
+        m.add_boolean(False)
+        m.add_int(status)
+        self.transport._send_user_message(m)
+
+    @open_only
+    def request_x11(
+        self,
+        screen_number=0,
+        auth_protocol=None,
+        auth_cookie=None,
+        single_connection=False,
+        handler=None,
+    ):
+        """
+        Request an x11 session on this channel.  If the server allows it,
+        further x11 requests can be made from the server to the client,
+        when an x11 application is run in a shell session.
+
+        From :rfc:`4254`::
+
+            It is RECOMMENDED that the 'x11 authentication cookie' that is
+            sent be a fake, random cookie, and that the cookie be checked and
+            replaced by the real cookie when a connection request is received.
+
+        If you omit the auth_cookie, a new secure random 128-bit value will be
+        generated, used, and returned.  You will need to use this value to
+        verify incoming x11 requests and replace them with the actual local
+        x11 cookie (which requires some knowledge of the x11 protocol).
+
+        If a handler is passed in, the handler is called from another thread
+        whenever a new x11 connection arrives.  The default handler queues up
+        incoming x11 connections, which may be retrieved using
+        `.Transport.accept`.  The handler's calling signature is::
+
+            handler(channel: Channel, (address: str, port: int))
+
+        :param int screen_number: the x11 screen number (0, 10, etc.)
+        :param str auth_protocol:
+            the name of the X11 authentication method used; if none is given,
+            ``"MIT-MAGIC-COOKIE-1"`` is used
+        :param str auth_cookie:
+            hexadecimal string containing the x11 auth cookie; if none is
+            given, a secure random 128-bit value is generated
+        :param bool single_connection:
+            if True, only a single x11 connection will be forwarded (by
+            default, any number of x11 connections can arrive over this
+            session)
+        :param handler:
+            an optional callable handler to use for incoming X11 connections
+        :return: the auth_cookie used
+        """
+        if auth_protocol is None:
+            auth_protocol = "MIT-MAGIC-COOKIE-1"
+        if auth_cookie is None:
+            auth_cookie = binascii.hexlify(os.urandom(16))
+
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("x11-req")
+        m.add_boolean(True)
+        m.add_boolean(single_connection)
+        m.add_string(auth_protocol)
+        m.add_string(auth_cookie)
+        m.add_int(screen_number)
+        self._event_pending()
+        self.transport._send_user_message(m)
+        self._wait_for_event()
+        self.transport._set_x11_handler(handler)
+        return auth_cookie
+
+    @open_only
+    def request_forward_agent(self, handler):
+        """
+        Request for a forward SSH Agent on this channel.
+        This is only valid for an ssh-agent from OpenSSH !!!
+
+        :param handler:
+            a required callable handler to use for incoming SSH Agent
+            connections
+
+        :return: True if we are ok, else False
+            (at that time we always return ok)
+
+        :raises: SSHException in case of channel problem.
+        """
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_REQUEST)
+        m.add_int(self.remote_chanid)
+        m.add_string("auth-agent-req@openssh.com")
+        m.add_boolean(False)
+        self.transport._send_user_message(m)
+        self.transport._set_forward_agent_handler(handler)
+        return True
+
+    def get_transport(self):
+        """
+        Return the `.Transport` associated with this channel.
+        """
+        return self.transport
+
+    def set_name(self, name):
+        """
+        Set a name for this channel.  Currently it's only used to set the name
+        of the channel in logfile entries.  The name can be fetched with the
+        `get_name` method.
+
+        :param str name: new channel name
+        """
+        self._name = name
+
+    def get_name(self):
+        """
+        Get the name of this channel that was previously set by `set_name`.
+        """
+        return self._name
+
+    def get_id(self):
+        """
+        Return the `int` ID # for this channel.
+
+        The channel ID is unique across a `.Transport` and usually a small
+        number.  It's also the number passed to
+        `.ServerInterface.check_channel_request` when determining whether to
+        accept a channel request in server mode.
+        """
+        return self.chanid
+
+    def set_combine_stderr(self, combine):
+        """
+        Set whether stderr should be combined into stdout on this channel.
+        The default is ``False``, but in some cases it may be convenient to
+        have both streams combined.
+
+        If this is ``False``, and `exec_command` is called (or ``invoke_shell``
+        with no pty), output to stderr will not show up through the `recv`
+        and `recv_ready` calls.  You will have to use `recv_stderr` and
+        `recv_stderr_ready` to get stderr output.
+
+        If this is ``True``, data will never show up via `recv_stderr` or
+        `recv_stderr_ready`.
+
+        :param bool combine:
+            ``True`` if stderr output should be combined into stdout on this
+            channel.
+        :return: the previous setting (a `bool`).
+
+        .. versionadded:: 1.1
+        """
+        data = bytes()
+        self.lock.acquire()
+        try:
+            old = self.combine_stderr
+            self.combine_stderr = combine
+            if combine and not old:
+                # copy old stderr buffer into primary buffer
+                data = self.in_stderr_buffer.empty()
+        finally:
+            self.lock.release()
+        if len(data) > 0:
+            self._feed(data)
+        return old
+
+    # ...socket API...
+
+    def settimeout(self, timeout):
+        """
+        Set a timeout on blocking read/write operations.  The ``timeout``
+        argument can be a nonnegative float expressing seconds, or ``None``.
+        If a float is given, subsequent channel read/write operations will
+        raise a timeout exception if the timeout period value has elapsed
+        before the operation has completed.  Setting a timeout of ``None``
+        disables timeouts on socket operations.
+
+        ``chan.settimeout(0.0)`` is equivalent to ``chan.setblocking(0)``;
+        ``chan.settimeout(None)`` is equivalent to ``chan.setblocking(1)``.
+
+        :param float timeout:
+            seconds to wait for a pending read/write operation before raising
+            ``socket.timeout``, or ``None`` for no timeout.
+        """
+        self.timeout = timeout
+
+    def gettimeout(self):
+        """
+        Returns the timeout in seconds (as a float) associated with socket
+        operations, or ``None`` if no timeout is set.  This reflects the last
+        call to `setblocking` or `settimeout`.
+        """
+        return self.timeout
+
+    def setblocking(self, blocking):
+        """
+        Set blocking or non-blocking mode of the channel: if ``blocking`` is 0,
+        the channel is set to non-blocking mode; otherwise it's set to blocking
+        mode. Initially all channels are in blocking mode.
+
+        In non-blocking mode, if a `recv` call doesn't find any data, or if a
+        `send` call can't immediately dispose of the data, an error exception
+        is raised. In blocking mode, the calls block until they can proceed. An
+        EOF condition is considered "immediate data" for `recv`, so if the
+        channel is closed in the read direction, it will never block.
+
+        ``chan.setblocking(0)`` is equivalent to ``chan.settimeout(0)``;
+        ``chan.setblocking(1)`` is equivalent to ``chan.settimeout(None)``.
+
+        :param int blocking:
+            0 to set non-blocking mode; non-0 to set blocking mode.
+        """
+        if blocking:
+            self.settimeout(None)
+        else:
+            self.settimeout(0.0)
+
+    def getpeername(self):
+        """
+        Return the address of the remote side of this Channel, if possible.
+
+        This simply wraps `.Transport.getpeername`, used to provide enough of a
+        socket-like interface to allow asyncore to work. (asyncore likes to
+        call ``'getpeername'``.)
+        """
+        return self.transport.getpeername()
+
+    def close(self):
+        """
+        Close the channel.  All future read/write operations on the channel
+        will fail.  The remote end will receive no more data (after queued data
+        is flushed).  Channels are automatically closed when their `.Transport`
+        is closed or when they are garbage collected.
+        """
+        self.lock.acquire()
+        try:
+            # only close the pipe when the user explicitly closes the channel.
+            # otherwise they will get unpleasant surprises.  (and do it before
+            # checking self.closed, since the remote host may have already
+            # closed the connection.)
+            if self._pipe is not None:
+                self._pipe.close()
+                self._pipe = None
+
+            if not self.active or self.closed:
+                return
+            msgs = self._close_internal()
+        finally:
+            self.lock.release()
+        for m in msgs:
+            if m is not None:
+                self.transport._send_user_message(m)
+
+    def recv_ready(self):
+        """
+        Returns true if data is buffered and ready to be read from this
+        channel.  A ``False`` result does not mean that the channel has closed;
+        it means you may need to wait before more data arrives.
+
+        :return:
+            ``True`` if a `recv` call on this channel would immediately return
+            at least one byte; ``False`` otherwise.
+        """
+        return self.in_buffer.read_ready()
+
+    def recv(self, nbytes):
+        """
+        Receive data from the channel.  The return value is a string
+        representing the data received.  The maximum amount of data to be
+        received at once is specified by ``nbytes``.  If a string of
+        length zero is returned, the channel stream has closed.
+
+        :param int nbytes: maximum number of bytes to read.
+        :return: received data, as a `bytes`.
+
+        :raises socket.timeout:
+            if no data is ready before the timeout set by `settimeout`.
+        """
+        try:
+            out = self.in_buffer.read(nbytes, self.timeout)
+        except PipeTimeout:
+            raise socket.timeout()
+
+        ack = self._check_add_window(len(out))
+        # no need to hold the channel lock when sending this
+        if ack > 0:
+            m = Message()
+            m.add_byte(cMSG_CHANNEL_WINDOW_ADJUST)
+            m.add_int(self.remote_chanid)
+            m.add_int(ack)
+            self.transport._send_user_message(m)
+
+        return out
+
+    def recv_stderr_ready(self):
+        """
+        Returns true if data is buffered and ready to be read from this
+        channel's stderr stream.  Only channels using `exec_command` or
+        `invoke_shell` without a pty will ever have data on the stderr
+        stream.
+
+        :return:
+            ``True`` if a `recv_stderr` call on this channel would immediately
+            return at least one byte; ``False`` otherwise.
+
+        .. versionadded:: 1.1
+        """
+        return self.in_stderr_buffer.read_ready()
+
+    def recv_stderr(self, nbytes):
+        """
+        Receive data from the channel's stderr stream.  Only channels using
+        `exec_command` or `invoke_shell` without a pty will ever have data
+        on the stderr stream.  The return value is a string representing the
+        data received.  The maximum amount of data to be received at once is
+        specified by ``nbytes``.  If a string of length zero is returned, the
+        channel stream has closed.
+
+        :param int nbytes: maximum number of bytes to read.
+        :return: received data as a `bytes`
+
+        :raises socket.timeout: if no data is ready before the timeout set by
+            `settimeout`.
+
+        .. versionadded:: 1.1
+        """
+        try:
+            out = self.in_stderr_buffer.read(nbytes, self.timeout)
+        except PipeTimeout:
+            raise socket.timeout()
+
+        ack = self._check_add_window(len(out))
+        # no need to hold the channel lock when sending this
+        if ack > 0:
+            m = Message()
+            m.add_byte(cMSG_CHANNEL_WINDOW_ADJUST)
+            m.add_int(self.remote_chanid)
+            m.add_int(ack)
+            self.transport._send_user_message(m)
+
+        return out
+
+    def send_ready(self):
+        """
+        Returns true if data can be written to this channel without blocking.
+        This means the channel is either closed (so any write attempt would
+        return immediately) or there is at least one byte of space in the
+        outbound buffer. If there is at least one byte of space in the
+        outbound buffer, a `send` call will succeed immediately and return
+        the number of bytes actually written.
+
+        :return:
+            ``True`` if a `send` call on this channel would immediately succeed
+            or fail
+        """
+        self.lock.acquire()
+        try:
+            if self.closed or self.eof_sent:
+                return True
+            return self.out_window_size > 0
+        finally:
+            self.lock.release()
+
+    def send(self, s):
+        """
+        Send data to the channel.  Returns the number of bytes sent, or 0 if
+        the channel stream is closed.  Applications are responsible for
+        checking that all data has been sent: if only some of the data was
+        transmitted, the application needs to attempt delivery of the remaining
+        data.
+
+        :param bytes s: data to send
+        :return: number of bytes actually sent, as an `int`
+
+        :raises socket.timeout: if no data could be sent before the timeout set
+            by `settimeout`.
+        """
+
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_DATA)
+        m.add_int(self.remote_chanid)
+        return self._send(s, m)
+
+    def send_stderr(self, s):
+        """
+        Send data to the channel on the "stderr" stream.  This is normally
+        only used by servers to send output from shell commands -- clients
+        won't use this.  Returns the number of bytes sent, or 0 if the channel
+        stream is closed.  Applications are responsible for checking that all
+        data has been sent: if only some of the data was transmitted, the
+        application needs to attempt delivery of the remaining data.
+
+        :param bytes s: data to send.
+        :return: number of bytes actually sent, as an `int`.
+
+        :raises socket.timeout:
+            if no data could be sent before the timeout set by `settimeout`.
+
+        .. versionadded:: 1.1
+        """
+
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_EXTENDED_DATA)
+        m.add_int(self.remote_chanid)
+        m.add_int(1)
+        return self._send(s, m)
+
+    def sendall(self, s):
+        """
+        Send data to the channel, without allowing partial results.  Unlike
+        `send`, this method continues to send data from the given string until
+        either all data has been sent or an error occurs.  Nothing is returned.
+
+        :param bytes s: data to send.
+
+        :raises socket.timeout:
+            if sending stalled for longer than the timeout set by `settimeout`.
+        :raises socket.error:
+            if an error occurred before the entire string was sent.
+
+        .. note::
+            If the channel is closed while only part of the data has been
+            sent, there is no way to determine how much data (if any) was sent.
+            This is irritating, but identically follows Python's API.
+        """
+        while s:
+            sent = self.send(s)
+            s = s[sent:]
+        return None
+
+    def sendall_stderr(self, s):
+        """
+        Send data to the channel's "stderr" stream, without allowing partial
+        results.  Unlike `send_stderr`, this method continues to send data
+        from the given bytestring until all data has been sent or an error
+        occurs. Nothing is returned.
+
+        :param bytes s: data to send to the client as "stderr" output.
+
+        :raises socket.timeout:
+            if sending stalled for longer than the timeout set by `settimeout`.
+        :raises socket.error:
+            if an error occurred before the entire string was sent.
+
+        .. versionadded:: 1.1
+        """
+        while s:
+            sent = self.send_stderr(s)
+            s = s[sent:]
+        return None
+
+    def makefile(self, *params):
+        """
+        Return a file-like object associated with this channel.  The optional
+        ``mode`` and ``bufsize`` arguments are interpreted the same way as by
+        the built-in ``file()`` function in Python.
+
+        :return: `.ChannelFile` object which can be used for Python file I/O.
+        """
+        return ChannelFile(*([self] + list(params)))
+
+    def makefile_stderr(self, *params):
+        """
+        Return a file-like object associated with this channel's stderr
+        stream.   Only channels using `exec_command` or `invoke_shell`
+        without a pty will ever have data on the stderr stream.
+
+        The optional ``mode`` and ``bufsize`` arguments are interpreted the
+        same way as by the built-in ``file()`` function in Python.  For a
+        client, it only makes sense to open this file for reading.  For a
+        server, it only makes sense to open this file for writing.
+
+        :returns:
+            `.ChannelStderrFile` object which can be used for Python file I/O.
+
+        .. versionadded:: 1.1
+        """
+        return ChannelStderrFile(*([self] + list(params)))
+
+    def makefile_stdin(self, *params):
+        """
+        Return a file-like object associated with this channel's stdin
+        stream.
+
+        The optional ``mode`` and ``bufsize`` arguments are interpreted the
+        same way as by the built-in ``file()`` function in Python.  For a
+        client, it only makes sense to open this file for writing.  For a
+        server, it only makes sense to open this file for reading.
+
+        :returns:
+            `.ChannelStdinFile` object which can be used for Python file I/O.
+
+        .. versionadded:: 2.6
+        """
+        return ChannelStdinFile(*([self] + list(params)))
+
+    def fileno(self):
+        """
+        Returns an OS-level file descriptor which can be used for polling, but
+        but not for reading or writing.  This is primarily to allow Python's
+        ``select`` module to work.
+
+        The first time ``fileno`` is called on a channel, a pipe is created to
+        simulate real OS-level file descriptor (FD) behavior.  Because of this,
+        two OS-level FDs are created, which will use up FDs faster than normal.
+        (You won't notice this effect unless you have hundreds of channels
+        open at the same time.)
+
+        :return: an OS-level file descriptor (`int`)
+
+        .. warning::
+            This method causes channel reads to be slightly less efficient.
+        """
+        self.lock.acquire()
+        try:
+            if self._pipe is not None:
+                return self._pipe.fileno()
+            # create the pipe and feed in any existing data
+            self._pipe = pipe.make_pipe()
+            p1, p2 = pipe.make_or_pipe(self._pipe)
+            self.in_buffer.set_event(p1)
+            self.in_stderr_buffer.set_event(p2)
+            return self._pipe.fileno()
+        finally:
+            self.lock.release()
+
+    def shutdown(self, how):
+        """
+        Shut down one or both halves of the connection.  If ``how`` is 0,
+        further receives are disallowed.  If ``how`` is 1, further sends
+        are disallowed.  If ``how`` is 2, further sends and receives are
+        disallowed.  This closes the stream in one or both directions.
+
+        :param int how:
+            0 (stop receiving), 1 (stop sending), or 2 (stop receiving and
+              sending).
+        """
+        if (how == 0) or (how == 2):
+            # feign "read" shutdown
+            self.eof_received = 1
+        if (how == 1) or (how == 2):
+            self.lock.acquire()
+            try:
+                m = self._send_eof()
+            finally:
+                self.lock.release()
+            if m is not None:
+                self.transport._send_user_message(m)
+
+    def shutdown_read(self):
+        """
+        Shutdown the receiving side of this socket, closing the stream in
+        the incoming direction.  After this call, future reads on this
+        channel will fail instantly.  This is a convenience method, equivalent
+        to ``shutdown(0)``, for people who don't make it a habit to
+        memorize unix constants from the 1970s.
+
+        .. versionadded:: 1.2
+        """
+        self.shutdown(0)
+
+    def shutdown_write(self):
+        """
+        Shutdown the sending side of this socket, closing the stream in
+        the outgoing direction.  After this call, future writes on this
+        channel will fail instantly.  This is a convenience method, equivalent
+        to ``shutdown(1)``, for people who don't make it a habit to
+        memorize unix constants from the 1970s.
+
+        .. versionadded:: 1.2
+        """
+        self.shutdown(1)
+
+    @property
+    def _closed(self):
+        # Concession to Python 3's socket API, which has a private ._closed
+        # attribute instead of a semipublic .closed attribute.
+        return self.closed
+
+    # ...calls from Transport
+
+    def _set_transport(self, transport):
+        self.transport = transport
+        self.logger = util.get_logger(self.transport.get_log_channel())
+
+    def _set_window(self, window_size, max_packet_size):
+        self.in_window_size = window_size
+        self.in_max_packet_size = max_packet_size
+        # threshold of bytes we receive before we bother to send
+        # a window update
+        self.in_window_threshold = window_size // 10
+        self.in_window_sofar = 0
+        self._log(DEBUG, "Max packet in: {} bytes".format(max_packet_size))
+
+    def _set_remote_channel(self, chanid, window_size, max_packet_size):
+        self.remote_chanid = chanid
+        self.out_window_size = window_size
+        self.out_max_packet_size = self.transport._sanitize_packet_size(
+            max_packet_size
+        )
+        self.active = 1
+        self._log(
+            DEBUG, "Max packet out: {} bytes".format(self.out_max_packet_size)
+        )
+
+    def _request_success(self, m):
+        self._log(DEBUG, "Sesch channel {} request ok".format(self.chanid))
+        self.event_ready = True
+        self.event.set()
+        return
+
+    def _request_failed(self, m):
+        self.lock.acquire()
+        try:
+            msgs = self._close_internal()
+        finally:
+            self.lock.release()
+        for m in msgs:
+            if m is not None:
+                self.transport._send_user_message(m)
+
+    def _feed(self, m):
+        if isinstance(m, bytes):
+            # passed from _feed_extended
+            s = m
+        else:
+            s = m.get_binary()
+        self.in_buffer.feed(s)
+
+    def _feed_extended(self, m):
+        code = m.get_int()
+        s = m.get_binary()
+        if code != 1:
+            self._log(
+                ERROR, "unknown extended_data type {}; discarding".format(code)
+            )
+            return
+        if self.combine_stderr:
+            self._feed(s)
+        else:
+            self.in_stderr_buffer.feed(s)
+
+    def _window_adjust(self, m):
+        nbytes = m.get_int()
+        self.lock.acquire()
+        try:
+            if self.ultra_debug:
+                self._log(DEBUG, "window up {}".format(nbytes))
+            self.out_window_size += nbytes
+            self.out_buffer_cv.notify_all()
+        finally:
+            self.lock.release()
+
+    def _handle_request(self, m):
+        key = m.get_text()
+        want_reply = m.get_boolean()
+        server = self.transport.server_object
+        ok = False
+        if key == "exit-status":
+            self.exit_status = m.get_int()
+            self.status_event.set()
+            ok = True
+        elif key == "xon-xoff":
+            # ignore
+            ok = True
+        elif key == "pty-req":
+            term = m.get_string()
+            width = m.get_int()
+            height = m.get_int()
+            pixelwidth = m.get_int()
+            pixelheight = m.get_int()
+            modes = m.get_string()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_pty_request(
+                    self, term, width, height, pixelwidth, pixelheight, modes
+                )
+        elif key == "shell":
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_shell_request(self)
+        elif key == "env":
+            name = m.get_string()
+            value = m.get_string()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_env_request(self, name, value)
+        elif key == "exec":
+            cmd = m.get_string()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_exec_request(self, cmd)
+        elif key == "subsystem":
+            name = m.get_text()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_subsystem_request(self, name)
+        elif key == "window-change":
+            width = m.get_int()
+            height = m.get_int()
+            pixelwidth = m.get_int()
+            pixelheight = m.get_int()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_window_change_request(
+                    self, width, height, pixelwidth, pixelheight
+                )
+        elif key == "x11-req":
+            single_connection = m.get_boolean()
+            auth_proto = m.get_text()
+            auth_cookie = m.get_binary()
+            screen_number = m.get_int()
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_x11_request(
+                    self,
+                    single_connection,
+                    auth_proto,
+                    auth_cookie,
+                    screen_number,
+                )
+        elif key == "auth-agent-req@openssh.com":
+            if server is None:
+                ok = False
+            else:
+                ok = server.check_channel_forward_agent_request(self)
+        else:
+            self._log(DEBUG, 'Unhandled channel request "{}"'.format(key))
+            ok = False
+        if want_reply:
+            m = Message()
+            if ok:
+                m.add_byte(cMSG_CHANNEL_SUCCESS)
+            else:
+                m.add_byte(cMSG_CHANNEL_FAILURE)
+            m.add_int(self.remote_chanid)
+            self.transport._send_user_message(m)
+
+    def _handle_eof(self, m):
+        self.lock.acquire()
+        try:
+            if not self.eof_received:
+                self.eof_received = True
+                self.in_buffer.close()
+                self.in_stderr_buffer.close()
+                if self._pipe is not None:
+                    self._pipe.set_forever()
+        finally:
+            self.lock.release()
+        self._log(DEBUG, "EOF received ({})".format(self._name))
+
+    def _handle_close(self, m):
+        self.lock.acquire()
+        try:
+            msgs = self._close_internal()
+            self.transport._unlink_channel(self.chanid)
+        finally:
+            self.lock.release()
+        for m in msgs:
+            if m is not None:
+                self.transport._send_user_message(m)
+
+    # ...internals...
+
+    def _send(self, s, m):
+        size = len(s)
+        self.lock.acquire()
+        try:
+            if self.closed:
+                # this doesn't seem useful, but it is the documented behavior
+                # of Socket
+                raise socket.error("Socket is closed")
+            size = self._wait_for_send_window(size)
+            if size == 0:
+                # eof or similar
+                return 0
+            m.add_string(s[:size])
+        finally:
+            self.lock.release()
+        # Note: We release self.lock before calling _send_user_message.
+        # Otherwise, we can deadlock during re-keying.
+        self.transport._send_user_message(m)
+        return size
+
+    def _log(self, level, msg, *args):
+        self.logger.log(level, "[chan " + self._name + "] " + msg, *args)
+
+    def _event_pending(self):
+        self.event.clear()
+        self.event_ready = False
+
+    def _wait_for_event(self):
+        self.event.wait()
+        assert self.event.is_set()
+        if self.event_ready:
+            return
+        e = self.transport.get_exception()
+        if e is None:
+            e = SSHException("Channel closed.")
+        raise e
+
+    def _set_closed(self):
+        # you are holding the lock.
+        self.closed = True
+        self.in_buffer.close()
+        self.in_stderr_buffer.close()
+        self.out_buffer_cv.notify_all()
+        # Notify any waiters that we are closed
+        self.event.set()
+        self.status_event.set()
+        if self._pipe is not None:
+            self._pipe.set_forever()
+
+    def _send_eof(self):
+        # you are holding the lock.
+        if self.eof_sent:
+            return None
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_EOF)
+        m.add_int(self.remote_chanid)
+        self.eof_sent = True
+        self._log(DEBUG, "EOF sent ({})".format(self._name))
+        return m
+
+    def _close_internal(self):
+        # you are holding the lock.
+        if not self.active or self.closed:
+            return None, None
+        m1 = self._send_eof()
+        m2 = Message()
+        m2.add_byte(cMSG_CHANNEL_CLOSE)
+        m2.add_int(self.remote_chanid)
+        self._set_closed()
+        # can't unlink from the Transport yet -- the remote side may still
+        # try to send meta-data (exit-status, etc)
+        return m1, m2
+
+    def _unlink(self):
+        # server connection could die before we become active:
+        # still signal the close!
+        if self.closed:
+            return
+        self.lock.acquire()
+        try:
+            self._set_closed()
+            self.transport._unlink_channel(self.chanid)
+        finally:
+            self.lock.release()
+
+    def _check_add_window(self, n):
+        self.lock.acquire()
+        try:
+            if self.closed or self.eof_received or not self.active:
+                return 0
+            if self.ultra_debug:
+                self._log(DEBUG, "addwindow {}".format(n))
+            self.in_window_sofar += n
+            if self.in_window_sofar <= self.in_window_threshold:
+                return 0
+            if self.ultra_debug:
+                self._log(
+                    DEBUG, "addwindow send {}".format(self.in_window_sofar)
+                )
+            out = self.in_window_sofar
+            self.in_window_sofar = 0
+            return out
+        finally:
+            self.lock.release()
+
+    def _wait_for_send_window(self, size):
+        """
+        (You are already holding the lock.)
+        Wait for the send window to open up, and allocate up to ``size`` bytes
+        for transmission.  If no space opens up before the timeout, a timeout
+        exception is raised.  Returns the number of bytes available to send
+        (may be less than requested).
+        """
+        # you are already holding the lock
+        if self.closed or self.eof_sent:
+            return 0
+        if self.out_window_size == 0:
+            # should we block?
+            if self.timeout == 0.0:
+                raise socket.timeout()
+            # loop here in case we get woken up but a different thread has
+            # filled the buffer
+            timeout = self.timeout
+            while self.out_window_size == 0:
+                if self.closed or self.eof_sent:
+                    return 0
+                then = time.time()
+                self.out_buffer_cv.wait(timeout)
+                if timeout is not None:
+                    timeout -= time.time() - then
+                    if timeout <= 0.0:
+                        raise socket.timeout()
+        # we have some window to squeeze into
+        if self.closed or self.eof_sent:
+            return 0
+        if self.out_window_size < size:
+            size = self.out_window_size
+        if self.out_max_packet_size - 64 < size:
+            size = self.out_max_packet_size - 64
+        self.out_window_size -= size
+        if self.ultra_debug:
+            self._log(DEBUG, "window down to {}".format(self.out_window_size))
+        return size
+
+
+class ChannelFile(BufferedFile):
+    """
+    A file-like wrapper around `.Channel`.  A ChannelFile is created by calling
+    `Channel.makefile`.
+
+    .. warning::
+        To correctly emulate the file object created from a socket's `makefile
+        <python:socket.socket.makefile>` method, a `.Channel` and its
+        `.ChannelFile` should be able to be closed or garbage-collected
+        independently. Currently, closing the `ChannelFile` does nothing but
+        flush the buffer.
+    """
+
+    def __init__(self, channel, mode="r", bufsize=-1):
+        self.channel = channel
+        BufferedFile.__init__(self)
+        self._set_mode(mode, bufsize)
+
+    def __repr__(self):
+        """
+        Returns a string representation of this object, for debugging.
+        """
+        return "<paramiko.ChannelFile from " + repr(self.channel) + ">"
+
+    def _read(self, size):
+        return self.channel.recv(size)
+
+    def _write(self, data):
+        self.channel.sendall(data)
+        return len(data)
+
+
+class ChannelStderrFile(ChannelFile):
+    """
+    A file-like wrapper around `.Channel` stderr.
+
+    See `Channel.makefile_stderr` for details.
+    """
+
+    def _read(self, size):
+        return self.channel.recv_stderr(size)
+
+    def _write(self, data):
+        self.channel.sendall_stderr(data)
+        return len(data)
+
+
+class ChannelStdinFile(ChannelFile):
+    """
+    A file-like wrapper around `.Channel` stdin.
+
+    See `Channel.makefile_stdin` for details.
+    """
+
+    def close(self):
+        super().close()
+        self.channel.shutdown_write()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/client.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/client.py
new file mode 100644
index 0000000000000000000000000000000000000000..d8be9108bc6a7b294f117985092b5220326d7ae0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/client.py
@@ -0,0 +1,893 @@
+# Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+SSH client & key policies
+"""
+
+from binascii import hexlify
+import getpass
+import inspect
+import os
+import socket
+import warnings
+from errno import ECONNREFUSED, EHOSTUNREACH
+
+from paramiko.agent import Agent
+from paramiko.common import DEBUG
+from paramiko.config import SSH_PORT
+from paramiko.dsskey import DSSKey
+from paramiko.ecdsakey import ECDSAKey
+from paramiko.ed25519key import Ed25519Key
+from paramiko.hostkeys import HostKeys
+from paramiko.rsakey import RSAKey
+from paramiko.ssh_exception import (
+    SSHException,
+    BadHostKeyException,
+    NoValidConnectionsError,
+)
+from paramiko.transport import Transport
+from paramiko.util import ClosingContextManager
+
+
+class SSHClient(ClosingContextManager):
+    """
+    A high-level representation of a session with an SSH server.  This class
+    wraps `.Transport`, `.Channel`, and `.SFTPClient` to take care of most
+    aspects of authenticating and opening channels.  A typical use case is::
+
+        client = SSHClient()
+        client.load_system_host_keys()
+        client.connect('ssh.example.com')
+        stdin, stdout, stderr = client.exec_command('ls -l')
+
+    You may pass in explicit overrides for authentication and server host key
+    checking.  The default mechanism is to try to use local key files or an
+    SSH agent (if one is running).
+
+    Instances of this class may be used as context managers.
+
+    .. versionadded:: 1.6
+    """
+
+    def __init__(self):
+        """
+        Create a new SSHClient.
+        """
+        self._system_host_keys = HostKeys()
+        self._host_keys = HostKeys()
+        self._host_keys_filename = None
+        self._log_channel = None
+        self._policy = RejectPolicy()
+        self._transport = None
+        self._agent = None
+
+    def load_system_host_keys(self, filename=None):
+        """
+        Load host keys from a system (read-only) file.  Host keys read with
+        this method will not be saved back by `save_host_keys`.
+
+        This method can be called multiple times.  Each new set of host keys
+        will be merged with the existing set (new replacing old if there are
+        conflicts).
+
+        If ``filename`` is left as ``None``, an attempt will be made to read
+        keys from the user's local "known hosts" file, as used by OpenSSH,
+        and no exception will be raised if the file can't be read.  This is
+        probably only useful on posix.
+
+        :param str filename: the filename to read, or ``None``
+
+        :raises: ``IOError`` --
+            if a filename was provided and the file could not be read
+        """
+        if filename is None:
+            # try the user's .ssh key file, and mask exceptions
+            filename = os.path.expanduser("~/.ssh/known_hosts")
+            try:
+                self._system_host_keys.load(filename)
+            except IOError:
+                pass
+            return
+        self._system_host_keys.load(filename)
+
+    def load_host_keys(self, filename):
+        """
+        Load host keys from a local host-key file.  Host keys read with this
+        method will be checked after keys loaded via `load_system_host_keys`,
+        but will be saved back by `save_host_keys` (so they can be modified).
+        The missing host key policy `.AutoAddPolicy` adds keys to this set and
+        saves them, when connecting to a previously-unknown server.
+
+        This method can be called multiple times.  Each new set of host keys
+        will be merged with the existing set (new replacing old if there are
+        conflicts).  When automatically saving, the last hostname is used.
+
+        :param str filename: the filename to read
+
+        :raises: ``IOError`` -- if the filename could not be read
+        """
+        self._host_keys_filename = filename
+        self._host_keys.load(filename)
+
+    def save_host_keys(self, filename):
+        """
+        Save the host keys back to a file.  Only the host keys loaded with
+        `load_host_keys` (plus any added directly) will be saved -- not any
+        host keys loaded with `load_system_host_keys`.
+
+        :param str filename: the filename to save to
+
+        :raises: ``IOError`` -- if the file could not be written
+        """
+
+        # update local host keys from file (in case other SSH clients
+        # have written to the known_hosts file meanwhile.
+        if self._host_keys_filename is not None:
+            self.load_host_keys(self._host_keys_filename)
+
+        with open(filename, "w") as f:
+            for hostname, keys in self._host_keys.items():
+                for keytype, key in keys.items():
+                    f.write(
+                        "{} {} {}\n".format(
+                            hostname, keytype, key.get_base64()
+                        )
+                    )
+
+    def get_host_keys(self):
+        """
+        Get the local `.HostKeys` object.  This can be used to examine the
+        local host keys or change them.
+
+        :return: the local host keys as a `.HostKeys` object.
+        """
+        return self._host_keys
+
+    def set_log_channel(self, name):
+        """
+        Set the channel for logging.  The default is ``"paramiko.transport"``
+        but it can be set to anything you want.
+
+        :param str name: new channel name for logging
+        """
+        self._log_channel = name
+
+    def set_missing_host_key_policy(self, policy):
+        """
+        Set policy to use when connecting to servers without a known host key.
+
+        Specifically:
+
+        * A **policy** is a "policy class" (or instance thereof), namely some
+          subclass of `.MissingHostKeyPolicy` such as `.RejectPolicy` (the
+          default), `.AutoAddPolicy`, `.WarningPolicy`, or a user-created
+          subclass.
+        * A host key is **known** when it appears in the client object's cached
+          host keys structures (those manipulated by `load_system_host_keys`
+          and/or `load_host_keys`).
+
+        :param .MissingHostKeyPolicy policy:
+            the policy to use when receiving a host key from a
+            previously-unknown server
+        """
+        if inspect.isclass(policy):
+            policy = policy()
+        self._policy = policy
+
+    def _families_and_addresses(self, hostname, port):
+        """
+        Yield pairs of address families and addresses to try for connecting.
+
+        :param str hostname: the server to connect to
+        :param int port: the server port to connect to
+        :returns: Yields an iterable of ``(family, address)`` tuples
+        """
+        guess = True
+        addrinfos = socket.getaddrinfo(
+            hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM
+        )
+        for (family, socktype, proto, canonname, sockaddr) in addrinfos:
+            if socktype == socket.SOCK_STREAM:
+                yield family, sockaddr
+                guess = False
+
+        # some OS like AIX don't indicate SOCK_STREAM support, so just
+        # guess. :(  We only do this if we did not get a single result marked
+        # as socktype == SOCK_STREAM.
+        if guess:
+            for family, _, _, _, sockaddr in addrinfos:
+                yield family, sockaddr
+
+    def connect(
+        self,
+        hostname,
+        port=SSH_PORT,
+        username=None,
+        password=None,
+        pkey=None,
+        key_filename=None,
+        timeout=None,
+        allow_agent=True,
+        look_for_keys=True,
+        compress=False,
+        sock=None,
+        gss_auth=False,
+        gss_kex=False,
+        gss_deleg_creds=True,
+        gss_host=None,
+        banner_timeout=None,
+        auth_timeout=None,
+        channel_timeout=None,
+        gss_trust_dns=True,
+        passphrase=None,
+        disabled_algorithms=None,
+        transport_factory=None,
+        auth_strategy=None,
+    ):
+        """
+        Connect to an SSH server and authenticate to it.  The server's host key
+        is checked against the system host keys (see `load_system_host_keys`)
+        and any local host keys (`load_host_keys`).  If the server's hostname
+        is not found in either set of host keys, the missing host key policy
+        is used (see `set_missing_host_key_policy`).  The default policy is
+        to reject the key and raise an `.SSHException`.
+
+        Authentication is attempted in the following order of priority:
+
+            - The ``pkey`` or ``key_filename`` passed in (if any)
+
+              - ``key_filename`` may contain OpenSSH public certificate paths
+                as well as regular private-key paths; when files ending in
+                ``-cert.pub`` are found, they are assumed to match a private
+                key, and both components will be loaded. (The private key
+                itself does *not* need to be listed in ``key_filename`` for
+                this to occur - *just* the certificate.)
+
+            - Any key we can find through an SSH agent
+            - Any "id_rsa", "id_dsa" or "id_ecdsa" key discoverable in
+              ``~/.ssh/``
+
+              - When OpenSSH-style public certificates exist that match an
+                existing such private key (so e.g. one has ``id_rsa`` and
+                ``id_rsa-cert.pub``) the certificate will be loaded alongside
+                the private key and used for authentication.
+
+            - Plain username/password auth, if a password was given
+
+        If a private key requires a password to unlock it, and a password is
+        passed in, that password will be used to attempt to unlock the key.
+
+        :param str hostname: the server to connect to
+        :param int port: the server port to connect to
+        :param str username:
+            the username to authenticate as (defaults to the current local
+            username)
+        :param str password:
+            Used for password authentication; is also used for private key
+            decryption if ``passphrase`` is not given.
+        :param str passphrase:
+            Used for decrypting private keys.
+        :param .PKey pkey: an optional private key to use for authentication
+        :param str key_filename:
+            the filename, or list of filenames, of optional private key(s)
+            and/or certs to try for authentication
+        :param float timeout:
+            an optional timeout (in seconds) for the TCP connect
+        :param bool allow_agent:
+            set to False to disable connecting to the SSH agent
+        :param bool look_for_keys:
+            set to False to disable searching for discoverable private key
+            files in ``~/.ssh/``
+        :param bool compress: set to True to turn on compression
+        :param socket sock:
+            an open socket or socket-like object (such as a `.Channel`) to use
+            for communication to the target host
+        :param bool gss_auth:
+            ``True`` if you want to use GSS-API authentication
+        :param bool gss_kex:
+            Perform GSS-API Key Exchange and user authentication
+        :param bool gss_deleg_creds: Delegate GSS-API client credentials or not
+        :param str gss_host:
+            The targets name in the kerberos database. default: hostname
+        :param bool gss_trust_dns:
+            Indicates whether or not the DNS is trusted to securely
+            canonicalize the name of the host being connected to (default
+            ``True``).
+        :param float banner_timeout: an optional timeout (in seconds) to wait
+            for the SSH banner to be presented.
+        :param float auth_timeout: an optional timeout (in seconds) to wait for
+            an authentication response.
+        :param float channel_timeout: an optional timeout (in seconds) to wait
+             for a channel open response.
+        :param dict disabled_algorithms:
+            an optional dict passed directly to `.Transport` and its keyword
+            argument of the same name.
+        :param transport_factory:
+            an optional callable which is handed a subset of the constructor
+            arguments (primarily those related to the socket, GSS
+            functionality, and algorithm selection) and generates a
+            `.Transport` instance to be used by this client. Defaults to
+            `.Transport.__init__`.
+        :param auth_strategy:
+            an optional instance of `.AuthStrategy`, triggering use of this
+            newer authentication mechanism instead of SSHClient's legacy auth
+            method.
+
+            .. warning::
+                This parameter is **incompatible** with all other
+                authentication-related parameters (such as, but not limited to,
+                ``password``, ``key_filename`` and ``allow_agent``) and will
+                trigger an exception if given alongside them.
+
+        :returns:
+            `.AuthResult` if ``auth_strategy`` is non-``None``; otherwise,
+            returns ``None``.
+
+        :raises BadHostKeyException:
+            if the server's host key could not be verified.
+        :raises AuthenticationException:
+            if authentication failed.
+        :raises UnableToAuthenticate:
+            if authentication failed (when ``auth_strategy`` is non-``None``;
+            and note that this is a subclass of ``AuthenticationException``).
+        :raises socket.error:
+            if a socket error (other than connection-refused or
+            host-unreachable) occurred while connecting.
+        :raises NoValidConnectionsError:
+            if all valid connection targets for the requested hostname (eg IPv4
+            and IPv6) yielded connection-refused or host-unreachable socket
+            errors.
+        :raises SSHException:
+            if there was any other error connecting or establishing an SSH
+            session.
+
+        .. versionchanged:: 1.15
+            Added the ``banner_timeout``, ``gss_auth``, ``gss_kex``,
+            ``gss_deleg_creds`` and ``gss_host`` arguments.
+        .. versionchanged:: 2.3
+            Added the ``gss_trust_dns`` argument.
+        .. versionchanged:: 2.4
+            Added the ``passphrase`` argument.
+        .. versionchanged:: 2.6
+            Added the ``disabled_algorithms`` argument.
+        .. versionchanged:: 2.12
+            Added the ``transport_factory`` argument.
+        .. versionchanged:: 3.2
+            Added the ``auth_strategy`` argument.
+        """
+        if not sock:
+            errors = {}
+            # Try multiple possible address families (e.g. IPv4 vs IPv6)
+            to_try = list(self._families_and_addresses(hostname, port))
+            for af, addr in to_try:
+                try:
+                    sock = socket.socket(af, socket.SOCK_STREAM)
+                    if timeout is not None:
+                        try:
+                            sock.settimeout(timeout)
+                        except:
+                            pass
+                    sock.connect(addr)
+                    # Break out of the loop on success
+                    break
+                except socket.error as e:
+                    # As mentioned in socket docs it is better
+                    # to close sockets explicitly
+                    if sock:
+                        sock.close()
+                    # Raise anything that isn't a straight up connection error
+                    # (such as a resolution error)
+                    if e.errno not in (ECONNREFUSED, EHOSTUNREACH):
+                        raise
+                    # Capture anything else so we know how the run looks once
+                    # iteration is complete. Retain info about which attempt
+                    # this was.
+                    errors[addr] = e
+
+            # Make sure we explode usefully if no address family attempts
+            # succeeded. We've no way of knowing which error is the "right"
+            # one, so we construct a hybrid exception containing all the real
+            # ones, of a subclass that client code should still be watching for
+            # (socket.error)
+            if len(errors) == len(to_try):
+                raise NoValidConnectionsError(errors)
+
+        if transport_factory is None:
+            transport_factory = Transport
+        t = self._transport = transport_factory(
+            sock,
+            gss_kex=gss_kex,
+            gss_deleg_creds=gss_deleg_creds,
+            disabled_algorithms=disabled_algorithms,
+        )
+        t.use_compression(compress=compress)
+        t.set_gss_host(
+            # t.hostname may be None, but GSS-API requires a target name.
+            # Therefore use hostname as fallback.
+            gss_host=gss_host or hostname,
+            trust_dns=gss_trust_dns,
+            gssapi_requested=gss_auth or gss_kex,
+        )
+        if self._log_channel is not None:
+            t.set_log_channel(self._log_channel)
+        if banner_timeout is not None:
+            t.banner_timeout = banner_timeout
+        if auth_timeout is not None:
+            t.auth_timeout = auth_timeout
+        if channel_timeout is not None:
+            t.channel_timeout = channel_timeout
+
+        if port == SSH_PORT:
+            server_hostkey_name = hostname
+        else:
+            server_hostkey_name = "[{}]:{}".format(hostname, port)
+        our_server_keys = None
+
+        our_server_keys = self._system_host_keys.get(server_hostkey_name)
+        if our_server_keys is None:
+            our_server_keys = self._host_keys.get(server_hostkey_name)
+        if our_server_keys is not None:
+            keytype = our_server_keys.keys()[0]
+            sec_opts = t.get_security_options()
+            other_types = [x for x in sec_opts.key_types if x != keytype]
+            sec_opts.key_types = [keytype] + other_types
+
+        t.start_client(timeout=timeout)
+
+        # If GSS-API Key Exchange is performed we are not required to check the
+        # host key, because the host is authenticated via GSS-API / SSPI as
+        # well as our client.
+        if not self._transport.gss_kex_used:
+            server_key = t.get_remote_server_key()
+            if our_server_keys is None:
+                # will raise exception if the key is rejected
+                self._policy.missing_host_key(
+                    self, server_hostkey_name, server_key
+                )
+            else:
+                our_key = our_server_keys.get(server_key.get_name())
+                if our_key != server_key:
+                    if our_key is None:
+                        our_key = list(our_server_keys.values())[0]
+                    raise BadHostKeyException(hostname, server_key, our_key)
+
+        if username is None:
+            username = getpass.getuser()
+
+        # New auth flow!
+        if auth_strategy is not None:
+            return auth_strategy.authenticate(transport=t)
+
+        # Old auth flow!
+        if key_filename is None:
+            key_filenames = []
+        elif isinstance(key_filename, str):
+            key_filenames = [key_filename]
+        else:
+            key_filenames = key_filename
+
+        self._auth(
+            username,
+            password,
+            pkey,
+            key_filenames,
+            allow_agent,
+            look_for_keys,
+            gss_auth,
+            gss_kex,
+            gss_deleg_creds,
+            t.gss_host,
+            passphrase,
+        )
+
+    def close(self):
+        """
+        Close this SSHClient and its underlying `.Transport`.
+
+        This should be called anytime you are done using the client object.
+
+        .. warning::
+            Paramiko registers garbage collection hooks that will try to
+            automatically close connections for you, but this is not presently
+            reliable. Failure to explicitly close your client after use may
+            lead to end-of-process hangs!
+        """
+        if self._transport is None:
+            return
+        self._transport.close()
+        self._transport = None
+
+        if self._agent is not None:
+            self._agent.close()
+            self._agent = None
+
+    def exec_command(
+        self,
+        command,
+        bufsize=-1,
+        timeout=None,
+        get_pty=False,
+        environment=None,
+    ):
+        """
+        Execute a command on the SSH server.  A new `.Channel` is opened and
+        the requested command is executed.  The command's input and output
+        streams are returned as Python ``file``-like objects representing
+        stdin, stdout, and stderr.
+
+        :param str command: the command to execute
+        :param int bufsize:
+            interpreted the same way as by the built-in ``file()`` function in
+            Python
+        :param int timeout:
+            set command's channel timeout. See `.Channel.settimeout`
+        :param bool get_pty:
+            Request a pseudo-terminal from the server (default ``False``).
+            See `.Channel.get_pty`
+        :param dict environment:
+            a dict of shell environment variables, to be merged into the
+            default environment that the remote command executes within.
+
+            .. warning::
+                Servers may silently reject some environment variables; see the
+                warning in `.Channel.set_environment_variable` for details.
+
+        :return:
+            the stdin, stdout, and stderr of the executing command, as a
+            3-tuple
+
+        :raises: `.SSHException` -- if the server fails to execute the command
+
+        .. versionchanged:: 1.10
+            Added the ``get_pty`` kwarg.
+        """
+        chan = self._transport.open_session(timeout=timeout)
+        if get_pty:
+            chan.get_pty()
+        chan.settimeout(timeout)
+        if environment:
+            chan.update_environment(environment)
+        chan.exec_command(command)
+        stdin = chan.makefile_stdin("wb", bufsize)
+        stdout = chan.makefile("r", bufsize)
+        stderr = chan.makefile_stderr("r", bufsize)
+        return stdin, stdout, stderr
+
+    def invoke_shell(
+        self,
+        term="vt100",
+        width=80,
+        height=24,
+        width_pixels=0,
+        height_pixels=0,
+        environment=None,
+    ):
+        """
+        Start an interactive shell session on the SSH server.  A new `.Channel`
+        is opened and connected to a pseudo-terminal using the requested
+        terminal type and size.
+
+        :param str term:
+            the terminal type to emulate (for example, ``"vt100"``)
+        :param int width: the width (in characters) of the terminal window
+        :param int height: the height (in characters) of the terminal window
+        :param int width_pixels: the width (in pixels) of the terminal window
+        :param int height_pixels: the height (in pixels) of the terminal window
+        :param dict environment: the command's environment
+        :return: a new `.Channel` connected to the remote shell
+
+        :raises: `.SSHException` -- if the server fails to invoke a shell
+        """
+        chan = self._transport.open_session()
+        chan.get_pty(term, width, height, width_pixels, height_pixels)
+        chan.invoke_shell()
+        return chan
+
+    def open_sftp(self):
+        """
+        Open an SFTP session on the SSH server.
+
+        :return: a new `.SFTPClient` session object
+        """
+        return self._transport.open_sftp_client()
+
+    def get_transport(self):
+        """
+        Return the underlying `.Transport` object for this SSH connection.
+        This can be used to perform lower-level tasks, like opening specific
+        kinds of channels.
+
+        :return: the `.Transport` for this connection
+        """
+        return self._transport
+
+    def _key_from_filepath(self, filename, klass, password):
+        """
+        Attempt to derive a `.PKey` from given string path ``filename``:
+
+        - If ``filename`` appears to be a cert, the matching private key is
+          loaded.
+        - Otherwise, the filename is assumed to be a private key, and the
+          matching public cert will be loaded if it exists.
+        """
+        cert_suffix = "-cert.pub"
+        # Assume privkey, not cert, by default
+        if filename.endswith(cert_suffix):
+            key_path = filename[: -len(cert_suffix)]
+            cert_path = filename
+        else:
+            key_path = filename
+            cert_path = filename + cert_suffix
+        # Blindly try the key path; if no private key, nothing will work.
+        key = klass.from_private_key_file(key_path, password)
+        # TODO: change this to 'Loading' instead of 'Trying' sometime; probably
+        # when #387 is released, since this is a critical log message users are
+        # likely testing/filtering for (bah.)
+        msg = "Trying discovered key {} in {}".format(
+            hexlify(key.get_fingerprint()), key_path
+        )
+        self._log(DEBUG, msg)
+        # Attempt to load cert if it exists.
+        if os.path.isfile(cert_path):
+            key.load_certificate(cert_path)
+            self._log(DEBUG, "Adding public certificate {}".format(cert_path))
+        return key
+
+    def _auth(
+        self,
+        username,
+        password,
+        pkey,
+        key_filenames,
+        allow_agent,
+        look_for_keys,
+        gss_auth,
+        gss_kex,
+        gss_deleg_creds,
+        gss_host,
+        passphrase,
+    ):
+        """
+        Try, in order:
+
+            - The key(s) passed in, if one was passed in.
+            - Any key we can find through an SSH agent (if allowed).
+            - Any "id_rsa", "id_dsa" or "id_ecdsa" key discoverable in ~/.ssh/
+              (if allowed).
+            - Plain username/password auth, if a password was given.
+
+        (The password might be needed to unlock a private key [if 'passphrase'
+        isn't also given], or for two-factor authentication [for which it is
+        required].)
+        """
+        saved_exception = None
+        two_factor = False
+        allowed_types = set()
+        two_factor_types = {"keyboard-interactive", "password"}
+        if passphrase is None and password is not None:
+            passphrase = password
+
+        # If GSS-API support and GSS-PI Key Exchange was performed, we attempt
+        # authentication with gssapi-keyex.
+        if gss_kex and self._transport.gss_kex_used:
+            try:
+                self._transport.auth_gssapi_keyex(username)
+                return
+            except Exception as e:
+                saved_exception = e
+
+        # Try GSS-API authentication (gssapi-with-mic) only if GSS-API Key
+        # Exchange is not performed, because if we use GSS-API for the key
+        # exchange, there is already a fully established GSS-API context, so
+        # why should we do that again?
+        if gss_auth:
+            try:
+                return self._transport.auth_gssapi_with_mic(
+                    username, gss_host, gss_deleg_creds
+                )
+            except Exception as e:
+                saved_exception = e
+
+        if pkey is not None:
+            try:
+                self._log(
+                    DEBUG,
+                    "Trying SSH key {}".format(
+                        hexlify(pkey.get_fingerprint())
+                    ),
+                )
+                allowed_types = set(
+                    self._transport.auth_publickey(username, pkey)
+                )
+                two_factor = allowed_types & two_factor_types
+                if not two_factor:
+                    return
+            except SSHException as e:
+                saved_exception = e
+
+        if not two_factor:
+            for key_filename in key_filenames:
+                # TODO 4.0: leverage PKey.from_path() if we don't end up just
+                # killing SSHClient entirely
+                for pkey_class in (RSAKey, DSSKey, ECDSAKey, Ed25519Key):
+                    try:
+                        key = self._key_from_filepath(
+                            key_filename, pkey_class, passphrase
+                        )
+                        allowed_types = set(
+                            self._transport.auth_publickey(username, key)
+                        )
+                        two_factor = allowed_types & two_factor_types
+                        if not two_factor:
+                            return
+                        break
+                    except SSHException as e:
+                        saved_exception = e
+
+        if not two_factor and allow_agent:
+            if self._agent is None:
+                self._agent = Agent()
+
+            for key in self._agent.get_keys():
+                try:
+                    id_ = hexlify(key.get_fingerprint())
+                    self._log(DEBUG, "Trying SSH agent key {}".format(id_))
+                    # for 2-factor auth a successfully auth'd key password
+                    # will return an allowed 2fac auth method
+                    allowed_types = set(
+                        self._transport.auth_publickey(username, key)
+                    )
+                    two_factor = allowed_types & two_factor_types
+                    if not two_factor:
+                        return
+                    break
+                except SSHException as e:
+                    saved_exception = e
+
+        if not two_factor:
+            keyfiles = []
+
+            for keytype, name in [
+                (RSAKey, "rsa"),
+                (DSSKey, "dsa"),
+                (ECDSAKey, "ecdsa"),
+                (Ed25519Key, "ed25519"),
+            ]:
+                # ~/ssh/ is for windows
+                for directory in [".ssh", "ssh"]:
+                    full_path = os.path.expanduser(
+                        "~/{}/id_{}".format(directory, name)
+                    )
+                    if os.path.isfile(full_path):
+                        # TODO: only do this append if below did not run
+                        keyfiles.append((keytype, full_path))
+                        if os.path.isfile(full_path + "-cert.pub"):
+                            keyfiles.append((keytype, full_path + "-cert.pub"))
+
+            if not look_for_keys:
+                keyfiles = []
+
+            for pkey_class, filename in keyfiles:
+                try:
+                    key = self._key_from_filepath(
+                        filename, pkey_class, passphrase
+                    )
+                    # for 2-factor auth a successfully auth'd key will result
+                    # in ['password']
+                    allowed_types = set(
+                        self._transport.auth_publickey(username, key)
+                    )
+                    two_factor = allowed_types & two_factor_types
+                    if not two_factor:
+                        return
+                    break
+                except (SSHException, IOError) as e:
+                    saved_exception = e
+
+        if password is not None:
+            try:
+                self._transport.auth_password(username, password)
+                return
+            except SSHException as e:
+                saved_exception = e
+        elif two_factor:
+            try:
+                self._transport.auth_interactive_dumb(username)
+                return
+            except SSHException as e:
+                saved_exception = e
+
+        # if we got an auth-failed exception earlier, re-raise it
+        if saved_exception is not None:
+            raise saved_exception
+        raise SSHException("No authentication methods available")
+
+    def _log(self, level, msg):
+        self._transport._log(level, msg)
+
+
+class MissingHostKeyPolicy:
+    """
+    Interface for defining the policy that `.SSHClient` should use when the
+    SSH server's hostname is not in either the system host keys or the
+    application's keys.  Pre-made classes implement policies for automatically
+    adding the key to the application's `.HostKeys` object (`.AutoAddPolicy`),
+    and for automatically rejecting the key (`.RejectPolicy`).
+
+    This function may be used to ask the user to verify the key, for example.
+    """
+
+    def missing_host_key(self, client, hostname, key):
+        """
+        Called when an `.SSHClient` receives a server key for a server that
+        isn't in either the system or local `.HostKeys` object.  To accept
+        the key, simply return.  To reject, raised an exception (which will
+        be passed to the calling application).
+        """
+        pass
+
+
+class AutoAddPolicy(MissingHostKeyPolicy):
+    """
+    Policy for automatically adding the hostname and new host key to the
+    local `.HostKeys` object, and saving it.  This is used by `.SSHClient`.
+    """
+
+    def missing_host_key(self, client, hostname, key):
+        client._host_keys.add(hostname, key.get_name(), key)
+        if client._host_keys_filename is not None:
+            client.save_host_keys(client._host_keys_filename)
+        client._log(
+            DEBUG,
+            "Adding {} host key for {}: {}".format(
+                key.get_name(), hostname, hexlify(key.get_fingerprint())
+            ),
+        )
+
+
+class RejectPolicy(MissingHostKeyPolicy):
+    """
+    Policy for automatically rejecting the unknown hostname & key.  This is
+    used by `.SSHClient`.
+    """
+
+    def missing_host_key(self, client, hostname, key):
+        client._log(
+            DEBUG,
+            "Rejecting {} host key for {}: {}".format(
+                key.get_name(), hostname, hexlify(key.get_fingerprint())
+            ),
+        )
+        raise SSHException(
+            "Server {!r} not found in known_hosts".format(hostname)
+        )
+
+
+class WarningPolicy(MissingHostKeyPolicy):
+    """
+    Policy for logging a Python-style warning for an unknown host key, but
+    accepting it. This is used by `.SSHClient`.
+    """
+
+    def missing_host_key(self, client, hostname, key):
+        warnings.warn(
+            "Unknown {} host key for {}: {}".format(
+                key.get_name(), hostname, hexlify(key.get_fingerprint())
+            )
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/common.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/common.py
new file mode 100644
index 0000000000000000000000000000000000000000..b57149b75386cb1b60a99730a238f9e54b7fbf9a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/common.py
@@ -0,0 +1,245 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Common constants and global variables.
+"""
+import logging
+import struct
+
+#
+# Formerly of py3compat.py. May be fully delete'able with a deeper look?
+#
+
+
+def byte_chr(c):
+    assert isinstance(c, int)
+    return struct.pack("B", c)
+
+
+def byte_mask(c, mask):
+    assert isinstance(c, int)
+    return struct.pack("B", c & mask)
+
+
+def byte_ord(c):
+    # In case we're handed a string instead of an int.
+    if not isinstance(c, int):
+        c = ord(c)
+    return c
+
+
+(
+    MSG_DISCONNECT,
+    MSG_IGNORE,
+    MSG_UNIMPLEMENTED,
+    MSG_DEBUG,
+    MSG_SERVICE_REQUEST,
+    MSG_SERVICE_ACCEPT,
+    MSG_EXT_INFO,
+) = range(1, 8)
+(MSG_KEXINIT, MSG_NEWKEYS) = range(20, 22)
+(
+    MSG_USERAUTH_REQUEST,
+    MSG_USERAUTH_FAILURE,
+    MSG_USERAUTH_SUCCESS,
+    MSG_USERAUTH_BANNER,
+) = range(50, 54)
+MSG_USERAUTH_PK_OK = 60
+(MSG_USERAUTH_INFO_REQUEST, MSG_USERAUTH_INFO_RESPONSE) = range(60, 62)
+(MSG_USERAUTH_GSSAPI_RESPONSE, MSG_USERAUTH_GSSAPI_TOKEN) = range(60, 62)
+(
+    MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE,
+    MSG_USERAUTH_GSSAPI_ERROR,
+    MSG_USERAUTH_GSSAPI_ERRTOK,
+    MSG_USERAUTH_GSSAPI_MIC,
+) = range(63, 67)
+HIGHEST_USERAUTH_MESSAGE_ID = 79
+(MSG_GLOBAL_REQUEST, MSG_REQUEST_SUCCESS, MSG_REQUEST_FAILURE) = range(80, 83)
+(
+    MSG_CHANNEL_OPEN,
+    MSG_CHANNEL_OPEN_SUCCESS,
+    MSG_CHANNEL_OPEN_FAILURE,
+    MSG_CHANNEL_WINDOW_ADJUST,
+    MSG_CHANNEL_DATA,
+    MSG_CHANNEL_EXTENDED_DATA,
+    MSG_CHANNEL_EOF,
+    MSG_CHANNEL_CLOSE,
+    MSG_CHANNEL_REQUEST,
+    MSG_CHANNEL_SUCCESS,
+    MSG_CHANNEL_FAILURE,
+) = range(90, 101)
+
+cMSG_DISCONNECT = byte_chr(MSG_DISCONNECT)
+cMSG_IGNORE = byte_chr(MSG_IGNORE)
+cMSG_UNIMPLEMENTED = byte_chr(MSG_UNIMPLEMENTED)
+cMSG_DEBUG = byte_chr(MSG_DEBUG)
+cMSG_SERVICE_REQUEST = byte_chr(MSG_SERVICE_REQUEST)
+cMSG_SERVICE_ACCEPT = byte_chr(MSG_SERVICE_ACCEPT)
+cMSG_EXT_INFO = byte_chr(MSG_EXT_INFO)
+cMSG_KEXINIT = byte_chr(MSG_KEXINIT)
+cMSG_NEWKEYS = byte_chr(MSG_NEWKEYS)
+cMSG_USERAUTH_REQUEST = byte_chr(MSG_USERAUTH_REQUEST)
+cMSG_USERAUTH_FAILURE = byte_chr(MSG_USERAUTH_FAILURE)
+cMSG_USERAUTH_SUCCESS = byte_chr(MSG_USERAUTH_SUCCESS)
+cMSG_USERAUTH_BANNER = byte_chr(MSG_USERAUTH_BANNER)
+cMSG_USERAUTH_PK_OK = byte_chr(MSG_USERAUTH_PK_OK)
+cMSG_USERAUTH_INFO_REQUEST = byte_chr(MSG_USERAUTH_INFO_REQUEST)
+cMSG_USERAUTH_INFO_RESPONSE = byte_chr(MSG_USERAUTH_INFO_RESPONSE)
+cMSG_USERAUTH_GSSAPI_RESPONSE = byte_chr(MSG_USERAUTH_GSSAPI_RESPONSE)
+cMSG_USERAUTH_GSSAPI_TOKEN = byte_chr(MSG_USERAUTH_GSSAPI_TOKEN)
+cMSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE = byte_chr(
+    MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE
+)
+cMSG_USERAUTH_GSSAPI_ERROR = byte_chr(MSG_USERAUTH_GSSAPI_ERROR)
+cMSG_USERAUTH_GSSAPI_ERRTOK = byte_chr(MSG_USERAUTH_GSSAPI_ERRTOK)
+cMSG_USERAUTH_GSSAPI_MIC = byte_chr(MSG_USERAUTH_GSSAPI_MIC)
+cMSG_GLOBAL_REQUEST = byte_chr(MSG_GLOBAL_REQUEST)
+cMSG_REQUEST_SUCCESS = byte_chr(MSG_REQUEST_SUCCESS)
+cMSG_REQUEST_FAILURE = byte_chr(MSG_REQUEST_FAILURE)
+cMSG_CHANNEL_OPEN = byte_chr(MSG_CHANNEL_OPEN)
+cMSG_CHANNEL_OPEN_SUCCESS = byte_chr(MSG_CHANNEL_OPEN_SUCCESS)
+cMSG_CHANNEL_OPEN_FAILURE = byte_chr(MSG_CHANNEL_OPEN_FAILURE)
+cMSG_CHANNEL_WINDOW_ADJUST = byte_chr(MSG_CHANNEL_WINDOW_ADJUST)
+cMSG_CHANNEL_DATA = byte_chr(MSG_CHANNEL_DATA)
+cMSG_CHANNEL_EXTENDED_DATA = byte_chr(MSG_CHANNEL_EXTENDED_DATA)
+cMSG_CHANNEL_EOF = byte_chr(MSG_CHANNEL_EOF)
+cMSG_CHANNEL_CLOSE = byte_chr(MSG_CHANNEL_CLOSE)
+cMSG_CHANNEL_REQUEST = byte_chr(MSG_CHANNEL_REQUEST)
+cMSG_CHANNEL_SUCCESS = byte_chr(MSG_CHANNEL_SUCCESS)
+cMSG_CHANNEL_FAILURE = byte_chr(MSG_CHANNEL_FAILURE)
+
+# for debugging:
+MSG_NAMES = {
+    MSG_DISCONNECT: "disconnect",
+    MSG_IGNORE: "ignore",
+    MSG_UNIMPLEMENTED: "unimplemented",
+    MSG_DEBUG: "debug",
+    MSG_SERVICE_REQUEST: "service-request",
+    MSG_SERVICE_ACCEPT: "service-accept",
+    MSG_KEXINIT: "kexinit",
+    MSG_EXT_INFO: "ext-info",
+    MSG_NEWKEYS: "newkeys",
+    30: "kex30",
+    31: "kex31",
+    32: "kex32",
+    33: "kex33",
+    34: "kex34",
+    40: "kex40",
+    41: "kex41",
+    MSG_USERAUTH_REQUEST: "userauth-request",
+    MSG_USERAUTH_FAILURE: "userauth-failure",
+    MSG_USERAUTH_SUCCESS: "userauth-success",
+    MSG_USERAUTH_BANNER: "userauth--banner",
+    MSG_USERAUTH_PK_OK: "userauth-60(pk-ok/info-request)",
+    MSG_USERAUTH_INFO_RESPONSE: "userauth-info-response",
+    MSG_GLOBAL_REQUEST: "global-request",
+    MSG_REQUEST_SUCCESS: "request-success",
+    MSG_REQUEST_FAILURE: "request-failure",
+    MSG_CHANNEL_OPEN: "channel-open",
+    MSG_CHANNEL_OPEN_SUCCESS: "channel-open-success",
+    MSG_CHANNEL_OPEN_FAILURE: "channel-open-failure",
+    MSG_CHANNEL_WINDOW_ADJUST: "channel-window-adjust",
+    MSG_CHANNEL_DATA: "channel-data",
+    MSG_CHANNEL_EXTENDED_DATA: "channel-extended-data",
+    MSG_CHANNEL_EOF: "channel-eof",
+    MSG_CHANNEL_CLOSE: "channel-close",
+    MSG_CHANNEL_REQUEST: "channel-request",
+    MSG_CHANNEL_SUCCESS: "channel-success",
+    MSG_CHANNEL_FAILURE: "channel-failure",
+    MSG_USERAUTH_GSSAPI_RESPONSE: "userauth-gssapi-response",
+    MSG_USERAUTH_GSSAPI_TOKEN: "userauth-gssapi-token",
+    MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE: "userauth-gssapi-exchange-complete",
+    MSG_USERAUTH_GSSAPI_ERROR: "userauth-gssapi-error",
+    MSG_USERAUTH_GSSAPI_ERRTOK: "userauth-gssapi-error-token",
+    MSG_USERAUTH_GSSAPI_MIC: "userauth-gssapi-mic",
+}
+
+
+# authentication request return codes:
+AUTH_SUCCESSFUL, AUTH_PARTIALLY_SUCCESSFUL, AUTH_FAILED = range(3)
+
+
+# channel request failed reasons:
+(
+    OPEN_SUCCEEDED,
+    OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED,
+    OPEN_FAILED_CONNECT_FAILED,
+    OPEN_FAILED_UNKNOWN_CHANNEL_TYPE,
+    OPEN_FAILED_RESOURCE_SHORTAGE,
+) = range(0, 5)
+
+
+CONNECTION_FAILED_CODE = {
+    1: "Administratively prohibited",
+    2: "Connect failed",
+    3: "Unknown channel type",
+    4: "Resource shortage",
+}
+
+
+(
+    DISCONNECT_SERVICE_NOT_AVAILABLE,
+    DISCONNECT_AUTH_CANCELLED_BY_USER,
+    DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE,
+) = (7, 13, 14)
+
+zero_byte = byte_chr(0)
+one_byte = byte_chr(1)
+four_byte = byte_chr(4)
+max_byte = byte_chr(0xFF)
+cr_byte = byte_chr(13)
+linefeed_byte = byte_chr(10)
+crlf = cr_byte + linefeed_byte
+cr_byte_value = 13
+linefeed_byte_value = 10
+
+
+xffffffff = 0xFFFFFFFF
+x80000000 = 0x80000000
+o666 = 438
+o660 = 432
+o644 = 420
+o600 = 384
+o777 = 511
+o700 = 448
+o70 = 56
+
+DEBUG = logging.DEBUG
+INFO = logging.INFO
+WARNING = logging.WARNING
+ERROR = logging.ERROR
+CRITICAL = logging.CRITICAL
+
+# Common IO/select/etc sleep period, in seconds
+io_sleep = 0.01
+
+DEFAULT_WINDOW_SIZE = 64 * 2**15
+DEFAULT_MAX_PACKET_SIZE = 2**15
+
+# lower bound on the max packet size we'll accept from the remote host
+# Minimum packet size is 32768 bytes according to
+# http://www.ietf.org/rfc/rfc4254.txt
+MIN_WINDOW_SIZE = 2**15
+
+# However, according to http://www.ietf.org/rfc/rfc4253.txt it is perfectly
+# legal to accept a size much smaller, as OpenSSH client does as size 16384.
+MIN_PACKET_SIZE = 2**12
+
+# Max windows size according to http://www.ietf.org/rfc/rfc4254.txt
+MAX_WINDOW_SIZE = 2**32 - 1
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/compress.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/compress.py
new file mode 100644
index 0000000000000000000000000000000000000000..18ff4843461319b2cc8795c661d8b1ac4cee16b3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/compress.py
@@ -0,0 +1,40 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Compression implementations for a Transport.
+"""
+
+import zlib
+
+
+class ZlibCompressor:
+    def __init__(self):
+        # Use the default level of zlib compression
+        self.z = zlib.compressobj()
+
+    def __call__(self, data):
+        return self.z.compress(data) + self.z.flush(zlib.Z_FULL_FLUSH)
+
+
+class ZlibDecompressor:
+    def __init__(self):
+        self.z = zlib.decompressobj()
+
+    def __call__(self, data):
+        return self.z.decompress(data)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/config.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..8ab55c6444faf1c7a14b34ad9d4cb68081113359
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/config.py
@@ -0,0 +1,696 @@
+# Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com>
+# Copyright (C) 2012  Olle Lundberg <geek@nerd.sh>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Configuration file (aka ``ssh_config``) support.
+"""
+
+import fnmatch
+import getpass
+import os
+import re
+import shlex
+import socket
+from hashlib import sha1
+from io import StringIO
+from functools import partial
+
+invoke, invoke_import_error = None, None
+try:
+    import invoke
+except ImportError as e:
+    invoke_import_error = e
+
+from .ssh_exception import CouldNotCanonicalize, ConfigParseError
+
+
+SSH_PORT = 22
+
+
+class SSHConfig:
+    """
+    Representation of config information as stored in the format used by
+    OpenSSH. Queries can be made via `lookup`. The format is described in
+    OpenSSH's ``ssh_config`` man page. This class is provided primarily as a
+    convenience to posix users (since the OpenSSH format is a de-facto
+    standard on posix) but should work fine on Windows too.
+
+    .. versionadded:: 1.6
+    """
+
+    SETTINGS_REGEX = re.compile(r"(\w+)(?:\s*=\s*|\s+)(.+)")
+
+    # TODO: do a full scan of ssh.c & friends to make sure we're fully
+    # compatible across the board, e.g. OpenSSH 8.1 added %n to ProxyCommand.
+    TOKENS_BY_CONFIG_KEY = {
+        "controlpath": ["%C", "%h", "%l", "%L", "%n", "%p", "%r", "%u"],
+        "hostname": ["%h"],
+        "identityfile": ["%C", "~", "%d", "%h", "%l", "%u", "%r"],
+        "proxycommand": ["~", "%h", "%p", "%r"],
+        "proxyjump": ["%h", "%p", "%r"],
+        # Doesn't seem worth making this 'special' for now, it will fit well
+        # enough (no actual match-exec config key to be confused with).
+        "match-exec": ["%C", "%d", "%h", "%L", "%l", "%n", "%p", "%r", "%u"],
+    }
+
+    def __init__(self):
+        """
+        Create a new OpenSSH config object.
+
+        Note: the newer alternate constructors `from_path`, `from_file` and
+        `from_text` are simpler to use, as they parse on instantiation. For
+        example, instead of::
+
+            config = SSHConfig()
+            config.parse(open("some-path.config")
+
+        you could::
+
+            config = SSHConfig.from_file(open("some-path.config"))
+            # Or more directly:
+            config = SSHConfig.from_path("some-path.config")
+            # Or if you have arbitrary ssh_config text from some other source:
+            config = SSHConfig.from_text("Host foo\\n\\tUser bar")
+        """
+        self._config = []
+
+    @classmethod
+    def from_text(cls, text):
+        """
+        Create a new, parsed `SSHConfig` from ``text`` string.
+
+        .. versionadded:: 2.7
+        """
+        return cls.from_file(StringIO(text))
+
+    @classmethod
+    def from_path(cls, path):
+        """
+        Create a new, parsed `SSHConfig` from the file found at ``path``.
+
+        .. versionadded:: 2.7
+        """
+        with open(path) as flo:
+            return cls.from_file(flo)
+
+    @classmethod
+    def from_file(cls, flo):
+        """
+        Create a new, parsed `SSHConfig` from file-like object ``flo``.
+
+        .. versionadded:: 2.7
+        """
+        obj = cls()
+        obj.parse(flo)
+        return obj
+
+    def parse(self, file_obj):
+        """
+        Read an OpenSSH config from the given file object.
+
+        :param file_obj: a file-like object to read the config file from
+        """
+        # Start out w/ implicit/anonymous global host-like block to hold
+        # anything not contained by an explicit one.
+        context = {"host": ["*"], "config": {}}
+        for line in file_obj:
+            # Strip any leading or trailing whitespace from the line.
+            # Refer to https://github.com/paramiko/paramiko/issues/499
+            line = line.strip()
+            # Skip blanks, comments
+            if not line or line.startswith("#"):
+                continue
+
+            # Parse line into key, value
+            match = re.match(self.SETTINGS_REGEX, line)
+            if not match:
+                raise ConfigParseError("Unparsable line {}".format(line))
+            key = match.group(1).lower()
+            value = match.group(2)
+
+            # Host keyword triggers switch to new block/context
+            if key in ("host", "match"):
+                self._config.append(context)
+                context = {"config": {}}
+                if key == "host":
+                    # TODO 4.0: make these real objects or at least name this
+                    # "hosts" to acknowledge it's an iterable. (Doing so prior
+                    # to 3.0, despite it being a private API, feels bad -
+                    # surely such an old codebase has folks actually relying on
+                    # these keys.)
+                    context["host"] = self._get_hosts(value)
+                else:
+                    context["matches"] = self._get_matches(value)
+            # Special-case for noop ProxyCommands
+            elif key == "proxycommand" and value.lower() == "none":
+                # Store 'none' as None - not as a string implying that the
+                # proxycommand is the literal shell command "none"!
+                context["config"][key] = None
+            # All other keywords get stored, directly or via append
+            else:
+                if value.startswith('"') and value.endswith('"'):
+                    value = value[1:-1]
+
+                # identityfile, localforward, remoteforward keys are special
+                # cases, since they are allowed to be specified multiple times
+                # and they should be tried in order of specification.
+                if key in ["identityfile", "localforward", "remoteforward"]:
+                    if key in context["config"]:
+                        context["config"][key].append(value)
+                    else:
+                        context["config"][key] = [value]
+                elif key not in context["config"]:
+                    context["config"][key] = value
+        # Store last 'open' block and we're done
+        self._config.append(context)
+
+    def lookup(self, hostname):
+        """
+        Return a dict (`SSHConfigDict`) of config options for a given hostname.
+
+        The host-matching rules of OpenSSH's ``ssh_config`` man page are used:
+        For each parameter, the first obtained value will be used.  The
+        configuration files contain sections separated by ``Host`` and/or
+        ``Match`` specifications, and that section is only applied for hosts
+        which match the given patterns or keywords
+
+        Since the first obtained value for each parameter is used, more host-
+        specific declarations should be given near the beginning of the file,
+        and general defaults at the end.
+
+        The keys in the returned dict are all normalized to lowercase (look for
+        ``"port"``, not ``"Port"``. The values are processed according to the
+        rules for substitution variable expansion in ``ssh_config``.
+
+        Finally, please see the docs for `SSHConfigDict` for deeper info on
+        features such as optional type conversion methods, e.g.::
+
+            conf = my_config.lookup('myhost')
+            assert conf['passwordauthentication'] == 'yes'
+            assert conf.as_bool('passwordauthentication') is True
+
+        .. note::
+            If there is no explicitly configured ``HostName`` value, it will be
+            set to the being-looked-up hostname, which is as close as we can
+            get to OpenSSH's behavior around that particular option.
+
+        :param str hostname: the hostname to lookup
+
+        .. versionchanged:: 2.5
+            Returns `SSHConfigDict` objects instead of dict literals.
+        .. versionchanged:: 2.7
+            Added canonicalization support.
+        .. versionchanged:: 2.7
+            Added ``Match`` support.
+        .. versionchanged:: 3.3
+            Added ``Match final`` support.
+        """
+        # First pass
+        options = self._lookup(hostname=hostname)
+        # Inject HostName if it was not set (this used to be done incidentally
+        # during tokenization, for some reason).
+        if "hostname" not in options:
+            options["hostname"] = hostname
+        # Handle canonicalization
+        canon = options.get("canonicalizehostname", None) in ("yes", "always")
+        maxdots = int(options.get("canonicalizemaxdots", 1))
+        if canon and hostname.count(".") <= maxdots:
+            # NOTE: OpenSSH manpage does not explicitly state this, but its
+            # implementation for CanonicalDomains is 'split on any whitespace'.
+            domains = options["canonicaldomains"].split()
+            hostname = self.canonicalize(hostname, options, domains)
+            # Overwrite HostName again here (this is also what OpenSSH does)
+            options["hostname"] = hostname
+            options = self._lookup(
+                hostname, options, canonical=True, final=True
+            )
+        else:
+            options = self._lookup(
+                hostname, options, canonical=False, final=True
+            )
+        return options
+
+    def _lookup(self, hostname, options=None, canonical=False, final=False):
+        # Init
+        if options is None:
+            options = SSHConfigDict()
+        # Iterate all stanzas, applying any that match, in turn (so that things
+        # like Match can reference currently understood state)
+        for context in self._config:
+            if not (
+                self._pattern_matches(context.get("host", []), hostname)
+                or self._does_match(
+                    context.get("matches", []),
+                    hostname,
+                    canonical,
+                    final,
+                    options,
+                )
+            ):
+                continue
+            for key, value in context["config"].items():
+                if key not in options:
+                    # Create a copy of the original value,
+                    # else it will reference the original list
+                    # in self._config and update that value too
+                    # when the extend() is being called.
+                    options[key] = value[:] if value is not None else value
+                elif key == "identityfile":
+                    options[key].extend(
+                        x for x in value if x not in options[key]
+                    )
+        if final:
+            # Expand variables in resulting values
+            # (besides 'Match exec' which was already handled above)
+            options = self._expand_variables(options, hostname)
+        return options
+
+    def canonicalize(self, hostname, options, domains):
+        """
+        Return canonicalized version of ``hostname``.
+
+        :param str hostname: Target hostname.
+        :param options: An `SSHConfigDict` from a previous lookup pass.
+        :param domains: List of domains (e.g. ``["paramiko.org"]``).
+
+        :returns: A canonicalized hostname if one was found, else ``None``.
+
+        .. versionadded:: 2.7
+        """
+        found = False
+        for domain in domains:
+            candidate = "{}.{}".format(hostname, domain)
+            family_specific = _addressfamily_host_lookup(candidate, options)
+            if family_specific is not None:
+                # TODO: would we want to dig deeper into other results? e.g. to
+                # find something that satisfies PermittedCNAMEs when that is
+                # implemented?
+                found = family_specific[0]
+            else:
+                # TODO: what does ssh use here and is there a reason to use
+                # that instead of gethostbyname?
+                try:
+                    found = socket.gethostbyname(candidate)
+                except socket.gaierror:
+                    pass
+            if found:
+                # TODO: follow CNAME (implied by found != candidate?) if
+                # CanonicalizePermittedCNAMEs allows it
+                return candidate
+        # If we got here, it means canonicalization failed.
+        # When CanonicalizeFallbackLocal is undefined or 'yes', we just spit
+        # back the original hostname.
+        if options.get("canonicalizefallbacklocal", "yes") == "yes":
+            return hostname
+        # And here, we failed AND fallback was set to a non-yes value, so we
+        # need to get mad.
+        raise CouldNotCanonicalize(hostname)
+
+    def get_hostnames(self):
+        """
+        Return the set of literal hostnames defined in the SSH config (both
+        explicit hostnames and wildcard entries).
+        """
+        hosts = set()
+        for entry in self._config:
+            hosts.update(entry["host"])
+        return hosts
+
+    def _pattern_matches(self, patterns, target):
+        # Convenience auto-splitter if not already a list
+        if hasattr(patterns, "split"):
+            patterns = patterns.split(",")
+        match = False
+        for pattern in patterns:
+            # Short-circuit if target matches a negated pattern
+            if pattern.startswith("!") and fnmatch.fnmatch(
+                target, pattern[1:]
+            ):
+                return False
+            # Flag a match, but continue (in case of later negation) if regular
+            # match occurs
+            elif fnmatch.fnmatch(target, pattern):
+                match = True
+        return match
+
+    def _does_match(
+        self, match_list, target_hostname, canonical, final, options
+    ):
+        matched = []
+        candidates = match_list[:]
+        local_username = getpass.getuser()
+        while candidates:
+            candidate = candidates.pop(0)
+            passed = None
+            # Obtain latest host/user value every loop, so later Match may
+            # reference values assigned within a prior Match.
+            configured_host = options.get("hostname", None)
+            configured_user = options.get("user", None)
+            type_, param = candidate["type"], candidate["param"]
+            # Canonical is a hard pass/fail based on whether this is a
+            # canonicalized re-lookup.
+            if type_ == "canonical":
+                if self._should_fail(canonical, candidate):
+                    return False
+            if type_ == "final":
+                passed = final
+            # The parse step ensures we only see this by itself or after
+            # canonical, so it's also an easy hard pass. (No negation here as
+            # that would be uh, pretty weird?)
+            elif type_ == "all":
+                return True
+            # From here, we are testing various non-hard criteria,
+            # short-circuiting only on fail
+            elif type_ == "host":
+                hostval = configured_host or target_hostname
+                passed = self._pattern_matches(param, hostval)
+            elif type_ == "originalhost":
+                passed = self._pattern_matches(param, target_hostname)
+            elif type_ == "user":
+                user = configured_user or local_username
+                passed = self._pattern_matches(param, user)
+            elif type_ == "localuser":
+                passed = self._pattern_matches(param, local_username)
+            elif type_ == "exec":
+                exec_cmd = self._tokenize(
+                    options, target_hostname, "match-exec", param
+                )
+                # This is the laziest spot in which we can get mad about an
+                # inability to import Invoke.
+                if invoke is None:
+                    raise invoke_import_error
+                # Like OpenSSH, we 'redirect' stdout but let stderr bubble up
+                passed = invoke.run(exec_cmd, hide="stdout", warn=True).ok
+            # Tackle any 'passed, but was negated' results from above
+            if passed is not None and self._should_fail(passed, candidate):
+                return False
+            # Made it all the way here? Everything matched!
+            matched.append(candidate)
+        # Did anything match? (To be treated as bool, usually.)
+        return matched
+
+    def _should_fail(self, would_pass, candidate):
+        return would_pass if candidate["negate"] else not would_pass
+
+    def _tokenize(self, config, target_hostname, key, value):
+        """
+        Tokenize a string based on current config/hostname data.
+
+        :param config: Current config data.
+        :param target_hostname: Original target connection hostname.
+        :param key: Config key being tokenized (used to filter token list).
+        :param value: Config value being tokenized.
+
+        :returns: The tokenized version of the input ``value`` string.
+        """
+        allowed_tokens = self._allowed_tokens(key)
+        # Short-circuit if no tokenization possible
+        if not allowed_tokens:
+            return value
+        # Obtain potentially configured hostname, for use with %h.
+        # Special-case where we are tokenizing the hostname itself, to avoid
+        # replacing %h with a %h-bearing value, etc.
+        configured_hostname = target_hostname
+        if key != "hostname":
+            configured_hostname = config.get("hostname", configured_hostname)
+        # Ditto the rest of the source values
+        if "port" in config:
+            port = config["port"]
+        else:
+            port = SSH_PORT
+        user = getpass.getuser()
+        if "user" in config:
+            remoteuser = config["user"]
+        else:
+            remoteuser = user
+        local_hostname = socket.gethostname().split(".")[0]
+        local_fqdn = LazyFqdn(config, local_hostname)
+        homedir = os.path.expanduser("~")
+        tohash = local_hostname + target_hostname + repr(port) + remoteuser
+        # The actual tokens!
+        replacements = {
+            # TODO: %%???
+            "%C": sha1(tohash.encode()).hexdigest(),
+            "%d": homedir,
+            "%h": configured_hostname,
+            # TODO: %i?
+            "%L": local_hostname,
+            "%l": local_fqdn,
+            # also this is pseudo buggy when not in Match exec mode so document
+            # that. also WHY is that the case?? don't we do all of this late?
+            "%n": target_hostname,
+            "%p": port,
+            "%r": remoteuser,
+            # TODO: %T? don't believe this is possible however
+            "%u": user,
+            "~": homedir,
+        }
+        # Do the thing with the stuff
+        tokenized = value
+        for find, replace in replacements.items():
+            if find not in allowed_tokens:
+                continue
+            tokenized = tokenized.replace(find, str(replace))
+        # TODO: log? eg that value -> tokenized
+        return tokenized
+
+    def _allowed_tokens(self, key):
+        """
+        Given config ``key``, return list of token strings to tokenize.
+
+        .. note::
+            This feels like it wants to eventually go away, but is used to
+            preserve as-strict-as-possible compatibility with OpenSSH, which
+            for whatever reason only applies some tokens to some config keys.
+        """
+        return self.TOKENS_BY_CONFIG_KEY.get(key, [])
+
+    def _expand_variables(self, config, target_hostname):
+        """
+        Return a dict of config options with expanded substitutions
+        for a given original & current target hostname.
+
+        Please refer to :doc:`/api/config` for details.
+
+        :param dict config: the currently parsed config
+        :param str hostname: the hostname whose config is being looked up
+        """
+        for k in config:
+            if config[k] is None:
+                continue
+            tokenizer = partial(self._tokenize, config, target_hostname, k)
+            if isinstance(config[k], list):
+                for i, value in enumerate(config[k]):
+                    config[k][i] = tokenizer(value)
+            else:
+                config[k] = tokenizer(config[k])
+        return config
+
+    def _get_hosts(self, host):
+        """
+        Return a list of host_names from host value.
+        """
+        try:
+            return shlex.split(host)
+        except ValueError:
+            raise ConfigParseError("Unparsable host {}".format(host))
+
+    def _get_matches(self, match):
+        """
+        Parse a specific Match config line into a list-of-dicts for its values.
+
+        Performs some parse-time validation as well.
+        """
+        matches = []
+        tokens = shlex.split(match)
+        while tokens:
+            match = {"type": None, "param": None, "negate": False}
+            type_ = tokens.pop(0)
+            # Handle per-keyword negation
+            if type_.startswith("!"):
+                match["negate"] = True
+                type_ = type_[1:]
+            match["type"] = type_
+            # all/canonical have no params (everything else does)
+            if type_ in ("all", "canonical", "final"):
+                matches.append(match)
+                continue
+            if not tokens:
+                raise ConfigParseError(
+                    "Missing parameter to Match '{}' keyword".format(type_)
+                )
+            match["param"] = tokens.pop(0)
+            matches.append(match)
+        # Perform some (easier to do now than in the middle) validation that is
+        # better handled here than at lookup time.
+        keywords = [x["type"] for x in matches]
+        if "all" in keywords:
+            allowable = ("all", "canonical")
+            ok, bad = (
+                list(filter(lambda x: x in allowable, keywords)),
+                list(filter(lambda x: x not in allowable, keywords)),
+            )
+            err = None
+            if any(bad):
+                err = "Match does not allow 'all' mixed with anything but 'canonical'"  # noqa
+            elif "canonical" in ok and ok.index("canonical") > ok.index("all"):
+                err = "Match does not allow 'all' before 'canonical'"
+            if err is not None:
+                raise ConfigParseError(err)
+        return matches
+
+
+def _addressfamily_host_lookup(hostname, options):
+    """
+    Try looking up ``hostname`` in an IPv4 or IPv6 specific manner.
+
+    This is an odd duck due to needing use in two divergent use cases. It looks
+    up ``AddressFamily`` in ``options`` and if it is ``inet`` or ``inet6``,
+    this function uses `socket.getaddrinfo` to perform a family-specific
+    lookup, returning the result if successful.
+
+    In any other situation -- lookup failure, or ``AddressFamily`` being
+    unspecified or ``any`` -- ``None`` is returned instead and the caller is
+    expected to do something situation-appropriate like calling
+    `socket.gethostbyname`.
+
+    :param str hostname: Hostname to look up.
+    :param options: `SSHConfigDict` instance w/ parsed options.
+    :returns: ``getaddrinfo``-style tuples, or ``None``, depending.
+    """
+    address_family = options.get("addressfamily", "any").lower()
+    if address_family == "any":
+        return
+    try:
+        family = socket.AF_INET6
+        if address_family == "inet":
+            family = socket.AF_INET
+        return socket.getaddrinfo(
+            hostname,
+            None,
+            family,
+            socket.SOCK_DGRAM,
+            socket.IPPROTO_IP,
+            socket.AI_CANONNAME,
+        )
+    except socket.gaierror:
+        pass
+
+
+class LazyFqdn:
+    """
+    Returns the host's fqdn on request as string.
+    """
+
+    def __init__(self, config, host=None):
+        self.fqdn = None
+        self.config = config
+        self.host = host
+
+    def __str__(self):
+        if self.fqdn is None:
+            #
+            # If the SSH config contains AddressFamily, use that when
+            # determining  the local host's FQDN. Using socket.getfqdn() from
+            # the standard library is the most general solution, but can
+            # result in noticeable delays on some platforms when IPv6 is
+            # misconfigured or not available, as it calls getaddrinfo with no
+            # address family specified, so both IPv4 and IPv6 are checked.
+            #
+
+            # Handle specific option
+            fqdn = None
+            results = _addressfamily_host_lookup(self.host, self.config)
+            if results is not None:
+                for res in results:
+                    af, socktype, proto, canonname, sa = res
+                    if canonname and "." in canonname:
+                        fqdn = canonname
+                        break
+            # Handle 'any' / unspecified / lookup failure
+            if fqdn is None:
+                fqdn = socket.getfqdn()
+            # Cache
+            self.fqdn = fqdn
+        return self.fqdn
+
+
+class SSHConfigDict(dict):
+    """
+    A dictionary wrapper/subclass for per-host configuration structures.
+
+    This class introduces some usage niceties for consumers of `SSHConfig`,
+    specifically around the issue of variable type conversions: normal value
+    access yields strings, but there are now methods such as `as_bool` and
+    `as_int` that yield casted values instead.
+
+    For example, given the following ``ssh_config`` file snippet::
+
+        Host foo.example.com
+            PasswordAuthentication no
+            Compression yes
+            ServerAliveInterval 60
+
+    the following code highlights how you can access the raw strings as well as
+    usefully Python type-casted versions (recalling that keys are all
+    normalized to lowercase first)::
+
+        my_config = SSHConfig()
+        my_config.parse(open('~/.ssh/config'))
+        conf = my_config.lookup('foo.example.com')
+
+        assert conf['passwordauthentication'] == 'no'
+        assert conf.as_bool('passwordauthentication') is False
+        assert conf['compression'] == 'yes'
+        assert conf.as_bool('compression') is True
+        assert conf['serveraliveinterval'] == '60'
+        assert conf.as_int('serveraliveinterval') == 60
+
+    .. versionadded:: 2.5
+    """
+
+    def as_bool(self, key):
+        """
+        Express given key's value as a boolean type.
+
+        Typically, this is used for ``ssh_config``'s pseudo-boolean values
+        which are either ``"yes"`` or ``"no"``. In such cases, ``"yes"`` yields
+        ``True`` and any other value becomes ``False``.
+
+        .. note::
+            If (for whatever reason) the stored value is already boolean in
+            nature, it's simply returned.
+
+        .. versionadded:: 2.5
+        """
+        val = self[key]
+        if isinstance(val, bool):
+            return val
+        return val.lower() == "yes"
+
+    def as_int(self, key):
+        """
+        Express given key's value as an integer, if possible.
+
+        This method will raise ``ValueError`` or similar if the value is not
+        int-appropriate, same as the builtin `int` type.
+
+        .. versionadded:: 2.5
+        """
+        return int(self[key])
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/dsskey.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/dsskey.py
new file mode 100644
index 0000000000000000000000000000000000000000..5215d282f1c88a5b4ffd7177aabd1b5c4b0259a8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/dsskey.py
@@ -0,0 +1,258 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+DSS keys.
+"""
+
+from cryptography.exceptions import InvalidSignature
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import dsa
+from cryptography.hazmat.primitives.asymmetric.utils import (
+    decode_dss_signature,
+    encode_dss_signature,
+)
+
+from paramiko import util
+from paramiko.common import zero_byte
+from paramiko.ssh_exception import SSHException
+from paramiko.message import Message
+from paramiko.ber import BER, BERException
+from paramiko.pkey import PKey
+
+
+class DSSKey(PKey):
+    """
+    Representation of a DSS key which can be used to sign an verify SSH2
+    data.
+    """
+
+    name = "ssh-dss"
+
+    def __init__(
+        self,
+        msg=None,
+        data=None,
+        filename=None,
+        password=None,
+        vals=None,
+        file_obj=None,
+    ):
+        self.p = None
+        self.q = None
+        self.g = None
+        self.y = None
+        self.x = None
+        self.public_blob = None
+        if file_obj is not None:
+            self._from_private_key(file_obj, password)
+            return
+        if filename is not None:
+            self._from_private_key_file(filename, password)
+            return
+        if (msg is None) and (data is not None):
+            msg = Message(data)
+        if vals is not None:
+            self.p, self.q, self.g, self.y = vals
+        else:
+            self._check_type_and_load_cert(
+                msg=msg,
+                key_type=self.name,
+                cert_type=f"{self.name}-cert-v01@openssh.com",
+            )
+            self.p = msg.get_mpint()
+            self.q = msg.get_mpint()
+            self.g = msg.get_mpint()
+            self.y = msg.get_mpint()
+        self.size = util.bit_length(self.p)
+
+    def asbytes(self):
+        m = Message()
+        m.add_string(self.name)
+        m.add_mpint(self.p)
+        m.add_mpint(self.q)
+        m.add_mpint(self.g)
+        m.add_mpint(self.y)
+        return m.asbytes()
+
+    def __str__(self):
+        return self.asbytes()
+
+    @property
+    def _fields(self):
+        return (self.get_name(), self.p, self.q, self.g, self.y)
+
+    # TODO 4.0: remove
+    def get_name(self):
+        return self.name
+
+    def get_bits(self):
+        return self.size
+
+    def can_sign(self):
+        return self.x is not None
+
+    def sign_ssh_data(self, data, algorithm=None):
+        key = dsa.DSAPrivateNumbers(
+            x=self.x,
+            public_numbers=dsa.DSAPublicNumbers(
+                y=self.y,
+                parameter_numbers=dsa.DSAParameterNumbers(
+                    p=self.p, q=self.q, g=self.g
+                ),
+            ),
+        ).private_key(backend=default_backend())
+        sig = key.sign(data, hashes.SHA1())
+        r, s = decode_dss_signature(sig)
+
+        m = Message()
+        m.add_string(self.name)
+        # apparently, in rare cases, r or s may be shorter than 20 bytes!
+        rstr = util.deflate_long(r, 0)
+        sstr = util.deflate_long(s, 0)
+        if len(rstr) < 20:
+            rstr = zero_byte * (20 - len(rstr)) + rstr
+        if len(sstr) < 20:
+            sstr = zero_byte * (20 - len(sstr)) + sstr
+        m.add_string(rstr + sstr)
+        return m
+
+    def verify_ssh_sig(self, data, msg):
+        if len(msg.asbytes()) == 40:
+            # spies.com bug: signature has no header
+            sig = msg.asbytes()
+        else:
+            kind = msg.get_text()
+            if kind != self.name:
+                return 0
+            sig = msg.get_binary()
+
+        # pull out (r, s) which are NOT encoded as mpints
+        sigR = util.inflate_long(sig[:20], 1)
+        sigS = util.inflate_long(sig[20:], 1)
+
+        signature = encode_dss_signature(sigR, sigS)
+
+        key = dsa.DSAPublicNumbers(
+            y=self.y,
+            parameter_numbers=dsa.DSAParameterNumbers(
+                p=self.p, q=self.q, g=self.g
+            ),
+        ).public_key(backend=default_backend())
+        try:
+            key.verify(signature, data, hashes.SHA1())
+        except InvalidSignature:
+            return False
+        else:
+            return True
+
+    def write_private_key_file(self, filename, password=None):
+        key = dsa.DSAPrivateNumbers(
+            x=self.x,
+            public_numbers=dsa.DSAPublicNumbers(
+                y=self.y,
+                parameter_numbers=dsa.DSAParameterNumbers(
+                    p=self.p, q=self.q, g=self.g
+                ),
+            ),
+        ).private_key(backend=default_backend())
+
+        self._write_private_key_file(
+            filename,
+            key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    def write_private_key(self, file_obj, password=None):
+        key = dsa.DSAPrivateNumbers(
+            x=self.x,
+            public_numbers=dsa.DSAPublicNumbers(
+                y=self.y,
+                parameter_numbers=dsa.DSAParameterNumbers(
+                    p=self.p, q=self.q, g=self.g
+                ),
+            ),
+        ).private_key(backend=default_backend())
+
+        self._write_private_key(
+            file_obj,
+            key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    @staticmethod
+    def generate(bits=1024, progress_func=None):
+        """
+        Generate a new private DSS key.  This factory function can be used to
+        generate a new host key or authentication key.
+
+        :param int bits: number of bits the generated key should be.
+        :param progress_func: Unused
+        :return: new `.DSSKey` private key
+        """
+        numbers = dsa.generate_private_key(
+            bits, backend=default_backend()
+        ).private_numbers()
+        key = DSSKey(
+            vals=(
+                numbers.public_numbers.parameter_numbers.p,
+                numbers.public_numbers.parameter_numbers.q,
+                numbers.public_numbers.parameter_numbers.g,
+                numbers.public_numbers.y,
+            )
+        )
+        key.x = numbers.x
+        return key
+
+    # ...internals...
+
+    def _from_private_key_file(self, filename, password):
+        data = self._read_private_key_file("DSA", filename, password)
+        self._decode_key(data)
+
+    def _from_private_key(self, file_obj, password):
+        data = self._read_private_key("DSA", file_obj, password)
+        self._decode_key(data)
+
+    def _decode_key(self, data):
+        pkformat, data = data
+        # private key file contains:
+        # DSAPrivateKey = { version = 0, p, q, g, y, x }
+        if pkformat == self._PRIVATE_KEY_FORMAT_ORIGINAL:
+            try:
+                keylist = BER(data).decode()
+            except BERException as e:
+                raise SSHException("Unable to parse key file: {}".format(e))
+        elif pkformat == self._PRIVATE_KEY_FORMAT_OPENSSH:
+            keylist = self._uint32_cstruct_unpack(data, "iiiii")
+            keylist = [0] + list(keylist)
+        else:
+            self._got_bad_key_format_id(pkformat)
+        if type(keylist) is not list or len(keylist) < 6 or keylist[0] != 0:
+            raise SSHException(
+                "not a valid DSA private key file (bad ber encoding)"
+            )
+        self.p = keylist[1]
+        self.q = keylist[2]
+        self.g = keylist[3]
+        self.y = keylist[4]
+        self.x = keylist[5]
+        self.size = util.bit_length(self.p)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/ecdsakey.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/ecdsakey.py
new file mode 100644
index 0000000000000000000000000000000000000000..6fd95fab8e30ff08d76aa8ea01951331d6264f03
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/ecdsakey.py
@@ -0,0 +1,339 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+ECDSA keys
+"""
+
+from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import ec
+from cryptography.hazmat.primitives.asymmetric.utils import (
+    decode_dss_signature,
+    encode_dss_signature,
+)
+
+from paramiko.common import four_byte
+from paramiko.message import Message
+from paramiko.pkey import PKey
+from paramiko.ssh_exception import SSHException
+from paramiko.util import deflate_long
+
+
+class _ECDSACurve:
+    """
+    Represents a specific ECDSA Curve (nistp256, nistp384, etc).
+
+    Handles the generation of the key format identifier and the selection of
+    the proper hash function. Also grabs the proper curve from the 'ecdsa'
+    package.
+    """
+
+    def __init__(self, curve_class, nist_name):
+        self.nist_name = nist_name
+        self.key_length = curve_class.key_size
+
+        # Defined in RFC 5656 6.2
+        self.key_format_identifier = "ecdsa-sha2-" + self.nist_name
+
+        # Defined in RFC 5656 6.2.1
+        if self.key_length <= 256:
+            self.hash_object = hashes.SHA256
+        elif self.key_length <= 384:
+            self.hash_object = hashes.SHA384
+        else:
+            self.hash_object = hashes.SHA512
+
+        self.curve_class = curve_class
+
+
+class _ECDSACurveSet:
+    """
+    A collection to hold the ECDSA curves. Allows querying by oid and by key
+    format identifier. The two ways in which ECDSAKey needs to be able to look
+    up curves.
+    """
+
+    def __init__(self, ecdsa_curves):
+        self.ecdsa_curves = ecdsa_curves
+
+    def get_key_format_identifier_list(self):
+        return [curve.key_format_identifier for curve in self.ecdsa_curves]
+
+    def get_by_curve_class(self, curve_class):
+        for curve in self.ecdsa_curves:
+            if curve.curve_class == curve_class:
+                return curve
+
+    def get_by_key_format_identifier(self, key_format_identifier):
+        for curve in self.ecdsa_curves:
+            if curve.key_format_identifier == key_format_identifier:
+                return curve
+
+    def get_by_key_length(self, key_length):
+        for curve in self.ecdsa_curves:
+            if curve.key_length == key_length:
+                return curve
+
+
+class ECDSAKey(PKey):
+    """
+    Representation of an ECDSA key which can be used to sign and verify SSH2
+    data.
+    """
+
+    _ECDSA_CURVES = _ECDSACurveSet(
+        [
+            _ECDSACurve(ec.SECP256R1, "nistp256"),
+            _ECDSACurve(ec.SECP384R1, "nistp384"),
+            _ECDSACurve(ec.SECP521R1, "nistp521"),
+        ]
+    )
+
+    def __init__(
+        self,
+        msg=None,
+        data=None,
+        filename=None,
+        password=None,
+        vals=None,
+        file_obj=None,
+        # TODO 4.0: remove; it does nothing since porting to cryptography.io
+        validate_point=True,
+    ):
+        self.verifying_key = None
+        self.signing_key = None
+        self.public_blob = None
+        if file_obj is not None:
+            self._from_private_key(file_obj, password)
+            return
+        if filename is not None:
+            self._from_private_key_file(filename, password)
+            return
+        if (msg is None) and (data is not None):
+            msg = Message(data)
+        if vals is not None:
+            self.signing_key, self.verifying_key = vals
+            c_class = self.signing_key.curve.__class__
+            self.ecdsa_curve = self._ECDSA_CURVES.get_by_curve_class(c_class)
+        else:
+            # Must set ecdsa_curve first; subroutines called herein may need to
+            # spit out our get_name(), which relies on this.
+            key_type = msg.get_text()
+            # But this also means we need to hand it a real key/curve
+            # identifier, so strip out any cert business. (NOTE: could push
+            # that into _ECDSACurveSet.get_by_key_format_identifier(), but it
+            # feels more correct to do it here?)
+            suffix = "-cert-v01@openssh.com"
+            if key_type.endswith(suffix):
+                key_type = key_type[: -len(suffix)]
+            self.ecdsa_curve = self._ECDSA_CURVES.get_by_key_format_identifier(
+                key_type
+            )
+            key_types = self._ECDSA_CURVES.get_key_format_identifier_list()
+            cert_types = [
+                "{}-cert-v01@openssh.com".format(x) for x in key_types
+            ]
+            self._check_type_and_load_cert(
+                msg=msg, key_type=key_types, cert_type=cert_types
+            )
+            curvename = msg.get_text()
+            if curvename != self.ecdsa_curve.nist_name:
+                raise SSHException(
+                    "Can't handle curve of type {}".format(curvename)
+                )
+
+            pointinfo = msg.get_binary()
+            try:
+                key = ec.EllipticCurvePublicKey.from_encoded_point(
+                    self.ecdsa_curve.curve_class(), pointinfo
+                )
+                self.verifying_key = key
+            except ValueError:
+                raise SSHException("Invalid public key")
+
+    @classmethod
+    def identifiers(cls):
+        return cls._ECDSA_CURVES.get_key_format_identifier_list()
+
+    # TODO 4.0: deprecate/remove
+    @classmethod
+    def supported_key_format_identifiers(cls):
+        return cls.identifiers()
+
+    def asbytes(self):
+        key = self.verifying_key
+        m = Message()
+        m.add_string(self.ecdsa_curve.key_format_identifier)
+        m.add_string(self.ecdsa_curve.nist_name)
+
+        numbers = key.public_numbers()
+
+        key_size_bytes = (key.curve.key_size + 7) // 8
+
+        x_bytes = deflate_long(numbers.x, add_sign_padding=False)
+        x_bytes = b"\x00" * (key_size_bytes - len(x_bytes)) + x_bytes
+
+        y_bytes = deflate_long(numbers.y, add_sign_padding=False)
+        y_bytes = b"\x00" * (key_size_bytes - len(y_bytes)) + y_bytes
+
+        point_str = four_byte + x_bytes + y_bytes
+        m.add_string(point_str)
+        return m.asbytes()
+
+    def __str__(self):
+        return self.asbytes()
+
+    @property
+    def _fields(self):
+        return (
+            self.get_name(),
+            self.verifying_key.public_numbers().x,
+            self.verifying_key.public_numbers().y,
+        )
+
+    def get_name(self):
+        return self.ecdsa_curve.key_format_identifier
+
+    def get_bits(self):
+        return self.ecdsa_curve.key_length
+
+    def can_sign(self):
+        return self.signing_key is not None
+
+    def sign_ssh_data(self, data, algorithm=None):
+        ecdsa = ec.ECDSA(self.ecdsa_curve.hash_object())
+        sig = self.signing_key.sign(data, ecdsa)
+        r, s = decode_dss_signature(sig)
+
+        m = Message()
+        m.add_string(self.ecdsa_curve.key_format_identifier)
+        m.add_string(self._sigencode(r, s))
+        return m
+
+    def verify_ssh_sig(self, data, msg):
+        if msg.get_text() != self.ecdsa_curve.key_format_identifier:
+            return False
+        sig = msg.get_binary()
+        sigR, sigS = self._sigdecode(sig)
+        signature = encode_dss_signature(sigR, sigS)
+
+        try:
+            self.verifying_key.verify(
+                signature, data, ec.ECDSA(self.ecdsa_curve.hash_object())
+            )
+        except InvalidSignature:
+            return False
+        else:
+            return True
+
+    def write_private_key_file(self, filename, password=None):
+        self._write_private_key_file(
+            filename,
+            self.signing_key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    def write_private_key(self, file_obj, password=None):
+        self._write_private_key(
+            file_obj,
+            self.signing_key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    @classmethod
+    def generate(cls, curve=ec.SECP256R1(), progress_func=None, bits=None):
+        """
+        Generate a new private ECDSA key.  This factory function can be used to
+        generate a new host key or authentication key.
+
+        :param progress_func: Not used for this type of key.
+        :returns: A new private key (`.ECDSAKey`) object
+        """
+        if bits is not None:
+            curve = cls._ECDSA_CURVES.get_by_key_length(bits)
+            if curve is None:
+                raise ValueError("Unsupported key length: {:d}".format(bits))
+            curve = curve.curve_class()
+
+        private_key = ec.generate_private_key(curve, backend=default_backend())
+        return ECDSAKey(vals=(private_key, private_key.public_key()))
+
+    # ...internals...
+
+    def _from_private_key_file(self, filename, password):
+        data = self._read_private_key_file("EC", filename, password)
+        self._decode_key(data)
+
+    def _from_private_key(self, file_obj, password):
+        data = self._read_private_key("EC", file_obj, password)
+        self._decode_key(data)
+
+    def _decode_key(self, data):
+        pkformat, data = data
+        if pkformat == self._PRIVATE_KEY_FORMAT_ORIGINAL:
+            try:
+                key = serialization.load_der_private_key(
+                    data, password=None, backend=default_backend()
+                )
+            except (
+                ValueError,
+                AssertionError,
+                TypeError,
+                UnsupportedAlgorithm,
+            ) as e:
+                raise SSHException(str(e))
+        elif pkformat == self._PRIVATE_KEY_FORMAT_OPENSSH:
+            try:
+                msg = Message(data)
+                curve_name = msg.get_text()
+                verkey = msg.get_binary()  # noqa: F841
+                sigkey = msg.get_mpint()
+                name = "ecdsa-sha2-" + curve_name
+                curve = self._ECDSA_CURVES.get_by_key_format_identifier(name)
+                if not curve:
+                    raise SSHException("Invalid key curve identifier")
+                key = ec.derive_private_key(
+                    sigkey, curve.curve_class(), default_backend()
+                )
+            except Exception as e:
+                # PKey._read_private_key_openssh() should check or return
+                # keytype - parsing could fail for any reason due to wrong type
+                raise SSHException(str(e))
+        else:
+            self._got_bad_key_format_id(pkformat)
+
+        self.signing_key = key
+        self.verifying_key = key.public_key()
+        curve_class = key.curve.__class__
+        self.ecdsa_curve = self._ECDSA_CURVES.get_by_curve_class(curve_class)
+
+    def _sigencode(self, r, s):
+        msg = Message()
+        msg.add_mpint(r)
+        msg.add_mpint(s)
+        return msg.asbytes()
+
+    def _sigdecode(self, sig):
+        msg = Message(sig)
+        r = msg.get_mpint()
+        s = msg.get_mpint()
+        return r, s
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/ed25519key.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/ed25519key.py
new file mode 100644
index 0000000000000000000000000000000000000000..e5e81ac51cef74413eb0c58ca008fbacf03eccda
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/ed25519key.py
@@ -0,0 +1,212 @@
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+import bcrypt
+
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives.ciphers import Cipher
+
+import nacl.signing
+
+from paramiko.message import Message
+from paramiko.pkey import PKey, OPENSSH_AUTH_MAGIC, _unpad_openssh
+from paramiko.util import b
+from paramiko.ssh_exception import SSHException, PasswordRequiredException
+
+
+class Ed25519Key(PKey):
+    """
+    Representation of an `Ed25519 <https://ed25519.cr.yp.to/>`_ key.
+
+    .. note::
+        Ed25519 key support was added to OpenSSH in version 6.5.
+
+    .. versionadded:: 2.2
+    .. versionchanged:: 2.3
+        Added a ``file_obj`` parameter to match other key classes.
+    """
+
+    name = "ssh-ed25519"
+
+    def __init__(
+        self, msg=None, data=None, filename=None, password=None, file_obj=None
+    ):
+        self.public_blob = None
+        verifying_key = signing_key = None
+        if msg is None and data is not None:
+            msg = Message(data)
+        if msg is not None:
+            self._check_type_and_load_cert(
+                msg=msg,
+                key_type=self.name,
+                cert_type="ssh-ed25519-cert-v01@openssh.com",
+            )
+            verifying_key = nacl.signing.VerifyKey(msg.get_binary())
+        elif filename is not None:
+            with open(filename, "r") as f:
+                pkformat, data = self._read_private_key("OPENSSH", f)
+        elif file_obj is not None:
+            pkformat, data = self._read_private_key("OPENSSH", file_obj)
+
+        if filename or file_obj:
+            signing_key = self._parse_signing_key_data(data, password)
+
+        if signing_key is None and verifying_key is None:
+            raise ValueError("need a key")
+
+        self._signing_key = signing_key
+        self._verifying_key = verifying_key
+
+    def _parse_signing_key_data(self, data, password):
+        from paramiko.transport import Transport
+
+        # We may eventually want this to be usable for other key types, as
+        # OpenSSH moves to it, but for now this is just for Ed25519 keys.
+        # This format is described here:
+        # https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
+        # The description isn't totally complete, and I had to refer to the
+        # source for a full implementation.
+        message = Message(data)
+        if message.get_bytes(len(OPENSSH_AUTH_MAGIC)) != OPENSSH_AUTH_MAGIC:
+            raise SSHException("Invalid key")
+
+        ciphername = message.get_text()
+        kdfname = message.get_text()
+        kdfoptions = message.get_binary()
+        num_keys = message.get_int()
+
+        if kdfname == "none":
+            # kdfname of "none" must have an empty kdfoptions, the ciphername
+            # must be "none"
+            if kdfoptions or ciphername != "none":
+                raise SSHException("Invalid key")
+        elif kdfname == "bcrypt":
+            if not password:
+                raise PasswordRequiredException(
+                    "Private key file is encrypted"
+                )
+            kdf = Message(kdfoptions)
+            bcrypt_salt = kdf.get_binary()
+            bcrypt_rounds = kdf.get_int()
+        else:
+            raise SSHException("Invalid key")
+
+        if ciphername != "none" and ciphername not in Transport._cipher_info:
+            raise SSHException("Invalid key")
+
+        public_keys = []
+        for _ in range(num_keys):
+            pubkey = Message(message.get_binary())
+            if pubkey.get_text() != self.name:
+                raise SSHException("Invalid key")
+            public_keys.append(pubkey.get_binary())
+
+        private_ciphertext = message.get_binary()
+        if ciphername == "none":
+            private_data = private_ciphertext
+        else:
+            cipher = Transport._cipher_info[ciphername]
+            key = bcrypt.kdf(
+                password=b(password),
+                salt=bcrypt_salt,
+                desired_key_bytes=cipher["key-size"] + cipher["block-size"],
+                rounds=bcrypt_rounds,
+                # We can't control how many rounds are on disk, so no sense
+                # warning about it.
+                ignore_few_rounds=True,
+            )
+            decryptor = Cipher(
+                cipher["class"](key[: cipher["key-size"]]),
+                cipher["mode"](key[cipher["key-size"] :]),
+                backend=default_backend(),
+            ).decryptor()
+            private_data = (
+                decryptor.update(private_ciphertext) + decryptor.finalize()
+            )
+
+        message = Message(_unpad_openssh(private_data))
+        if message.get_int() != message.get_int():
+            raise SSHException("Invalid key")
+
+        signing_keys = []
+        for i in range(num_keys):
+            if message.get_text() != self.name:
+                raise SSHException("Invalid key")
+            # A copy of the public key, again, ignore.
+            public = message.get_binary()
+            key_data = message.get_binary()
+            # The second half of the key data is yet another copy of the public
+            # key...
+            signing_key = nacl.signing.SigningKey(key_data[:32])
+            # Verify that all the public keys are the same...
+            assert (
+                signing_key.verify_key.encode()
+                == public
+                == public_keys[i]
+                == key_data[32:]
+            )
+            signing_keys.append(signing_key)
+            # Comment, ignore.
+            message.get_binary()
+
+        if len(signing_keys) != 1:
+            raise SSHException("Invalid key")
+        return signing_keys[0]
+
+    def asbytes(self):
+        if self.can_sign():
+            v = self._signing_key.verify_key
+        else:
+            v = self._verifying_key
+        m = Message()
+        m.add_string(self.name)
+        m.add_string(v.encode())
+        return m.asbytes()
+
+    @property
+    def _fields(self):
+        if self.can_sign():
+            v = self._signing_key.verify_key
+        else:
+            v = self._verifying_key
+        return (self.get_name(), v)
+
+    # TODO 4.0: remove
+    def get_name(self):
+        return self.name
+
+    def get_bits(self):
+        return 256
+
+    def can_sign(self):
+        return self._signing_key is not None
+
+    def sign_ssh_data(self, data, algorithm=None):
+        m = Message()
+        m.add_string(self.name)
+        m.add_string(self._signing_key.sign(data).signature)
+        return m
+
+    def verify_ssh_sig(self, data, msg):
+        if msg.get_text() != self.name:
+            return False
+
+        try:
+            self._verifying_key.verify(data, msg.get_binary())
+        except nacl.exceptions.BadSignatureError:
+            return False
+        else:
+            return True
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/file.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/file.py
new file mode 100644
index 0000000000000000000000000000000000000000..a36abb988e9a1773064743f1c459052570ae5d3a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/file.py
@@ -0,0 +1,528 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+from io import BytesIO
+
+from paramiko.common import (
+    linefeed_byte_value,
+    crlf,
+    cr_byte,
+    linefeed_byte,
+    cr_byte_value,
+)
+
+from paramiko.util import ClosingContextManager, u
+
+
+class BufferedFile(ClosingContextManager):
+    """
+    Reusable base class to implement Python-style file buffering around a
+    simpler stream.
+    """
+
+    _DEFAULT_BUFSIZE = 8192
+
+    SEEK_SET = 0
+    SEEK_CUR = 1
+    SEEK_END = 2
+
+    FLAG_READ = 0x1
+    FLAG_WRITE = 0x2
+    FLAG_APPEND = 0x4
+    FLAG_BINARY = 0x10
+    FLAG_BUFFERED = 0x20
+    FLAG_LINE_BUFFERED = 0x40
+    FLAG_UNIVERSAL_NEWLINE = 0x80
+
+    def __init__(self):
+        self.newlines = None
+        self._flags = 0
+        self._bufsize = self._DEFAULT_BUFSIZE
+        self._wbuffer = BytesIO()
+        self._rbuffer = bytes()
+        self._at_trailing_cr = False
+        self._closed = False
+        # pos - position within the file, according to the user
+        # realpos - position according the OS
+        # (these may be different because we buffer for line reading)
+        self._pos = self._realpos = 0
+        # size only matters for seekable files
+        self._size = 0
+
+    def __del__(self):
+        self.close()
+
+    def __iter__(self):
+        """
+        Returns an iterator that can be used to iterate over the lines in this
+        file.  This iterator happens to return the file itself, since a file is
+        its own iterator.
+
+        :raises: ``ValueError`` -- if the file is closed.
+        """
+        if self._closed:
+            raise ValueError("I/O operation on closed file")
+        return self
+
+    def close(self):
+        """
+        Close the file.  Future read and write operations will fail.
+        """
+        self.flush()
+        self._closed = True
+
+    def flush(self):
+        """
+        Write out any data in the write buffer.  This may do nothing if write
+        buffering is not turned on.
+        """
+        self._write_all(self._wbuffer.getvalue())
+        self._wbuffer = BytesIO()
+        return
+
+    def __next__(self):
+        """
+        Returns the next line from the input, or raises ``StopIteration``
+        when EOF is hit.  Unlike python file objects, it's okay to mix
+        calls to `.next` and `.readline`.
+
+        :raises: ``StopIteration`` -- when the end of the file is reached.
+
+        :returns:
+            a line (`str`, or `bytes` if the file was opened in binary mode)
+            read from the file.
+        """
+        line = self.readline()
+        if not line:
+            raise StopIteration
+        return line
+
+    def readable(self):
+        """
+        Check if the file can be read from.
+
+        :returns:
+            `True` if the file can be read from. If `False`, `read` will raise
+            an exception.
+        """
+        return (self._flags & self.FLAG_READ) == self.FLAG_READ
+
+    def writable(self):
+        """
+        Check if the file can be written to.
+
+        :returns:
+            `True` if the file can be written to. If `False`, `write` will
+            raise an exception.
+        """
+        return (self._flags & self.FLAG_WRITE) == self.FLAG_WRITE
+
+    def seekable(self):
+        """
+        Check if the file supports random access.
+
+        :returns:
+            `True` if the file supports random access. If `False`, `seek` will
+            raise an exception.
+        """
+        return False
+
+    def readinto(self, buff):
+        """
+        Read up to ``len(buff)`` bytes into ``bytearray`` *buff* and return the
+        number of bytes read.
+
+        :returns:
+            The number of bytes read.
+        """
+        data = self.read(len(buff))
+        buff[: len(data)] = data
+        return len(data)
+
+    def read(self, size=None):
+        """
+        Read at most ``size`` bytes from the file (less if we hit the end of
+        the file first).  If the ``size`` argument is negative or omitted,
+        read all the remaining data in the file.
+
+        .. note::
+            ``'b'`` mode flag is ignored (``self.FLAG_BINARY`` in
+            ``self._flags``), because SSH treats all files as binary, since we
+            have no idea what encoding the file is in, or even if the file is
+            text data.
+
+        :param int size: maximum number of bytes to read
+        :returns:
+            data read from the file (as bytes), or an empty string if EOF was
+            encountered immediately
+        """
+        if self._closed:
+            raise IOError("File is closed")
+        if not (self._flags & self.FLAG_READ):
+            raise IOError("File is not open for reading")
+        if (size is None) or (size < 0):
+            # go for broke
+            result = bytearray(self._rbuffer)
+            self._rbuffer = bytes()
+            self._pos += len(result)
+            while True:
+                try:
+                    new_data = self._read(self._DEFAULT_BUFSIZE)
+                except EOFError:
+                    new_data = None
+                if (new_data is None) or (len(new_data) == 0):
+                    break
+                result.extend(new_data)
+                self._realpos += len(new_data)
+                self._pos += len(new_data)
+            return bytes(result)
+        if size <= len(self._rbuffer):
+            result = self._rbuffer[:size]
+            self._rbuffer = self._rbuffer[size:]
+            self._pos += len(result)
+            return result
+        while len(self._rbuffer) < size:
+            read_size = size - len(self._rbuffer)
+            if self._flags & self.FLAG_BUFFERED:
+                read_size = max(self._bufsize, read_size)
+            try:
+                new_data = self._read(read_size)
+            except EOFError:
+                new_data = None
+            if (new_data is None) or (len(new_data) == 0):
+                break
+            self._rbuffer += new_data
+            self._realpos += len(new_data)
+        result = self._rbuffer[:size]
+        self._rbuffer = self._rbuffer[size:]
+        self._pos += len(result)
+        return result
+
+    def readline(self, size=None):
+        """
+        Read one entire line from the file.  A trailing newline character is
+        kept in the string (but may be absent when a file ends with an
+        incomplete line).  If the size argument is present and non-negative, it
+        is a maximum byte count (including the trailing newline) and an
+        incomplete line may be returned.  An empty string is returned only when
+        EOF is encountered immediately.
+
+        .. note::
+            Unlike stdio's ``fgets``, the returned string contains null
+            characters (``'\\0'``) if they occurred in the input.
+
+        :param int size: maximum length of returned string.
+        :returns:
+            next line of the file, or an empty string if the end of the
+            file has been reached.
+
+            If the file was opened in binary (``'b'``) mode: bytes are returned
+            Else: the encoding of the file is assumed to be UTF-8 and character
+            strings (`str`) are returned
+        """
+        # it's almost silly how complex this function is.
+        if self._closed:
+            raise IOError("File is closed")
+        if not (self._flags & self.FLAG_READ):
+            raise IOError("File not open for reading")
+        line = self._rbuffer
+        truncated = False
+        while True:
+            if (
+                self._at_trailing_cr
+                and self._flags & self.FLAG_UNIVERSAL_NEWLINE
+                and len(line) > 0
+            ):
+                # edge case: the newline may be '\r\n' and we may have read
+                # only the first '\r' last time.
+                if line[0] == linefeed_byte_value:
+                    line = line[1:]
+                    self._record_newline(crlf)
+                else:
+                    self._record_newline(cr_byte)
+                self._at_trailing_cr = False
+            # check size before looking for a linefeed, in case we already have
+            # enough.
+            if (size is not None) and (size >= 0):
+                if len(line) >= size:
+                    # truncate line
+                    self._rbuffer = line[size:]
+                    line = line[:size]
+                    truncated = True
+                    break
+                n = size - len(line)
+            else:
+                n = self._bufsize
+            if linefeed_byte in line or (
+                self._flags & self.FLAG_UNIVERSAL_NEWLINE and cr_byte in line
+            ):
+                break
+            try:
+                new_data = self._read(n)
+            except EOFError:
+                new_data = None
+            if (new_data is None) or (len(new_data) == 0):
+                self._rbuffer = bytes()
+                self._pos += len(line)
+                return line if self._flags & self.FLAG_BINARY else u(line)
+            line += new_data
+            self._realpos += len(new_data)
+        # find the newline
+        pos = line.find(linefeed_byte)
+        if self._flags & self.FLAG_UNIVERSAL_NEWLINE:
+            rpos = line.find(cr_byte)
+            if (rpos >= 0) and (rpos < pos or pos < 0):
+                pos = rpos
+        if pos == -1:
+            # we couldn't find a newline in the truncated string, return it
+            self._pos += len(line)
+            return line if self._flags & self.FLAG_BINARY else u(line)
+        xpos = pos + 1
+        if (
+            line[pos] == cr_byte_value
+            and xpos < len(line)
+            and line[xpos] == linefeed_byte_value
+        ):
+            xpos += 1
+        # if the string was truncated, _rbuffer needs to have the string after
+        # the newline character plus the truncated part of the line we stored
+        # earlier in _rbuffer
+        if truncated:
+            self._rbuffer = line[xpos:] + self._rbuffer
+        else:
+            self._rbuffer = line[xpos:]
+
+        lf = line[pos:xpos]
+        line = line[:pos] + linefeed_byte
+        if (len(self._rbuffer) == 0) and (lf == cr_byte):
+            # we could read the line up to a '\r' and there could still be a
+            # '\n' following that we read next time.  note that and eat it.
+            self._at_trailing_cr = True
+        else:
+            self._record_newline(lf)
+        self._pos += len(line)
+        return line if self._flags & self.FLAG_BINARY else u(line)
+
+    def readlines(self, sizehint=None):
+        """
+        Read all remaining lines using `readline` and return them as a list.
+        If the optional ``sizehint`` argument is present, instead of reading up
+        to EOF, whole lines totalling approximately sizehint bytes (possibly
+        after rounding up to an internal buffer size) are read.
+
+        :param int sizehint: desired maximum number of bytes to read.
+        :returns: list of lines read from the file.
+        """
+        lines = []
+        byte_count = 0
+        while True:
+            line = self.readline()
+            if len(line) == 0:
+                break
+            lines.append(line)
+            byte_count += len(line)
+            if (sizehint is not None) and (byte_count >= sizehint):
+                break
+        return lines
+
+    def seek(self, offset, whence=0):
+        """
+        Set the file's current position, like stdio's ``fseek``.  Not all file
+        objects support seeking.
+
+        .. note::
+            If a file is opened in append mode (``'a'`` or ``'a+'``), any seek
+            operations will be undone at the next write (as the file position
+            will move back to the end of the file).
+
+        :param int offset:
+            position to move to within the file, relative to ``whence``.
+        :param int whence:
+            type of movement: 0 = absolute; 1 = relative to the current
+            position; 2 = relative to the end of the file.
+
+        :raises: ``IOError`` -- if the file doesn't support random access.
+        """
+        raise IOError("File does not support seeking.")
+
+    def tell(self):
+        """
+        Return the file's current position.  This may not be accurate or
+        useful if the underlying file doesn't support random access, or was
+        opened in append mode.
+
+        :returns: file position (`number <int>` of bytes).
+        """
+        return self._pos
+
+    def write(self, data):
+        """
+        Write data to the file.  If write buffering is on (``bufsize`` was
+        specified and non-zero), some or all of the data may not actually be
+        written yet.  (Use `flush` or `close` to force buffered data to be
+        written out.)
+
+        :param data: ``str``/``bytes`` data to write
+        """
+        if isinstance(data, str):
+            # Accept text and encode as utf-8 for compatibility only.
+            data = data.encode("utf-8")
+        if self._closed:
+            raise IOError("File is closed")
+        if not (self._flags & self.FLAG_WRITE):
+            raise IOError("File not open for writing")
+        if not (self._flags & self.FLAG_BUFFERED):
+            self._write_all(data)
+            return
+        self._wbuffer.write(data)
+        if self._flags & self.FLAG_LINE_BUFFERED:
+            # only scan the new data for linefeed, to avoid wasting time.
+            last_newline_pos = data.rfind(linefeed_byte)
+            if last_newline_pos >= 0:
+                wbuf = self._wbuffer.getvalue()
+                last_newline_pos += len(wbuf) - len(data)
+                self._write_all(wbuf[: last_newline_pos + 1])
+                self._wbuffer = BytesIO()
+                self._wbuffer.write(wbuf[last_newline_pos + 1 :])
+            return
+        # even if we're line buffering, if the buffer has grown past the
+        # buffer size, force a flush.
+        if self._wbuffer.tell() >= self._bufsize:
+            self.flush()
+        return
+
+    def writelines(self, sequence):
+        """
+        Write a sequence of strings to the file.  The sequence can be any
+        iterable object producing strings, typically a list of strings.  (The
+        name is intended to match `readlines`; `writelines` does not add line
+        separators.)
+
+        :param sequence: an iterable sequence of strings.
+        """
+        for line in sequence:
+            self.write(line)
+        return
+
+    def xreadlines(self):
+        """
+        Identical to ``iter(f)``.  This is a deprecated file interface that
+        predates Python iterator support.
+        """
+        return self
+
+    @property
+    def closed(self):
+        return self._closed
+
+    # ...overrides...
+
+    def _read(self, size):
+        """
+        (subclass override)
+        Read data from the stream.  Return ``None`` or raise ``EOFError`` to
+        indicate EOF.
+        """
+        raise EOFError()
+
+    def _write(self, data):
+        """
+        (subclass override)
+        Write data into the stream.
+        """
+        raise IOError("write not implemented")
+
+    def _get_size(self):
+        """
+        (subclass override)
+        Return the size of the file.  This is called from within `_set_mode`
+        if the file is opened in append mode, so the file position can be
+        tracked and `seek` and `tell` will work correctly.  If the file is
+        a stream that can't be randomly accessed, you don't need to override
+        this method,
+        """
+        return 0
+
+    # ...internals...
+
+    def _set_mode(self, mode="r", bufsize=-1):
+        """
+        Subclasses call this method to initialize the BufferedFile.
+        """
+        # set bufsize in any event, because it's used for readline().
+        self._bufsize = self._DEFAULT_BUFSIZE
+        if bufsize < 0:
+            # do no buffering by default, because otherwise writes will get
+            # buffered in a way that will probably confuse people.
+            bufsize = 0
+        if bufsize == 1:
+            # apparently, line buffering only affects writes.  reads are only
+            # buffered if you call readline (directly or indirectly: iterating
+            # over a file will indirectly call readline).
+            self._flags |= self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED
+        elif bufsize > 1:
+            self._bufsize = bufsize
+            self._flags |= self.FLAG_BUFFERED
+            self._flags &= ~self.FLAG_LINE_BUFFERED
+        elif bufsize == 0:
+            # unbuffered
+            self._flags &= ~(self.FLAG_BUFFERED | self.FLAG_LINE_BUFFERED)
+
+        if ("r" in mode) or ("+" in mode):
+            self._flags |= self.FLAG_READ
+        if ("w" in mode) or ("+" in mode):
+            self._flags |= self.FLAG_WRITE
+        if "a" in mode:
+            self._flags |= self.FLAG_WRITE | self.FLAG_APPEND
+            self._size = self._get_size()
+            self._pos = self._realpos = self._size
+        if "b" in mode:
+            self._flags |= self.FLAG_BINARY
+        if "U" in mode:
+            self._flags |= self.FLAG_UNIVERSAL_NEWLINE
+            # built-in file objects have this attribute to store which kinds of
+            # line terminations they've seen:
+            # <http://www.python.org/doc/current/lib/built-in-funcs.html>
+            self.newlines = None
+
+    def _write_all(self, raw_data):
+        # the underlying stream may be something that does partial writes (like
+        # a socket).
+        data = memoryview(raw_data)
+        while len(data) > 0:
+            count = self._write(data)
+            data = data[count:]
+            if self._flags & self.FLAG_APPEND:
+                self._size += count
+                self._pos = self._realpos = self._size
+            else:
+                self._pos += count
+                self._realpos += count
+        return None
+
+    def _record_newline(self, newline):
+        # silliness about tracking what kinds of newlines we've seen.
+        # i don't understand why it can be None, a string, or a tuple, instead
+        # of just always being a tuple, but we'll emulate that behavior anyway.
+        if not (self._flags & self.FLAG_UNIVERSAL_NEWLINE):
+            return
+        if self.newlines is None:
+            self.newlines = newline
+        elif self.newlines != newline and isinstance(self.newlines, bytes):
+            self.newlines = (self.newlines, newline)
+        elif newline not in self.newlines:
+            self.newlines += (newline,)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/hostkeys.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/hostkeys.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d47e9508e1903b2cd1bfe2291717bb6499d23c3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/hostkeys.py
@@ -0,0 +1,384 @@
+# Copyright (C) 2006-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+
+from base64 import encodebytes, decodebytes
+import binascii
+import os
+import re
+
+from collections.abc import MutableMapping
+from hashlib import sha1
+from hmac import HMAC
+
+
+from paramiko.pkey import PKey, UnknownKeyType
+from paramiko.util import get_logger, constant_time_bytes_eq, b, u
+from paramiko.ssh_exception import SSHException
+
+
+class HostKeys(MutableMapping):
+    """
+    Representation of an OpenSSH-style "known hosts" file.  Host keys can be
+    read from one or more files, and then individual hosts can be looked up to
+    verify server keys during SSH negotiation.
+
+    A `.HostKeys` object can be treated like a dict; any dict lookup is
+    equivalent to calling `lookup`.
+
+    .. versionadded:: 1.5.3
+    """
+
+    def __init__(self, filename=None):
+        """
+        Create a new HostKeys object, optionally loading keys from an OpenSSH
+        style host-key file.
+
+        :param str filename: filename to load host keys from, or ``None``
+        """
+        # emulate a dict of { hostname: { keytype: PKey } }
+        self._entries = []
+        if filename is not None:
+            self.load(filename)
+
+    def add(self, hostname, keytype, key):
+        """
+        Add a host key entry to the table.  Any existing entry for a
+        ``(hostname, keytype)`` pair will be replaced.
+
+        :param str hostname: the hostname (or IP) to add
+        :param str keytype: key type (``"ssh-rsa"`` or ``"ssh-dss"``)
+        :param .PKey key: the key to add
+        """
+        for e in self._entries:
+            if (hostname in e.hostnames) and (e.key.get_name() == keytype):
+                e.key = key
+                return
+        self._entries.append(HostKeyEntry([hostname], key))
+
+    def load(self, filename):
+        """
+        Read a file of known SSH host keys, in the format used by OpenSSH.
+        This type of file unfortunately doesn't exist on Windows, but on
+        posix, it will usually be stored in
+        ``os.path.expanduser("~/.ssh/known_hosts")``.
+
+        If this method is called multiple times, the host keys are merged,
+        not cleared.  So multiple calls to `load` will just call `add`,
+        replacing any existing entries and adding new ones.
+
+        :param str filename: name of the file to read host keys from
+
+        :raises: ``IOError`` -- if there was an error reading the file
+        """
+        with open(filename, "r") as f:
+            for lineno, line in enumerate(f, 1):
+                line = line.strip()
+                if (len(line) == 0) or (line[0] == "#"):
+                    continue
+                try:
+                    entry = HostKeyEntry.from_line(line, lineno)
+                except SSHException:
+                    continue
+                if entry is not None:
+                    _hostnames = entry.hostnames
+                    for h in _hostnames:
+                        if self.check(h, entry.key):
+                            entry.hostnames.remove(h)
+                    if len(entry.hostnames):
+                        self._entries.append(entry)
+
+    def save(self, filename):
+        """
+        Save host keys into a file, in the format used by OpenSSH.  The order
+        of keys in the file will be preserved when possible (if these keys were
+        loaded from a file originally).  The single exception is that combined
+        lines will be split into individual key lines, which is arguably a bug.
+
+        :param str filename: name of the file to write
+
+        :raises: ``IOError`` -- if there was an error writing the file
+
+        .. versionadded:: 1.6.1
+        """
+        with open(filename, "w") as f:
+            for e in self._entries:
+                line = e.to_line()
+                if line:
+                    f.write(line)
+
+    def lookup(self, hostname):
+        """
+        Find a hostkey entry for a given hostname or IP.  If no entry is found,
+        ``None`` is returned.  Otherwise a dictionary of keytype to key is
+        returned.  The keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
+
+        :param str hostname: the hostname (or IP) to lookup
+        :return: dict of `str` -> `.PKey` keys associated with this host
+            (or ``None``)
+        """
+
+        class SubDict(MutableMapping):
+            def __init__(self, hostname, entries, hostkeys):
+                self._hostname = hostname
+                self._entries = entries
+                self._hostkeys = hostkeys
+
+            def __iter__(self):
+                for k in self.keys():
+                    yield k
+
+            def __len__(self):
+                return len(self.keys())
+
+            def __delitem__(self, key):
+                for e in list(self._entries):
+                    if e.key.get_name() == key:
+                        self._entries.remove(e)
+                        break
+                else:
+                    raise KeyError(key)
+
+            def __getitem__(self, key):
+                for e in self._entries:
+                    if e.key.get_name() == key:
+                        return e.key
+                raise KeyError(key)
+
+            def __setitem__(self, key, val):
+                for e in self._entries:
+                    if e.key is None:
+                        continue
+                    if e.key.get_name() == key:
+                        # replace
+                        e.key = val
+                        break
+                else:
+                    # add a new one
+                    e = HostKeyEntry([hostname], val)
+                    self._entries.append(e)
+                    self._hostkeys._entries.append(e)
+
+            def keys(self):
+                return [
+                    e.key.get_name()
+                    for e in self._entries
+                    if e.key is not None
+                ]
+
+        entries = []
+        for e in self._entries:
+            if self._hostname_matches(hostname, e):
+                entries.append(e)
+        if len(entries) == 0:
+            return None
+        return SubDict(hostname, entries, self)
+
+    def _hostname_matches(self, hostname, entry):
+        """
+        Tests whether ``hostname`` string matches given SubDict ``entry``.
+
+        :returns bool:
+        """
+        for h in entry.hostnames:
+            if (
+                h == hostname
+                or h.startswith("|1|")
+                and not hostname.startswith("|1|")
+                and constant_time_bytes_eq(self.hash_host(hostname, h), h)
+            ):
+                return True
+        return False
+
+    def check(self, hostname, key):
+        """
+        Return True if the given key is associated with the given hostname
+        in this dictionary.
+
+        :param str hostname: hostname (or IP) of the SSH server
+        :param .PKey key: the key to check
+        :return:
+            ``True`` if the key is associated with the hostname; else ``False``
+        """
+        k = self.lookup(hostname)
+        if k is None:
+            return False
+        host_key = k.get(key.get_name(), None)
+        if host_key is None:
+            return False
+        return host_key.asbytes() == key.asbytes()
+
+    def clear(self):
+        """
+        Remove all host keys from the dictionary.
+        """
+        self._entries = []
+
+    def __iter__(self):
+        for k in self.keys():
+            yield k
+
+    def __len__(self):
+        return len(self.keys())
+
+    def __getitem__(self, key):
+        ret = self.lookup(key)
+        if ret is None:
+            raise KeyError(key)
+        return ret
+
+    def __delitem__(self, key):
+        index = None
+        for i, entry in enumerate(self._entries):
+            if self._hostname_matches(key, entry):
+                index = i
+                break
+        if index is None:
+            raise KeyError(key)
+        self._entries.pop(index)
+
+    def __setitem__(self, hostname, entry):
+        # don't use this please.
+        if len(entry) == 0:
+            self._entries.append(HostKeyEntry([hostname], None))
+            return
+        for key_type in entry.keys():
+            found = False
+            for e in self._entries:
+                if (hostname in e.hostnames) and e.key.get_name() == key_type:
+                    # replace
+                    e.key = entry[key_type]
+                    found = True
+            if not found:
+                self._entries.append(HostKeyEntry([hostname], entry[key_type]))
+
+    def keys(self):
+        ret = []
+        for e in self._entries:
+            for h in e.hostnames:
+                if h not in ret:
+                    ret.append(h)
+        return ret
+
+    def values(self):
+        ret = []
+        for k in self.keys():
+            ret.append(self.lookup(k))
+        return ret
+
+    @staticmethod
+    def hash_host(hostname, salt=None):
+        """
+        Return a "hashed" form of the hostname, as used by OpenSSH when storing
+        hashed hostnames in the known_hosts file.
+
+        :param str hostname: the hostname to hash
+        :param str salt: optional salt to use when hashing
+            (must be 20 bytes long)
+        :return: the hashed hostname as a `str`
+        """
+        if salt is None:
+            salt = os.urandom(sha1().digest_size)
+        else:
+            if salt.startswith("|1|"):
+                salt = salt.split("|")[2]
+            salt = decodebytes(b(salt))
+        assert len(salt) == sha1().digest_size
+        hmac = HMAC(salt, b(hostname), sha1).digest()
+        hostkey = "|1|{}|{}".format(u(encodebytes(salt)), u(encodebytes(hmac)))
+        return hostkey.replace("\n", "")
+
+
+class InvalidHostKey(Exception):
+    def __init__(self, line, exc):
+        self.line = line
+        self.exc = exc
+        self.args = (line, exc)
+
+
+class HostKeyEntry:
+    """
+    Representation of a line in an OpenSSH-style "known hosts" file.
+    """
+
+    def __init__(self, hostnames=None, key=None):
+        self.valid = (hostnames is not None) and (key is not None)
+        self.hostnames = hostnames
+        self.key = key
+
+    @classmethod
+    def from_line(cls, line, lineno=None):
+        """
+        Parses the given line of text to find the names for the host,
+        the type of key, and the key data. The line is expected to be in the
+        format used by the OpenSSH known_hosts file. Fields are separated by a
+        single space or tab.
+
+        Lines are expected to not have leading or trailing whitespace.
+        We don't bother to check for comments or empty lines.  All of
+        that should be taken care of before sending the line to us.
+
+        :param str line: a line from an OpenSSH known_hosts file
+        """
+        log = get_logger("paramiko.hostkeys")
+        fields = re.split(" |\t", line)
+        if len(fields) < 3:
+            # Bad number of fields
+            msg = "Not enough fields found in known_hosts in line {} ({!r})"
+            log.info(msg.format(lineno, line))
+            return None
+        fields = fields[:3]
+
+        names, key_type, key = fields
+        names = names.split(",")
+
+        # Decide what kind of key we're looking at and create an object
+        # to hold it accordingly.
+        try:
+            # TODO: this grew organically and doesn't seem /wrong/ per se (file
+            # read -> unicode str -> bytes for base64 decode -> decoded bytes);
+            # but in Python 3 forever land, can we simply use
+            # `base64.b64decode(str-from-file)` here?
+            key_bytes = decodebytes(b(key))
+        except binascii.Error as e:
+            raise InvalidHostKey(line, e)
+
+        try:
+            return cls(names, PKey.from_type_string(key_type, key_bytes))
+        except UnknownKeyType:
+            # TODO 4.0: consider changing HostKeys API so this just raises
+            # naturally and the exception is muted higher up in the stack?
+            log.info("Unable to handle key of type {}".format(key_type))
+            return None
+
+    def to_line(self):
+        """
+        Returns a string in OpenSSH known_hosts file format, or None if
+        the object is not in a valid state.  A trailing newline is
+        included.
+        """
+        if self.valid:
+            return "{} {} {}\n".format(
+                ",".join(self.hostnames),
+                self.key.get_name(),
+                self.key.get_base64(),
+            )
+        return None
+
+    def __repr__(self):
+        return "<HostKeyEntry {!r}: {!r}>".format(self.hostnames, self.key)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_curve25519.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_curve25519.py
new file mode 100644
index 0000000000000000000000000000000000000000..20c23e42a0fac7e215e1c1f23650fae3a85b2ac2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_curve25519.py
@@ -0,0 +1,131 @@
+import binascii
+import hashlib
+
+from cryptography.exceptions import UnsupportedAlgorithm
+from cryptography.hazmat.primitives import constant_time, serialization
+from cryptography.hazmat.primitives.asymmetric.x25519 import (
+    X25519PrivateKey,
+    X25519PublicKey,
+)
+
+from paramiko.message import Message
+from paramiko.common import byte_chr
+from paramiko.ssh_exception import SSHException
+
+
+_MSG_KEXECDH_INIT, _MSG_KEXECDH_REPLY = range(30, 32)
+c_MSG_KEXECDH_INIT, c_MSG_KEXECDH_REPLY = [byte_chr(c) for c in range(30, 32)]
+
+
+class KexCurve25519:
+    hash_algo = hashlib.sha256
+
+    def __init__(self, transport):
+        self.transport = transport
+        self.key = None
+
+    @classmethod
+    def is_available(cls):
+        try:
+            X25519PrivateKey.generate()
+        except UnsupportedAlgorithm:
+            return False
+        else:
+            return True
+
+    def _perform_exchange(self, peer_key):
+        secret = self.key.exchange(peer_key)
+        if constant_time.bytes_eq(secret, b"\x00" * 32):
+            raise SSHException(
+                "peer's curve25519 public value has wrong order"
+            )
+        return secret
+
+    def start_kex(self):
+        self.key = X25519PrivateKey.generate()
+        if self.transport.server_mode:
+            self.transport._expect_packet(_MSG_KEXECDH_INIT)
+            return
+
+        m = Message()
+        m.add_byte(c_MSG_KEXECDH_INIT)
+        m.add_string(
+            self.key.public_key().public_bytes(
+                serialization.Encoding.Raw, serialization.PublicFormat.Raw
+            )
+        )
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXECDH_REPLY)
+
+    def parse_next(self, ptype, m):
+        if self.transport.server_mode and (ptype == _MSG_KEXECDH_INIT):
+            return self._parse_kexecdh_init(m)
+        elif not self.transport.server_mode and (ptype == _MSG_KEXECDH_REPLY):
+            return self._parse_kexecdh_reply(m)
+        raise SSHException(
+            "KexCurve25519 asked to handle packet type {:d}".format(ptype)
+        )
+
+    def _parse_kexecdh_init(self, m):
+        peer_key_bytes = m.get_string()
+        peer_key = X25519PublicKey.from_public_bytes(peer_key_bytes)
+        K = self._perform_exchange(peer_key)
+        K = int(binascii.hexlify(K), 16)
+        # compute exchange hash
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+        )
+        server_key_bytes = self.transport.get_server_key().asbytes()
+        exchange_key_bytes = self.key.public_key().public_bytes(
+            serialization.Encoding.Raw, serialization.PublicFormat.Raw
+        )
+        hm.add_string(server_key_bytes)
+        hm.add_string(peer_key_bytes)
+        hm.add_string(exchange_key_bytes)
+        hm.add_mpint(K)
+        H = self.hash_algo(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        sig = self.transport.get_server_key().sign_ssh_data(
+            H, self.transport.host_key_type
+        )
+        # construct reply
+        m = Message()
+        m.add_byte(c_MSG_KEXECDH_REPLY)
+        m.add_string(server_key_bytes)
+        m.add_string(exchange_key_bytes)
+        m.add_string(sig)
+        self.transport._send_message(m)
+        self.transport._activate_outbound()
+
+    def _parse_kexecdh_reply(self, m):
+        peer_host_key_bytes = m.get_string()
+        peer_key_bytes = m.get_string()
+        sig = m.get_binary()
+
+        peer_key = X25519PublicKey.from_public_bytes(peer_key_bytes)
+
+        K = self._perform_exchange(peer_key)
+        K = int(binascii.hexlify(K), 16)
+        # compute exchange hash and verify signature
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+        )
+        hm.add_string(peer_host_key_bytes)
+        hm.add_string(
+            self.key.public_key().public_bytes(
+                serialization.Encoding.Raw, serialization.PublicFormat.Raw
+            )
+        )
+        hm.add_string(peer_key_bytes)
+        hm.add_mpint(K)
+        self.transport._set_K_H(K, self.hash_algo(hm.asbytes()).digest())
+        self.transport._verify_key(peer_host_key_bytes, sig)
+        self.transport._activate_outbound()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_ecdh_nist.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_ecdh_nist.py
new file mode 100644
index 0000000000000000000000000000000000000000..41fab46bd0dea5d5dd53c321d700a66274342523
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_ecdh_nist.py
@@ -0,0 +1,151 @@
+"""
+Ephemeral Elliptic Curve Diffie-Hellman (ECDH) key exchange
+RFC 5656, Section 4
+"""
+
+from hashlib import sha256, sha384, sha512
+from paramiko.common import byte_chr
+from paramiko.message import Message
+from paramiko.ssh_exception import SSHException
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives.asymmetric import ec
+from cryptography.hazmat.primitives import serialization
+from binascii import hexlify
+
+_MSG_KEXECDH_INIT, _MSG_KEXECDH_REPLY = range(30, 32)
+c_MSG_KEXECDH_INIT, c_MSG_KEXECDH_REPLY = [byte_chr(c) for c in range(30, 32)]
+
+
+class KexNistp256:
+
+    name = "ecdh-sha2-nistp256"
+    hash_algo = sha256
+    curve = ec.SECP256R1()
+
+    def __init__(self, transport):
+        self.transport = transport
+        # private key, client public and server public keys
+        self.P = 0
+        self.Q_C = None
+        self.Q_S = None
+
+    def start_kex(self):
+        self._generate_key_pair()
+        if self.transport.server_mode:
+            self.transport._expect_packet(_MSG_KEXECDH_INIT)
+            return
+        m = Message()
+        m.add_byte(c_MSG_KEXECDH_INIT)
+        # SEC1: V2.0  2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+        m.add_string(
+            self.Q_C.public_bytes(
+                serialization.Encoding.X962,
+                serialization.PublicFormat.UncompressedPoint,
+            )
+        )
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXECDH_REPLY)
+
+    def parse_next(self, ptype, m):
+        if self.transport.server_mode and (ptype == _MSG_KEXECDH_INIT):
+            return self._parse_kexecdh_init(m)
+        elif not self.transport.server_mode and (ptype == _MSG_KEXECDH_REPLY):
+            return self._parse_kexecdh_reply(m)
+        raise SSHException(
+            "KexECDH asked to handle packet type {:d}".format(ptype)
+        )
+
+    def _generate_key_pair(self):
+        self.P = ec.generate_private_key(self.curve, default_backend())
+        if self.transport.server_mode:
+            self.Q_S = self.P.public_key()
+            return
+        self.Q_C = self.P.public_key()
+
+    def _parse_kexecdh_init(self, m):
+        Q_C_bytes = m.get_string()
+        self.Q_C = ec.EllipticCurvePublicKey.from_encoded_point(
+            self.curve, Q_C_bytes
+        )
+        K_S = self.transport.get_server_key().asbytes()
+        K = self.P.exchange(ec.ECDH(), self.Q_C)
+        K = int(hexlify(K), 16)
+        # compute exchange hash
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+        )
+        hm.add_string(K_S)
+        hm.add_string(Q_C_bytes)
+        # SEC1: V2.0  2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+        hm.add_string(
+            self.Q_S.public_bytes(
+                serialization.Encoding.X962,
+                serialization.PublicFormat.UncompressedPoint,
+            )
+        )
+        hm.add_mpint(int(K))
+        H = self.hash_algo(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        sig = self.transport.get_server_key().sign_ssh_data(
+            H, self.transport.host_key_type
+        )
+        # construct reply
+        m = Message()
+        m.add_byte(c_MSG_KEXECDH_REPLY)
+        m.add_string(K_S)
+        m.add_string(
+            self.Q_S.public_bytes(
+                serialization.Encoding.X962,
+                serialization.PublicFormat.UncompressedPoint,
+            )
+        )
+        m.add_string(sig)
+        self.transport._send_message(m)
+        self.transport._activate_outbound()
+
+    def _parse_kexecdh_reply(self, m):
+        K_S = m.get_string()
+        Q_S_bytes = m.get_string()
+        self.Q_S = ec.EllipticCurvePublicKey.from_encoded_point(
+            self.curve, Q_S_bytes
+        )
+        sig = m.get_binary()
+        K = self.P.exchange(ec.ECDH(), self.Q_S)
+        K = int(hexlify(K), 16)
+        # compute exchange hash and verify signature
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+        )
+        hm.add_string(K_S)
+        # SEC1: V2.0  2.3.3 Elliptic-Curve-Point-to-Octet-String Conversion
+        hm.add_string(
+            self.Q_C.public_bytes(
+                serialization.Encoding.X962,
+                serialization.PublicFormat.UncompressedPoint,
+            )
+        )
+        hm.add_string(Q_S_bytes)
+        hm.add_mpint(K)
+        self.transport._set_K_H(K, self.hash_algo(hm.asbytes()).digest())
+        self.transport._verify_key(K_S, sig)
+        self.transport._activate_outbound()
+
+
+class KexNistp384(KexNistp256):
+    name = "ecdh-sha2-nistp384"
+    hash_algo = sha384
+    curve = ec.SECP384R1()
+
+
+class KexNistp521(KexNistp256):
+    name = "ecdh-sha2-nistp521"
+    hash_algo = sha512
+    curve = ec.SECP521R1()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gex.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gex.py
new file mode 100644
index 0000000000000000000000000000000000000000..baa0803dbd8c393ab1a1efd48733bf29cc5e7138
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gex.py
@@ -0,0 +1,288 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Variant on `KexGroup1 <paramiko.kex_group1.KexGroup1>` where the prime "p" and
+generator "g" are provided by the server.  A bit more work is required on the
+client side, and a **lot** more on the server side.
+"""
+
+import os
+from hashlib import sha1, sha256
+
+from paramiko import util
+from paramiko.common import DEBUG, byte_chr, byte_ord, byte_mask
+from paramiko.message import Message
+from paramiko.ssh_exception import SSHException
+
+
+(
+    _MSG_KEXDH_GEX_REQUEST_OLD,
+    _MSG_KEXDH_GEX_GROUP,
+    _MSG_KEXDH_GEX_INIT,
+    _MSG_KEXDH_GEX_REPLY,
+    _MSG_KEXDH_GEX_REQUEST,
+) = range(30, 35)
+
+(
+    c_MSG_KEXDH_GEX_REQUEST_OLD,
+    c_MSG_KEXDH_GEX_GROUP,
+    c_MSG_KEXDH_GEX_INIT,
+    c_MSG_KEXDH_GEX_REPLY,
+    c_MSG_KEXDH_GEX_REQUEST,
+) = [byte_chr(c) for c in range(30, 35)]
+
+
+class KexGex:
+
+    name = "diffie-hellman-group-exchange-sha1"
+    min_bits = 1024
+    max_bits = 8192
+    preferred_bits = 2048
+    hash_algo = sha1
+
+    def __init__(self, transport):
+        self.transport = transport
+        self.p = None
+        self.q = None
+        self.g = None
+        self.x = None
+        self.e = None
+        self.f = None
+        self.old_style = False
+
+    def start_kex(self, _test_old_style=False):
+        if self.transport.server_mode:
+            self.transport._expect_packet(
+                _MSG_KEXDH_GEX_REQUEST, _MSG_KEXDH_GEX_REQUEST_OLD
+            )
+            return
+        # request a bit range: we accept (min_bits) to (max_bits), but prefer
+        # (preferred_bits).  according to the spec, we shouldn't pull the
+        # minimum up above 1024.
+        m = Message()
+        if _test_old_style:
+            # only used for unit tests: we shouldn't ever send this
+            m.add_byte(c_MSG_KEXDH_GEX_REQUEST_OLD)
+            m.add_int(self.preferred_bits)
+            self.old_style = True
+        else:
+            m.add_byte(c_MSG_KEXDH_GEX_REQUEST)
+            m.add_int(self.min_bits)
+            m.add_int(self.preferred_bits)
+            m.add_int(self.max_bits)
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXDH_GEX_GROUP)
+
+    def parse_next(self, ptype, m):
+        if ptype == _MSG_KEXDH_GEX_REQUEST:
+            return self._parse_kexdh_gex_request(m)
+        elif ptype == _MSG_KEXDH_GEX_GROUP:
+            return self._parse_kexdh_gex_group(m)
+        elif ptype == _MSG_KEXDH_GEX_INIT:
+            return self._parse_kexdh_gex_init(m)
+        elif ptype == _MSG_KEXDH_GEX_REPLY:
+            return self._parse_kexdh_gex_reply(m)
+        elif ptype == _MSG_KEXDH_GEX_REQUEST_OLD:
+            return self._parse_kexdh_gex_request_old(m)
+        msg = "KexGex {} asked to handle packet type {:d}"
+        raise SSHException(msg.format(self.name, ptype))
+
+    # ...internals...
+
+    def _generate_x(self):
+        # generate an "x" (1 < x < (p-1)/2).
+        q = (self.p - 1) // 2
+        qnorm = util.deflate_long(q, 0)
+        qhbyte = byte_ord(qnorm[0])
+        byte_count = len(qnorm)
+        qmask = 0xFF
+        while not (qhbyte & 0x80):
+            qhbyte <<= 1
+            qmask >>= 1
+        while True:
+            x_bytes = os.urandom(byte_count)
+            x_bytes = byte_mask(x_bytes[0], qmask) + x_bytes[1:]
+            x = util.inflate_long(x_bytes, 1)
+            if (x > 1) and (x < q):
+                break
+        self.x = x
+
+    def _parse_kexdh_gex_request(self, m):
+        minbits = m.get_int()
+        preferredbits = m.get_int()
+        maxbits = m.get_int()
+        # smoosh the user's preferred size into our own limits
+        if preferredbits > self.max_bits:
+            preferredbits = self.max_bits
+        if preferredbits < self.min_bits:
+            preferredbits = self.min_bits
+        # fix min/max if they're inconsistent.  technically, we could just pout
+        # and hang up, but there's no harm in giving them the benefit of the
+        # doubt and just picking a bitsize for them.
+        if minbits > preferredbits:
+            minbits = preferredbits
+        if maxbits < preferredbits:
+            maxbits = preferredbits
+        # now save a copy
+        self.min_bits = minbits
+        self.preferred_bits = preferredbits
+        self.max_bits = maxbits
+        # generate prime
+        pack = self.transport._get_modulus_pack()
+        if pack is None:
+            raise SSHException("Can't do server-side gex with no modulus pack")
+        self.transport._log(
+            DEBUG,
+            "Picking p ({} <= {} <= {} bits)".format(
+                minbits, preferredbits, maxbits
+            ),
+        )
+        self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits)
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_GEX_GROUP)
+        m.add_mpint(self.p)
+        m.add_mpint(self.g)
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXDH_GEX_INIT)
+
+    def _parse_kexdh_gex_request_old(self, m):
+        # same as above, but without min_bits or max_bits (used by older
+        # clients like putty)
+        self.preferred_bits = m.get_int()
+        # smoosh the user's preferred size into our own limits
+        if self.preferred_bits > self.max_bits:
+            self.preferred_bits = self.max_bits
+        if self.preferred_bits < self.min_bits:
+            self.preferred_bits = self.min_bits
+        # generate prime
+        pack = self.transport._get_modulus_pack()
+        if pack is None:
+            raise SSHException("Can't do server-side gex with no modulus pack")
+        self.transport._log(
+            DEBUG, "Picking p (~ {} bits)".format(self.preferred_bits)
+        )
+        self.g, self.p = pack.get_modulus(
+            self.min_bits, self.preferred_bits, self.max_bits
+        )
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_GEX_GROUP)
+        m.add_mpint(self.p)
+        m.add_mpint(self.g)
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXDH_GEX_INIT)
+        self.old_style = True
+
+    def _parse_kexdh_gex_group(self, m):
+        self.p = m.get_mpint()
+        self.g = m.get_mpint()
+        # reject if p's bit length < 1024 or > 8192
+        bitlen = util.bit_length(self.p)
+        if (bitlen < 1024) or (bitlen > 8192):
+            raise SSHException(
+                "Server-generated gex p (don't ask) is out of range "
+                "({} bits)".format(bitlen)
+            )
+        self.transport._log(DEBUG, "Got server p ({} bits)".format(bitlen))
+        self._generate_x()
+        # now compute e = g^x mod p
+        self.e = pow(self.g, self.x, self.p)
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_GEX_INIT)
+        m.add_mpint(self.e)
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXDH_GEX_REPLY)
+
+    def _parse_kexdh_gex_init(self, m):
+        self.e = m.get_mpint()
+        if (self.e < 1) or (self.e > self.p - 1):
+            raise SSHException('Client kex "e" is out of range')
+        self._generate_x()
+        self.f = pow(self.g, self.x, self.p)
+        K = pow(self.e, self.x, self.p)
+        key = self.transport.get_server_key().asbytes()
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K)  # noqa
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+            key,
+        )
+        if not self.old_style:
+            hm.add_int(self.min_bits)
+        hm.add_int(self.preferred_bits)
+        if not self.old_style:
+            hm.add_int(self.max_bits)
+        hm.add_mpint(self.p)
+        hm.add_mpint(self.g)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = self.hash_algo(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        # sign it
+        sig = self.transport.get_server_key().sign_ssh_data(
+            H, self.transport.host_key_type
+        )
+        # send reply
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_GEX_REPLY)
+        m.add_string(key)
+        m.add_mpint(self.f)
+        m.add_string(sig)
+        self.transport._send_message(m)
+        self.transport._activate_outbound()
+
+    def _parse_kexdh_gex_reply(self, m):
+        host_key = m.get_string()
+        self.f = m.get_mpint()
+        sig = m.get_string()
+        if (self.f < 1) or (self.f > self.p - 1):
+            raise SSHException('Server kex "f" is out of range')
+        K = pow(self.f, self.x, self.p)
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K)  # noqa
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+            host_key,
+        )
+        if not self.old_style:
+            hm.add_int(self.min_bits)
+        hm.add_int(self.preferred_bits)
+        if not self.old_style:
+            hm.add_int(self.max_bits)
+        hm.add_mpint(self.p)
+        hm.add_mpint(self.g)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        self.transport._set_K_H(K, self.hash_algo(hm.asbytes()).digest())
+        self.transport._verify_key(host_key, sig)
+        self.transport._activate_outbound()
+
+
+class KexGexSHA256(KexGex):
+    name = "diffie-hellman-group-exchange-sha256"
+    hash_algo = sha256
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group1.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group1.py
new file mode 100644
index 0000000000000000000000000000000000000000..f07425666eb69a2861505982fdfd1e9a585c553c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group1.py
@@ -0,0 +1,155 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Standard SSH key exchange ("kex" if you wanna sound cool).  Diffie-Hellman of
+1024 bit key halves, using a known "p" prime and "g" generator.
+"""
+
+import os
+from hashlib import sha1
+
+from paramiko import util
+from paramiko.common import max_byte, zero_byte, byte_chr, byte_mask
+from paramiko.message import Message
+from paramiko.ssh_exception import SSHException
+
+
+_MSG_KEXDH_INIT, _MSG_KEXDH_REPLY = range(30, 32)
+c_MSG_KEXDH_INIT, c_MSG_KEXDH_REPLY = [byte_chr(c) for c in range(30, 32)]
+
+b7fffffffffffffff = byte_chr(0x7F) + max_byte * 7
+b0000000000000000 = zero_byte * 8
+
+
+class KexGroup1:
+
+    # draft-ietf-secsh-transport-09.txt, page 17
+    P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF  # noqa
+    G = 2
+
+    name = "diffie-hellman-group1-sha1"
+    hash_algo = sha1
+
+    def __init__(self, transport):
+        self.transport = transport
+        self.x = 0
+        self.e = 0
+        self.f = 0
+
+    def start_kex(self):
+        self._generate_x()
+        if self.transport.server_mode:
+            # compute f = g^x mod p, but don't send it yet
+            self.f = pow(self.G, self.x, self.P)
+            self.transport._expect_packet(_MSG_KEXDH_INIT)
+            return
+        # compute e = g^x mod p (where g=2), and send it
+        self.e = pow(self.G, self.x, self.P)
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_INIT)
+        m.add_mpint(self.e)
+        self.transport._send_message(m)
+        self.transport._expect_packet(_MSG_KEXDH_REPLY)
+
+    def parse_next(self, ptype, m):
+        if self.transport.server_mode and (ptype == _MSG_KEXDH_INIT):
+            return self._parse_kexdh_init(m)
+        elif not self.transport.server_mode and (ptype == _MSG_KEXDH_REPLY):
+            return self._parse_kexdh_reply(m)
+        msg = "KexGroup1 asked to handle packet type {:d}"
+        raise SSHException(msg.format(ptype))
+
+    # ...internals...
+
+    def _generate_x(self):
+        # generate an "x" (1 < x < q), where q is (p-1)/2.
+        # p is a 128-byte (1024-bit) number, where the first 64 bits are 1.
+        # therefore q can be approximated as a 2^1023.  we drop the subset of
+        # potential x where the first 63 bits are 1, because some of those
+        # will be larger than q (but this is a tiny tiny subset of
+        # potential x).
+        while 1:
+            x_bytes = os.urandom(128)
+            x_bytes = byte_mask(x_bytes[0], 0x7F) + x_bytes[1:]
+            if (
+                x_bytes[:8] != b7fffffffffffffff
+                and x_bytes[:8] != b0000000000000000
+            ):
+                break
+        self.x = util.inflate_long(x_bytes)
+
+    def _parse_kexdh_reply(self, m):
+        # client mode
+        host_key = m.get_string()
+        self.f = m.get_mpint()
+        if (self.f < 1) or (self.f > self.P - 1):
+            raise SSHException('Server kex "f" is out of range')
+        sig = m.get_binary()
+        K = pow(self.f, self.x, self.P)
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || e || f || K)
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+        )
+        hm.add_string(host_key)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        self.transport._set_K_H(K, self.hash_algo(hm.asbytes()).digest())
+        self.transport._verify_key(host_key, sig)
+        self.transport._activate_outbound()
+
+    def _parse_kexdh_init(self, m):
+        # server mode
+        self.e = m.get_mpint()
+        if (self.e < 1) or (self.e > self.P - 1):
+            raise SSHException('Client kex "e" is out of range')
+        K = pow(self.e, self.x, self.P)
+        key = self.transport.get_server_key().asbytes()
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || e || f || K)
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+        )
+        hm.add_string(key)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = self.hash_algo(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        # sign it
+        sig = self.transport.get_server_key().sign_ssh_data(
+            H, self.transport.host_key_type
+        )
+        # send reply
+        m = Message()
+        m.add_byte(c_MSG_KEXDH_REPLY)
+        m.add_string(key)
+        m.add_mpint(self.f)
+        m.add_string(sig)
+        self.transport._send_message(m)
+        self.transport._activate_outbound()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group14.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group14.py
new file mode 100644
index 0000000000000000000000000000000000000000..8dee5515969ea056fd506f87fcd1fc998eb75bf4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group14.py
@@ -0,0 +1,40 @@
+# Copyright (C) 2013  Torsten Landschoff <torsten@debian.org>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Standard SSH key exchange ("kex" if you wanna sound cool).  Diffie-Hellman of
+2048 bit key halves, using a known "p" prime and "g" generator.
+"""
+
+from paramiko.kex_group1 import KexGroup1
+from hashlib import sha1, sha256
+
+
+class KexGroup14(KexGroup1):
+
+    # http://tools.ietf.org/html/rfc3526#section-3
+    P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF  # noqa
+    G = 2
+
+    name = "diffie-hellman-group14-sha1"
+    hash_algo = sha1
+
+
+class KexGroup14SHA256(KexGroup14):
+    name = "diffie-hellman-group14-sha256"
+    hash_algo = sha256
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group16.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group16.py
new file mode 100644
index 0000000000000000000000000000000000000000..c675f8779831b3755125fab535151d9d91be1239
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_group16.py
@@ -0,0 +1,35 @@
+# Copyright (C) 2019 Edgar Sousa <https://github.com/edgsousa>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Standard SSH key exchange ("kex" if you wanna sound cool).  Diffie-Hellman of
+4096 bit key halves, using a known "p" prime and "g" generator.
+"""
+
+from paramiko.kex_group1 import KexGroup1
+from hashlib import sha512
+
+
+class KexGroup16SHA512(KexGroup1):
+    name = "diffie-hellman-group16-sha512"
+    # http://tools.ietf.org/html/rfc3526#section-5
+    P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A92108011A723C12A787E6D788719A10BDBA5B2699C327186AF4E23C1A946834B6150BDA2583E9CA2AD44CE8DBBBC2DB04DE8EF92E8EFC141FBECAA6287C59474E6BC05D99B2964FA090C3A2233BA186515BE7ED1F612970CEE2D7AFB81BDD762170481CD0069127D5B05AA993B4EA988D8FDDC186FFB7DC90A6C08F4DF435C934063199FFFFFFFFFFFFFFFF  # noqa
+    G = 2
+
+    name = "diffie-hellman-group16-sha512"
+    hash_algo = sha512
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gss.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gss.py
new file mode 100644
index 0000000000000000000000000000000000000000..2a5f29e34b15bf41d162e2a2f145d9d796ec7ae9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/kex_gss.py
@@ -0,0 +1,686 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+# Copyright (C) 2013-2014 science + computing ag
+# Author: Sebastian Deiss <sebastian.deiss@t-online.de>
+#
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+
+"""
+This module provides GSS-API / SSPI Key Exchange as defined in :rfc:`4462`.
+
+.. note:: Credential delegation is not supported in server mode.
+
+.. note::
+    `RFC 4462 Section 2.2
+    <https://tools.ietf.org/html/rfc4462.html#section-2.2>`_ says we are not
+    required to implement GSS-API error messages. Thus, in many methods within
+    this module, if an error occurs an exception will be thrown and the
+    connection will be terminated.
+
+.. seealso:: :doc:`/api/ssh_gss`
+
+.. versionadded:: 1.15
+"""
+
+import os
+from hashlib import sha1
+
+from paramiko.common import (
+    DEBUG,
+    max_byte,
+    zero_byte,
+    byte_chr,
+    byte_mask,
+    byte_ord,
+)
+from paramiko import util
+from paramiko.message import Message
+from paramiko.ssh_exception import SSHException
+
+
+(
+    MSG_KEXGSS_INIT,
+    MSG_KEXGSS_CONTINUE,
+    MSG_KEXGSS_COMPLETE,
+    MSG_KEXGSS_HOSTKEY,
+    MSG_KEXGSS_ERROR,
+) = range(30, 35)
+(MSG_KEXGSS_GROUPREQ, MSG_KEXGSS_GROUP) = range(40, 42)
+(
+    c_MSG_KEXGSS_INIT,
+    c_MSG_KEXGSS_CONTINUE,
+    c_MSG_KEXGSS_COMPLETE,
+    c_MSG_KEXGSS_HOSTKEY,
+    c_MSG_KEXGSS_ERROR,
+) = [byte_chr(c) for c in range(30, 35)]
+(c_MSG_KEXGSS_GROUPREQ, c_MSG_KEXGSS_GROUP) = [
+    byte_chr(c) for c in range(40, 42)
+]
+
+
+class KexGSSGroup1:
+    """
+    GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange as defined in `RFC
+    4462 Section 2 <https://tools.ietf.org/html/rfc4462.html#section-2>`_
+    """
+
+    # draft-ietf-secsh-transport-09.txt, page 17
+    P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF  # noqa
+    G = 2
+    b7fffffffffffffff = byte_chr(0x7F) + max_byte * 7  # noqa
+    b0000000000000000 = zero_byte * 8  # noqa
+    NAME = "gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g=="
+
+    def __init__(self, transport):
+        self.transport = transport
+        self.kexgss = self.transport.kexgss_ctxt
+        self.gss_host = None
+        self.x = 0
+        self.e = 0
+        self.f = 0
+
+    def start_kex(self):
+        """
+        Start the GSS-API / SSPI Authenticated Diffie-Hellman Key Exchange.
+        """
+        self._generate_x()
+        if self.transport.server_mode:
+            # compute f = g^x mod p, but don't send it yet
+            self.f = pow(self.G, self.x, self.P)
+            self.transport._expect_packet(MSG_KEXGSS_INIT)
+            return
+        # compute e = g^x mod p (where g=2), and send it
+        self.e = pow(self.G, self.x, self.P)
+        # Initialize GSS-API Key Exchange
+        self.gss_host = self.transport.gss_host
+        m = Message()
+        m.add_byte(c_MSG_KEXGSS_INIT)
+        m.add_string(self.kexgss.ssh_init_sec_context(target=self.gss_host))
+        m.add_mpint(self.e)
+        self.transport._send_message(m)
+        self.transport._expect_packet(
+            MSG_KEXGSS_HOSTKEY,
+            MSG_KEXGSS_CONTINUE,
+            MSG_KEXGSS_COMPLETE,
+            MSG_KEXGSS_ERROR,
+        )
+
+    def parse_next(self, ptype, m):
+        """
+        Parse the next packet.
+
+        :param ptype: The (string) type of the incoming packet
+        :param `.Message` m: The packet content
+        """
+        if self.transport.server_mode and (ptype == MSG_KEXGSS_INIT):
+            return self._parse_kexgss_init(m)
+        elif not self.transport.server_mode and (ptype == MSG_KEXGSS_HOSTKEY):
+            return self._parse_kexgss_hostkey(m)
+        elif self.transport.server_mode and (ptype == MSG_KEXGSS_CONTINUE):
+            return self._parse_kexgss_continue(m)
+        elif not self.transport.server_mode and (ptype == MSG_KEXGSS_COMPLETE):
+            return self._parse_kexgss_complete(m)
+        elif ptype == MSG_KEXGSS_ERROR:
+            return self._parse_kexgss_error(m)
+        msg = "GSS KexGroup1 asked to handle packet type {:d}"
+        raise SSHException(msg.format(ptype))
+
+    # ##  internals...
+
+    def _generate_x(self):
+        """
+        generate an "x" (1 < x < q), where q is (p-1)/2.
+        p is a 128-byte (1024-bit) number, where the first 64 bits are 1.
+        therefore q can be approximated as a 2^1023.  we drop the subset of
+        potential x where the first 63 bits are 1, because some of those will
+        be larger than q (but this is a tiny tiny subset of potential x).
+        """
+        while 1:
+            x_bytes = os.urandom(128)
+            x_bytes = byte_mask(x_bytes[0], 0x7F) + x_bytes[1:]
+            first = x_bytes[:8]
+            if first not in (self.b7fffffffffffffff, self.b0000000000000000):
+                break
+        self.x = util.inflate_long(x_bytes)
+
+    def _parse_kexgss_hostkey(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode).
+
+        :param `.Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message
+        """
+        # client mode
+        host_key = m.get_string()
+        self.transport.host_key = host_key
+        sig = m.get_string()
+        self.transport._verify_key(host_key, sig)
+        self.transport._expect_packet(MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE)
+
+    def _parse_kexgss_continue(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_CONTINUE message.
+
+        :param `.Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE
+            message
+        """
+        if not self.transport.server_mode:
+            srv_token = m.get_string()
+            m = Message()
+            m.add_byte(c_MSG_KEXGSS_CONTINUE)
+            m.add_string(
+                self.kexgss.ssh_init_sec_context(
+                    target=self.gss_host, recv_token=srv_token
+                )
+            )
+            self.transport.send_message(m)
+            self.transport._expect_packet(
+                MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE, MSG_KEXGSS_ERROR
+            )
+        else:
+            pass
+
+    def _parse_kexgss_complete(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode).
+
+        :param `.Message` m: The content of the
+            SSH2_MSG_KEXGSS_COMPLETE message
+        """
+        # client mode
+        if self.transport.host_key is None:
+            self.transport.host_key = NullHostKey()
+        self.f = m.get_mpint()
+        if (self.f < 1) or (self.f > self.P - 1):
+            raise SSHException('Server kex "f" is out of range')
+        mic_token = m.get_string()
+        # This must be TRUE, if there is a GSS-API token in this message.
+        bool = m.get_boolean()
+        srv_token = None
+        if bool:
+            srv_token = m.get_string()
+        K = pow(self.f, self.x, self.P)
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || e || f || K)
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+        )
+        hm.add_string(self.transport.host_key.__str__())
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = sha1(str(hm)).digest()
+        self.transport._set_K_H(K, H)
+        if srv_token is not None:
+            self.kexgss.ssh_init_sec_context(
+                target=self.gss_host, recv_token=srv_token
+            )
+            self.kexgss.ssh_check_mic(mic_token, H)
+        else:
+            self.kexgss.ssh_check_mic(mic_token, H)
+        self.transport.gss_kex_used = True
+        self.transport._activate_outbound()
+
+    def _parse_kexgss_init(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_INIT message (server mode).
+
+        :param `.Message` m: The content of the SSH2_MSG_KEXGSS_INIT message
+        """
+        # server mode
+        client_token = m.get_string()
+        self.e = m.get_mpint()
+        if (self.e < 1) or (self.e > self.P - 1):
+            raise SSHException('Client kex "e" is out of range')
+        K = pow(self.e, self.x, self.P)
+        self.transport.host_key = NullHostKey()
+        key = self.transport.host_key.__str__()
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || e || f || K)
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+        )
+        hm.add_string(key)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = sha1(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        srv_token = self.kexgss.ssh_accept_sec_context(
+            self.gss_host, client_token
+        )
+        m = Message()
+        if self.kexgss._gss_srv_ctxt_status:
+            mic_token = self.kexgss.ssh_get_mic(
+                self.transport.session_id, gss_kex=True
+            )
+            m.add_byte(c_MSG_KEXGSS_COMPLETE)
+            m.add_mpint(self.f)
+            m.add_string(mic_token)
+            if srv_token is not None:
+                m.add_boolean(True)
+                m.add_string(srv_token)
+            else:
+                m.add_boolean(False)
+            self.transport._send_message(m)
+            self.transport.gss_kex_used = True
+            self.transport._activate_outbound()
+        else:
+            m.add_byte(c_MSG_KEXGSS_CONTINUE)
+            m.add_string(srv_token)
+            self.transport._send_message(m)
+            self.transport._expect_packet(
+                MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE, MSG_KEXGSS_ERROR
+            )
+
+    def _parse_kexgss_error(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_ERROR message (client mode).
+        The server may send a GSS-API error message. if it does, we display
+        the error by throwing an exception (client mode).
+
+        :param `.Message` m: The content of the SSH2_MSG_KEXGSS_ERROR message
+        :raise SSHException: Contains GSS-API major and minor status as well as
+                             the error message and the language tag of the
+                             message
+        """
+        maj_status = m.get_int()
+        min_status = m.get_int()
+        err_msg = m.get_string()
+        m.get_string()  # we don't care about the language!
+        raise SSHException(
+            """GSS-API Error:
+Major Status: {}
+Minor Status: {}
+Error Message: {}
+""".format(
+                maj_status, min_status, err_msg
+            )
+        )
+
+
+class KexGSSGroup14(KexGSSGroup1):
+    """
+    GSS-API / SSPI Authenticated Diffie-Hellman Group14 Key Exchange as defined
+    in `RFC 4462 Section 2
+    <https://tools.ietf.org/html/rfc4462.html#section-2>`_
+    """
+
+    P = 0xFFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AACAA68FFFFFFFFFFFFFFFF  # noqa
+    G = 2
+    NAME = "gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g=="
+
+
+class KexGSSGex:
+    """
+    GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange as defined in
+    `RFC 4462 Section 2 <https://tools.ietf.org/html/rfc4462.html#section-2>`_
+    """
+
+    NAME = "gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g=="
+    min_bits = 1024
+    max_bits = 8192
+    preferred_bits = 2048
+
+    def __init__(self, transport):
+        self.transport = transport
+        self.kexgss = self.transport.kexgss_ctxt
+        self.gss_host = None
+        self.p = None
+        self.q = None
+        self.g = None
+        self.x = None
+        self.e = None
+        self.f = None
+        self.old_style = False
+
+    def start_kex(self):
+        """
+        Start the GSS-API / SSPI Authenticated Diffie-Hellman Group Exchange
+        """
+        if self.transport.server_mode:
+            self.transport._expect_packet(MSG_KEXGSS_GROUPREQ)
+            return
+        # request a bit range: we accept (min_bits) to (max_bits), but prefer
+        # (preferred_bits).  according to the spec, we shouldn't pull the
+        # minimum up above 1024.
+        self.gss_host = self.transport.gss_host
+        m = Message()
+        m.add_byte(c_MSG_KEXGSS_GROUPREQ)
+        m.add_int(self.min_bits)
+        m.add_int(self.preferred_bits)
+        m.add_int(self.max_bits)
+        self.transport._send_message(m)
+        self.transport._expect_packet(MSG_KEXGSS_GROUP)
+
+    def parse_next(self, ptype, m):
+        """
+        Parse the next packet.
+
+        :param ptype: The (string) type of the incoming packet
+        :param `.Message` m: The packet content
+        """
+        if ptype == MSG_KEXGSS_GROUPREQ:
+            return self._parse_kexgss_groupreq(m)
+        elif ptype == MSG_KEXGSS_GROUP:
+            return self._parse_kexgss_group(m)
+        elif ptype == MSG_KEXGSS_INIT:
+            return self._parse_kexgss_gex_init(m)
+        elif ptype == MSG_KEXGSS_HOSTKEY:
+            return self._parse_kexgss_hostkey(m)
+        elif ptype == MSG_KEXGSS_CONTINUE:
+            return self._parse_kexgss_continue(m)
+        elif ptype == MSG_KEXGSS_COMPLETE:
+            return self._parse_kexgss_complete(m)
+        elif ptype == MSG_KEXGSS_ERROR:
+            return self._parse_kexgss_error(m)
+        msg = "KexGex asked to handle packet type {:d}"
+        raise SSHException(msg.format(ptype))
+
+    # ##  internals...
+
+    def _generate_x(self):
+        # generate an "x" (1 < x < (p-1)/2).
+        q = (self.p - 1) // 2
+        qnorm = util.deflate_long(q, 0)
+        qhbyte = byte_ord(qnorm[0])
+        byte_count = len(qnorm)
+        qmask = 0xFF
+        while not (qhbyte & 0x80):
+            qhbyte <<= 1
+            qmask >>= 1
+        while True:
+            x_bytes = os.urandom(byte_count)
+            x_bytes = byte_mask(x_bytes[0], qmask) + x_bytes[1:]
+            x = util.inflate_long(x_bytes, 1)
+            if (x > 1) and (x < q):
+                break
+        self.x = x
+
+    def _parse_kexgss_groupreq(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_GROUPREQ message (server mode).
+
+        :param `.Message` m: The content of the
+            SSH2_MSG_KEXGSS_GROUPREQ message
+        """
+        minbits = m.get_int()
+        preferredbits = m.get_int()
+        maxbits = m.get_int()
+        # smoosh the user's preferred size into our own limits
+        if preferredbits > self.max_bits:
+            preferredbits = self.max_bits
+        if preferredbits < self.min_bits:
+            preferredbits = self.min_bits
+        # fix min/max if they're inconsistent.  technically, we could just pout
+        # and hang up, but there's no harm in giving them the benefit of the
+        # doubt and just picking a bitsize for them.
+        if minbits > preferredbits:
+            minbits = preferredbits
+        if maxbits < preferredbits:
+            maxbits = preferredbits
+        # now save a copy
+        self.min_bits = minbits
+        self.preferred_bits = preferredbits
+        self.max_bits = maxbits
+        # generate prime
+        pack = self.transport._get_modulus_pack()
+        if pack is None:
+            raise SSHException("Can't do server-side gex with no modulus pack")
+        self.transport._log(
+            DEBUG,  # noqa
+            "Picking p ({} <= {} <= {} bits)".format(
+                minbits, preferredbits, maxbits
+            ),
+        )
+        self.g, self.p = pack.get_modulus(minbits, preferredbits, maxbits)
+        m = Message()
+        m.add_byte(c_MSG_KEXGSS_GROUP)
+        m.add_mpint(self.p)
+        m.add_mpint(self.g)
+        self.transport._send_message(m)
+        self.transport._expect_packet(MSG_KEXGSS_INIT)
+
+    def _parse_kexgss_group(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_GROUP message (client mode).
+
+        :param `Message` m: The content of the SSH2_MSG_KEXGSS_GROUP message
+        """
+        self.p = m.get_mpint()
+        self.g = m.get_mpint()
+        # reject if p's bit length < 1024 or > 8192
+        bitlen = util.bit_length(self.p)
+        if (bitlen < 1024) or (bitlen > 8192):
+            raise SSHException(
+                "Server-generated gex p (don't ask) is out of range "
+                "({} bits)".format(bitlen)
+            )
+        self.transport._log(
+            DEBUG, "Got server p ({} bits)".format(bitlen)
+        )  # noqa
+        self._generate_x()
+        # now compute e = g^x mod p
+        self.e = pow(self.g, self.x, self.p)
+        m = Message()
+        m.add_byte(c_MSG_KEXGSS_INIT)
+        m.add_string(self.kexgss.ssh_init_sec_context(target=self.gss_host))
+        m.add_mpint(self.e)
+        self.transport._send_message(m)
+        self.transport._expect_packet(
+            MSG_KEXGSS_HOSTKEY,
+            MSG_KEXGSS_CONTINUE,
+            MSG_KEXGSS_COMPLETE,
+            MSG_KEXGSS_ERROR,
+        )
+
+    def _parse_kexgss_gex_init(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_INIT message (server mode).
+
+        :param `Message` m: The content of the SSH2_MSG_KEXGSS_INIT message
+        """
+        client_token = m.get_string()
+        self.e = m.get_mpint()
+        if (self.e < 1) or (self.e > self.p - 1):
+            raise SSHException('Client kex "e" is out of range')
+        self._generate_x()
+        self.f = pow(self.g, self.x, self.p)
+        K = pow(self.e, self.x, self.p)
+        self.transport.host_key = NullHostKey()
+        key = self.transport.host_key.__str__()
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K)  # noqa
+        hm = Message()
+        hm.add(
+            self.transport.remote_version,
+            self.transport.local_version,
+            self.transport.remote_kex_init,
+            self.transport.local_kex_init,
+            key,
+        )
+        hm.add_int(self.min_bits)
+        hm.add_int(self.preferred_bits)
+        hm.add_int(self.max_bits)
+        hm.add_mpint(self.p)
+        hm.add_mpint(self.g)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = sha1(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        srv_token = self.kexgss.ssh_accept_sec_context(
+            self.gss_host, client_token
+        )
+        m = Message()
+        if self.kexgss._gss_srv_ctxt_status:
+            mic_token = self.kexgss.ssh_get_mic(
+                self.transport.session_id, gss_kex=True
+            )
+            m.add_byte(c_MSG_KEXGSS_COMPLETE)
+            m.add_mpint(self.f)
+            m.add_string(mic_token)
+            if srv_token is not None:
+                m.add_boolean(True)
+                m.add_string(srv_token)
+            else:
+                m.add_boolean(False)
+            self.transport._send_message(m)
+            self.transport.gss_kex_used = True
+            self.transport._activate_outbound()
+        else:
+            m.add_byte(c_MSG_KEXGSS_CONTINUE)
+            m.add_string(srv_token)
+            self.transport._send_message(m)
+            self.transport._expect_packet(
+                MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE, MSG_KEXGSS_ERROR
+            )
+
+    def _parse_kexgss_hostkey(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_HOSTKEY message (client mode).
+
+        :param `Message` m: The content of the SSH2_MSG_KEXGSS_HOSTKEY message
+        """
+        # client mode
+        host_key = m.get_string()
+        self.transport.host_key = host_key
+        sig = m.get_string()
+        self.transport._verify_key(host_key, sig)
+        self.transport._expect_packet(MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE)
+
+    def _parse_kexgss_continue(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_CONTINUE message.
+
+        :param `Message` m: The content of the SSH2_MSG_KEXGSS_CONTINUE message
+        """
+        if not self.transport.server_mode:
+            srv_token = m.get_string()
+            m = Message()
+            m.add_byte(c_MSG_KEXGSS_CONTINUE)
+            m.add_string(
+                self.kexgss.ssh_init_sec_context(
+                    target=self.gss_host, recv_token=srv_token
+                )
+            )
+            self.transport.send_message(m)
+            self.transport._expect_packet(
+                MSG_KEXGSS_CONTINUE, MSG_KEXGSS_COMPLETE, MSG_KEXGSS_ERROR
+            )
+        else:
+            pass
+
+    def _parse_kexgss_complete(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_COMPLETE message (client mode).
+
+        :param `Message` m: The content of the SSH2_MSG_KEXGSS_COMPLETE message
+        """
+        if self.transport.host_key is None:
+            self.transport.host_key = NullHostKey()
+        self.f = m.get_mpint()
+        mic_token = m.get_string()
+        # This must be TRUE, if there is a GSS-API token in this message.
+        bool = m.get_boolean()
+        srv_token = None
+        if bool:
+            srv_token = m.get_string()
+        if (self.f < 1) or (self.f > self.p - 1):
+            raise SSHException('Server kex "f" is out of range')
+        K = pow(self.f, self.x, self.p)
+        # okay, build up the hash H of
+        # (V_C || V_S || I_C || I_S || K_S || min || n || max || p || g || e || f || K)  # noqa
+        hm = Message()
+        hm.add(
+            self.transport.local_version,
+            self.transport.remote_version,
+            self.transport.local_kex_init,
+            self.transport.remote_kex_init,
+            self.transport.host_key.__str__(),
+        )
+        if not self.old_style:
+            hm.add_int(self.min_bits)
+        hm.add_int(self.preferred_bits)
+        if not self.old_style:
+            hm.add_int(self.max_bits)
+        hm.add_mpint(self.p)
+        hm.add_mpint(self.g)
+        hm.add_mpint(self.e)
+        hm.add_mpint(self.f)
+        hm.add_mpint(K)
+        H = sha1(hm.asbytes()).digest()
+        self.transport._set_K_H(K, H)
+        if srv_token is not None:
+            self.kexgss.ssh_init_sec_context(
+                target=self.gss_host, recv_token=srv_token
+            )
+            self.kexgss.ssh_check_mic(mic_token, H)
+        else:
+            self.kexgss.ssh_check_mic(mic_token, H)
+        self.transport.gss_kex_used = True
+        self.transport._activate_outbound()
+
+    def _parse_kexgss_error(self, m):
+        """
+        Parse the SSH2_MSG_KEXGSS_ERROR message (client mode).
+        The server may send a GSS-API error message. if it does, we display
+        the error by throwing an exception (client mode).
+
+        :param `Message` m:  The content of the SSH2_MSG_KEXGSS_ERROR message
+        :raise SSHException: Contains GSS-API major and minor status as well as
+                             the error message and the language tag of the
+                             message
+        """
+        maj_status = m.get_int()
+        min_status = m.get_int()
+        err_msg = m.get_string()
+        m.get_string()  # we don't care about the language (lang_tag)!
+        raise SSHException(
+            """GSS-API Error:
+Major Status: {}
+Minor Status: {}
+Error Message: {}
+""".format(
+                maj_status, min_status, err_msg
+            )
+        )
+
+
+class NullHostKey:
+    """
+    This class represents the Null Host Key for GSS-API Key Exchange as defined
+    in `RFC 4462 Section 5
+    <https://tools.ietf.org/html/rfc4462.html#section-5>`_
+    """
+
+    def __init__(self):
+        self.key = ""
+
+    def __str__(self):
+        return self.key
+
+    def get_name(self):
+        return self.key
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/message.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/message.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c2b3bd0b396f74e9dd163300e427410f31a3b8f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/message.py
@@ -0,0 +1,318 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Implementation of an SSH2 "message".
+"""
+
+import struct
+from io import BytesIO
+
+from paramiko import util
+from paramiko.common import zero_byte, max_byte, one_byte
+from paramiko.util import u
+
+
+class Message:
+    """
+    An SSH2 message is a stream of bytes that encodes some combination of
+    strings, integers, bools, and infinite-precision integers.  This class
+    builds or breaks down such a byte stream.
+
+    Normally you don't need to deal with anything this low-level, but it's
+    exposed for people implementing custom extensions, or features that
+    paramiko doesn't support yet.
+    """
+
+    big_int = 0xFF000000
+
+    def __init__(self, content=None):
+        """
+        Create a new SSH2 message.
+
+        :param bytes content:
+            the byte stream to use as the message content (passed in only when
+            decomposing a message).
+        """
+        if content is not None:
+            self.packet = BytesIO(content)
+        else:
+            self.packet = BytesIO()
+
+    def __bytes__(self):
+        return self.asbytes()
+
+    def __repr__(self):
+        """
+        Returns a string representation of this object, for debugging.
+        """
+        return "paramiko.Message(" + repr(self.packet.getvalue()) + ")"
+
+    # TODO 4.0: just merge into __bytes__ (everywhere)
+    def asbytes(self):
+        """
+        Return the byte stream content of this Message, as a `bytes`.
+        """
+        return self.packet.getvalue()
+
+    def rewind(self):
+        """
+        Rewind the message to the beginning as if no items had been parsed
+        out of it yet.
+        """
+        self.packet.seek(0)
+
+    def get_remainder(self):
+        """
+        Return the `bytes` of this message that haven't already been parsed and
+        returned.
+        """
+        position = self.packet.tell()
+        remainder = self.packet.read()
+        self.packet.seek(position)
+        return remainder
+
+    def get_so_far(self):
+        """
+        Returns the `bytes` of this message that have been parsed and
+        returned. The string passed into a message's constructor can be
+        regenerated by concatenating ``get_so_far`` and `get_remainder`.
+        """
+        position = self.packet.tell()
+        self.rewind()
+        return self.packet.read(position)
+
+    def get_bytes(self, n):
+        """
+        Return the next ``n`` bytes of the message, without decomposing into an
+        int, decoded string, etc.  Just the raw bytes are returned. Returns a
+        string of ``n`` zero bytes if there weren't ``n`` bytes remaining in
+        the message.
+        """
+        b = self.packet.read(n)
+        max_pad_size = 1 << 20  # Limit padding to 1 MB
+        if len(b) < n < max_pad_size:
+            return b + zero_byte * (n - len(b))
+        return b
+
+    def get_byte(self):
+        """
+        Return the next byte of the message, without decomposing it.  This
+        is equivalent to `get_bytes(1) <get_bytes>`.
+
+        :return:
+            the next (`bytes`) byte of the message, or ``b'\000'`` if there
+            aren't any bytes remaining.
+        """
+        return self.get_bytes(1)
+
+    def get_boolean(self):
+        """
+        Fetch a boolean from the stream.
+        """
+        b = self.get_bytes(1)
+        return b != zero_byte
+
+    def get_adaptive_int(self):
+        """
+        Fetch an int from the stream.
+
+        :return: a 32-bit unsigned `int`.
+        """
+        byte = self.get_bytes(1)
+        if byte == max_byte:
+            return util.inflate_long(self.get_binary())
+        byte += self.get_bytes(3)
+        return struct.unpack(">I", byte)[0]
+
+    def get_int(self):
+        """
+        Fetch an int from the stream.
+        """
+        return struct.unpack(">I", self.get_bytes(4))[0]
+
+    def get_int64(self):
+        """
+        Fetch a 64-bit int from the stream.
+
+        :return: a 64-bit unsigned integer (`int`).
+        """
+        return struct.unpack(">Q", self.get_bytes(8))[0]
+
+    def get_mpint(self):
+        """
+        Fetch a long int (mpint) from the stream.
+
+        :return: an arbitrary-length integer (`int`).
+        """
+        return util.inflate_long(self.get_binary())
+
+    # TODO 4.0: depending on where this is used internally or downstream, force
+    # users to specify get_binary instead and delete this.
+    def get_string(self):
+        """
+        Fetch a "string" from the stream.  This will actually be a `bytes`
+        object, and may contain unprintable characters.  (It's not unheard of
+        for a string to contain another byte-stream message.)
+        """
+        return self.get_bytes(self.get_int())
+
+    # TODO 4.0: also consider having this take over the get_string name, and
+    # remove this name instead.
+    def get_text(self):
+        """
+        Fetch a Unicode string from the stream.
+
+        This currently operates by attempting to encode the next "string" as
+        ``utf-8``.
+        """
+        return u(self.get_string())
+
+    def get_binary(self):
+        """
+        Alias for `get_string` (obtains a bytestring).
+        """
+        return self.get_bytes(self.get_int())
+
+    def get_list(self):
+        """
+        Fetch a list of `strings <str>` from the stream.
+
+        These are trivially encoded as comma-separated values in a string.
+        """
+        return self.get_text().split(",")
+
+    def add_bytes(self, b):
+        """
+        Write bytes to the stream, without any formatting.
+
+        :param bytes b: bytes to add
+        """
+        self.packet.write(b)
+        return self
+
+    def add_byte(self, b):
+        """
+        Write a single byte to the stream, without any formatting.
+
+        :param bytes b: byte to add
+        """
+        self.packet.write(b)
+        return self
+
+    def add_boolean(self, b):
+        """
+        Add a boolean value to the stream.
+
+        :param bool b: boolean value to add
+        """
+        if b:
+            self.packet.write(one_byte)
+        else:
+            self.packet.write(zero_byte)
+        return self
+
+    def add_int(self, n):
+        """
+        Add an integer to the stream.
+
+        :param int n: integer to add
+        """
+        self.packet.write(struct.pack(">I", n))
+        return self
+
+    def add_adaptive_int(self, n):
+        """
+        Add an integer to the stream.
+
+        :param int n: integer to add
+        """
+        if n >= Message.big_int:
+            self.packet.write(max_byte)
+            self.add_string(util.deflate_long(n))
+        else:
+            self.packet.write(struct.pack(">I", n))
+        return self
+
+    def add_int64(self, n):
+        """
+        Add a 64-bit int to the stream.
+
+        :param int n: long int to add
+        """
+        self.packet.write(struct.pack(">Q", n))
+        return self
+
+    def add_mpint(self, z):
+        """
+        Add a long int to the stream, encoded as an infinite-precision
+        integer.  This method only works on positive numbers.
+
+        :param int z: long int to add
+        """
+        self.add_string(util.deflate_long(z))
+        return self
+
+    # TODO: see the TODO for get_string/get_text/et al, this should change
+    # to match.
+    def add_string(self, s):
+        """
+        Add a bytestring to the stream.
+
+        :param byte s: bytestring to add
+        """
+        s = util.asbytes(s)
+        self.add_int(len(s))
+        self.packet.write(s)
+        return self
+
+    def add_list(self, l):  # noqa: E741
+        """
+        Add a list of strings to the stream.  They are encoded identically to
+        a single string of values separated by commas.  (Yes, really, that's
+        how SSH2 does it.)
+
+        :param l: list of strings to add
+        """
+        self.add_string(",".join(l))
+        return self
+
+    def _add(self, i):
+        if type(i) is bool:
+            return self.add_boolean(i)
+        elif isinstance(i, int):
+            return self.add_adaptive_int(i)
+        elif type(i) is list:
+            return self.add_list(i)
+        else:
+            return self.add_string(i)
+
+    # TODO: this would never have worked for unicode strings under Python 3,
+    # guessing nobody/nothing ever used it for that purpose?
+    def add(self, *seq):
+        """
+        Add a sequence of items to the stream.  The values are encoded based
+        on their type: bytes, str, int, bool, or list.
+
+        .. warning::
+            Longs are encoded non-deterministically.  Don't use this method.
+
+        :param seq: the sequence of items
+        """
+        for item in seq:
+            self._add(item)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/packet.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/packet.py
new file mode 100644
index 0000000000000000000000000000000000000000..e40355e3900fc41d9b4e5c1ffd44c861c4e4e6ac
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/packet.py
@@ -0,0 +1,634 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Packet handling
+"""
+
+import errno
+import os
+import socket
+import struct
+import threading
+import time
+from hmac import HMAC
+
+from paramiko import util
+from paramiko.common import (
+    linefeed_byte,
+    cr_byte_value,
+    MSG_NAMES,
+    DEBUG,
+    xffffffff,
+    zero_byte,
+    byte_ord,
+)
+from paramiko.util import u
+from paramiko.ssh_exception import SSHException, ProxyCommandFailure
+from paramiko.message import Message
+
+
+def compute_hmac(key, message, digest_class):
+    return HMAC(key, message, digest_class).digest()
+
+
+class NeedRekeyException(Exception):
+    """
+    Exception indicating a rekey is needed.
+    """
+
+    pass
+
+
+def first_arg(e):
+    arg = None
+    if type(e.args) is tuple and len(e.args) > 0:
+        arg = e.args[0]
+    return arg
+
+
+class Packetizer:
+    """
+    Implementation of the base SSH packet protocol.
+    """
+
+    # READ the secsh RFC's before raising these values.  if anything,
+    # they should probably be lower.
+    REKEY_PACKETS = pow(2, 29)
+    REKEY_BYTES = pow(2, 29)
+
+    # Allow receiving this many packets after a re-key request before
+    # terminating
+    REKEY_PACKETS_OVERFLOW_MAX = pow(2, 29)
+    # Allow receiving this many bytes after a re-key request before terminating
+    REKEY_BYTES_OVERFLOW_MAX = pow(2, 29)
+
+    def __init__(self, socket):
+        self.__socket = socket
+        self.__logger = None
+        self.__closed = False
+        self.__dump_packets = False
+        self.__need_rekey = False
+        self.__init_count = 0
+        self.__remainder = bytes()
+
+        # used for noticing when to re-key:
+        self.__sent_bytes = 0
+        self.__sent_packets = 0
+        self.__received_bytes = 0
+        self.__received_packets = 0
+        self.__received_bytes_overflow = 0
+        self.__received_packets_overflow = 0
+
+        # current inbound/outbound ciphering:
+        self.__block_size_out = 8
+        self.__block_size_in = 8
+        self.__mac_size_out = 0
+        self.__mac_size_in = 0
+        self.__block_engine_out = None
+        self.__block_engine_in = None
+        self.__sdctr_out = False
+        self.__mac_engine_out = None
+        self.__mac_engine_in = None
+        self.__mac_key_out = bytes()
+        self.__mac_key_in = bytes()
+        self.__compress_engine_out = None
+        self.__compress_engine_in = None
+        self.__sequence_number_out = 0
+        self.__sequence_number_in = 0
+        self.__etm_out = False
+        self.__etm_in = False
+
+        # lock around outbound writes (packet computation)
+        self.__write_lock = threading.RLock()
+
+        # keepalives:
+        self.__keepalive_interval = 0
+        self.__keepalive_last = time.time()
+        self.__keepalive_callback = None
+
+        self.__timer = None
+        self.__handshake_complete = False
+        self.__timer_expired = False
+
+    @property
+    def closed(self):
+        return self.__closed
+
+    def set_log(self, log):
+        """
+        Set the Python log object to use for logging.
+        """
+        self.__logger = log
+
+    def set_outbound_cipher(
+        self,
+        block_engine,
+        block_size,
+        mac_engine,
+        mac_size,
+        mac_key,
+        sdctr=False,
+        etm=False,
+    ):
+        """
+        Switch outbound data cipher.
+        :param etm: Set encrypt-then-mac from OpenSSH
+        """
+        self.__block_engine_out = block_engine
+        self.__sdctr_out = sdctr
+        self.__block_size_out = block_size
+        self.__mac_engine_out = mac_engine
+        self.__mac_size_out = mac_size
+        self.__mac_key_out = mac_key
+        self.__sent_bytes = 0
+        self.__sent_packets = 0
+        self.__etm_out = etm
+        # wait until the reset happens in both directions before clearing
+        # rekey flag
+        self.__init_count |= 1
+        if self.__init_count == 3:
+            self.__init_count = 0
+            self.__need_rekey = False
+
+    def set_inbound_cipher(
+        self,
+        block_engine,
+        block_size,
+        mac_engine,
+        mac_size,
+        mac_key,
+        etm=False,
+    ):
+        """
+        Switch inbound data cipher.
+        :param etm: Set encrypt-then-mac from OpenSSH
+        """
+        self.__block_engine_in = block_engine
+        self.__block_size_in = block_size
+        self.__mac_engine_in = mac_engine
+        self.__mac_size_in = mac_size
+        self.__mac_key_in = mac_key
+        self.__received_bytes = 0
+        self.__received_packets = 0
+        self.__received_bytes_overflow = 0
+        self.__received_packets_overflow = 0
+        self.__etm_in = etm
+        # wait until the reset happens in both directions before clearing
+        # rekey flag
+        self.__init_count |= 2
+        if self.__init_count == 3:
+            self.__init_count = 0
+            self.__need_rekey = False
+
+    def set_outbound_compressor(self, compressor):
+        self.__compress_engine_out = compressor
+
+    def set_inbound_compressor(self, compressor):
+        self.__compress_engine_in = compressor
+
+    def close(self):
+        self.__closed = True
+        self.__socket.close()
+
+    def set_hexdump(self, hexdump):
+        self.__dump_packets = hexdump
+
+    def get_hexdump(self):
+        return self.__dump_packets
+
+    def get_mac_size_in(self):
+        return self.__mac_size_in
+
+    def get_mac_size_out(self):
+        return self.__mac_size_out
+
+    def need_rekey(self):
+        """
+        Returns ``True`` if a new set of keys needs to be negotiated.  This
+        will be triggered during a packet read or write, so it should be
+        checked after every read or write, or at least after every few.
+        """
+        return self.__need_rekey
+
+    def set_keepalive(self, interval, callback):
+        """
+        Turn on/off the callback keepalive.  If ``interval`` seconds pass with
+        no data read from or written to the socket, the callback will be
+        executed and the timer will be reset.
+        """
+        self.__keepalive_interval = interval
+        self.__keepalive_callback = callback
+        self.__keepalive_last = time.time()
+
+    def read_timer(self):
+        self.__timer_expired = True
+
+    def start_handshake(self, timeout):
+        """
+        Tells `Packetizer` that the handshake process started.
+        Starts a book keeping timer that can signal a timeout in the
+        handshake process.
+
+        :param float timeout: amount of seconds to wait before timing out
+        """
+        if not self.__timer:
+            self.__timer = threading.Timer(float(timeout), self.read_timer)
+            self.__timer.start()
+
+    def handshake_timed_out(self):
+        """
+        Checks if the handshake has timed out.
+
+        If `start_handshake` wasn't called before the call to this function,
+        the return value will always be `False`. If the handshake completed
+        before a timeout was reached, the return value will be `False`
+
+        :return: handshake time out status, as a `bool`
+        """
+        if not self.__timer:
+            return False
+        if self.__handshake_complete:
+            return False
+        return self.__timer_expired
+
+    def complete_handshake(self):
+        """
+        Tells `Packetizer` that the handshake has completed.
+        """
+        if self.__timer:
+            self.__timer.cancel()
+            self.__timer_expired = False
+            self.__handshake_complete = True
+
+    def read_all(self, n, check_rekey=False):
+        """
+        Read as close to N bytes as possible, blocking as long as necessary.
+
+        :param int n: number of bytes to read
+        :return: the data read, as a `str`
+
+        :raises:
+            ``EOFError`` -- if the socket was closed before all the bytes could
+            be read
+        """
+        out = bytes()
+        # handle over-reading from reading the banner line
+        if len(self.__remainder) > 0:
+            out = self.__remainder[:n]
+            self.__remainder = self.__remainder[n:]
+            n -= len(out)
+        while n > 0:
+            got_timeout = False
+            if self.handshake_timed_out():
+                raise EOFError()
+            try:
+                x = self.__socket.recv(n)
+                if len(x) == 0:
+                    raise EOFError()
+                out += x
+                n -= len(x)
+            except socket.timeout:
+                got_timeout = True
+            except socket.error as e:
+                # on Linux, sometimes instead of socket.timeout, we get
+                # EAGAIN.  this is a bug in recent (> 2.6.9) kernels but
+                # we need to work around it.
+                arg = first_arg(e)
+                if arg == errno.EAGAIN:
+                    got_timeout = True
+                elif self.__closed:
+                    raise EOFError()
+                else:
+                    raise
+            if got_timeout:
+                if self.__closed:
+                    raise EOFError()
+                if check_rekey and (len(out) == 0) and self.__need_rekey:
+                    raise NeedRekeyException()
+                self._check_keepalive()
+        return out
+
+    def write_all(self, out):
+        self.__keepalive_last = time.time()
+        iteration_with_zero_as_return_value = 0
+        while len(out) > 0:
+            retry_write = False
+            try:
+                n = self.__socket.send(out)
+            except socket.timeout:
+                retry_write = True
+            except socket.error as e:
+                arg = first_arg(e)
+                if arg == errno.EAGAIN:
+                    retry_write = True
+                else:
+                    n = -1
+            except ProxyCommandFailure:
+                raise  # so it doesn't get swallowed by the below catchall
+            except Exception:
+                # could be: (32, 'Broken pipe')
+                n = -1
+            if retry_write:
+                n = 0
+                if self.__closed:
+                    n = -1
+            else:
+                if n == 0 and iteration_with_zero_as_return_value > 10:
+                    # We shouldn't retry the write, but we didn't
+                    # manage to send anything over the socket. This might be an
+                    # indication that we have lost contact with the remote
+                    # side, but are yet to receive an EOFError or other socket
+                    # errors. Let's give it some iteration to try and catch up.
+                    n = -1
+                iteration_with_zero_as_return_value += 1
+            if n < 0:
+                raise EOFError()
+            if n == len(out):
+                break
+            out = out[n:]
+        return
+
+    def readline(self, timeout):
+        """
+        Read a line from the socket.  We assume no data is pending after the
+        line, so it's okay to attempt large reads.
+        """
+        buf = self.__remainder
+        while linefeed_byte not in buf:
+            buf += self._read_timeout(timeout)
+        n = buf.index(linefeed_byte)
+        self.__remainder = buf[n + 1 :]
+        buf = buf[:n]
+        if (len(buf) > 0) and (buf[-1] == cr_byte_value):
+            buf = buf[:-1]
+        return u(buf)
+
+    def send_message(self, data):
+        """
+        Write a block of data using the current cipher, as an SSH block.
+        """
+        # encrypt this sucka
+        data = data.asbytes()
+        cmd = byte_ord(data[0])
+        if cmd in MSG_NAMES:
+            cmd_name = MSG_NAMES[cmd]
+        else:
+            cmd_name = "${:x}".format(cmd)
+        orig_len = len(data)
+        self.__write_lock.acquire()
+        try:
+            if self.__compress_engine_out is not None:
+                data = self.__compress_engine_out(data)
+            packet = self._build_packet(data)
+            if self.__dump_packets:
+                self._log(
+                    DEBUG,
+                    "Write packet <{}>, length {}".format(cmd_name, orig_len),
+                )
+                self._log(DEBUG, util.format_binary(packet, "OUT: "))
+            if self.__block_engine_out is not None:
+                if self.__etm_out:
+                    # packet length is not encrypted in EtM
+                    out = packet[0:4] + self.__block_engine_out.update(
+                        packet[4:]
+                    )
+                else:
+                    out = self.__block_engine_out.update(packet)
+            else:
+                out = packet
+            # + mac
+            if self.__block_engine_out is not None:
+                packed = struct.pack(">I", self.__sequence_number_out)
+                payload = packed + (out if self.__etm_out else packet)
+                out += compute_hmac(
+                    self.__mac_key_out, payload, self.__mac_engine_out
+                )[: self.__mac_size_out]
+            self.__sequence_number_out = (
+                self.__sequence_number_out + 1
+            ) & xffffffff
+            self.write_all(out)
+
+            self.__sent_bytes += len(out)
+            self.__sent_packets += 1
+            sent_too_much = (
+                self.__sent_packets >= self.REKEY_PACKETS
+                or self.__sent_bytes >= self.REKEY_BYTES
+            )
+            if sent_too_much and not self.__need_rekey:
+                # only ask once for rekeying
+                msg = "Rekeying (hit {} packets, {} bytes sent)"
+                self._log(
+                    DEBUG, msg.format(self.__sent_packets, self.__sent_bytes)
+                )
+                self.__received_bytes_overflow = 0
+                self.__received_packets_overflow = 0
+                self._trigger_rekey()
+        finally:
+            self.__write_lock.release()
+
+    def read_message(self):
+        """
+        Only one thread should ever be in this function (no other locking is
+        done).
+
+        :raises: `.SSHException` -- if the packet is mangled
+        :raises: `.NeedRekeyException` -- if the transport should rekey
+        """
+        header = self.read_all(self.__block_size_in, check_rekey=True)
+        if self.__etm_in:
+            packet_size = struct.unpack(">I", header[:4])[0]
+            remaining = packet_size - self.__block_size_in + 4
+            packet = header[4:] + self.read_all(remaining, check_rekey=False)
+            mac = self.read_all(self.__mac_size_in, check_rekey=False)
+            mac_payload = (
+                struct.pack(">II", self.__sequence_number_in, packet_size)
+                + packet
+            )
+            my_mac = compute_hmac(
+                self.__mac_key_in, mac_payload, self.__mac_engine_in
+            )[: self.__mac_size_in]
+            if not util.constant_time_bytes_eq(my_mac, mac):
+                raise SSHException("Mismatched MAC")
+            header = packet
+
+        if self.__block_engine_in is not None:
+            header = self.__block_engine_in.update(header)
+        if self.__dump_packets:
+            self._log(DEBUG, util.format_binary(header, "IN: "))
+
+        # When ETM is in play, we've already read the packet size & decrypted
+        # everything, so just set the packet back to the header we obtained.
+        if self.__etm_in:
+            packet = header
+        # Otherwise, use the older non-ETM logic
+        else:
+            packet_size = struct.unpack(">I", header[:4])[0]
+
+            # leftover contains decrypted bytes from the first block (after the
+            # length field)
+            leftover = header[4:]
+            if (packet_size - len(leftover)) % self.__block_size_in != 0:
+                raise SSHException("Invalid packet blocking")
+            buf = self.read_all(
+                packet_size + self.__mac_size_in - len(leftover)
+            )
+            packet = buf[: packet_size - len(leftover)]
+            post_packet = buf[packet_size - len(leftover) :]
+
+            if self.__block_engine_in is not None:
+                packet = self.__block_engine_in.update(packet)
+            packet = leftover + packet
+
+        if self.__dump_packets:
+            self._log(DEBUG, util.format_binary(packet, "IN: "))
+
+        if self.__mac_size_in > 0 and not self.__etm_in:
+            mac = post_packet[: self.__mac_size_in]
+            mac_payload = (
+                struct.pack(">II", self.__sequence_number_in, packet_size)
+                + packet
+            )
+            my_mac = compute_hmac(
+                self.__mac_key_in, mac_payload, self.__mac_engine_in
+            )[: self.__mac_size_in]
+            if not util.constant_time_bytes_eq(my_mac, mac):
+                raise SSHException("Mismatched MAC")
+        padding = byte_ord(packet[0])
+        payload = packet[1 : packet_size - padding]
+
+        if self.__dump_packets:
+            self._log(
+                DEBUG,
+                "Got payload ({} bytes, {} padding)".format(
+                    packet_size, padding
+                ),
+            )
+
+        if self.__compress_engine_in is not None:
+            payload = self.__compress_engine_in(payload)
+
+        msg = Message(payload[1:])
+        msg.seqno = self.__sequence_number_in
+        self.__sequence_number_in = (self.__sequence_number_in + 1) & xffffffff
+
+        # check for rekey
+        raw_packet_size = packet_size + self.__mac_size_in + 4
+        self.__received_bytes += raw_packet_size
+        self.__received_packets += 1
+        if self.__need_rekey:
+            # we've asked to rekey -- give them some packets to comply before
+            # dropping the connection
+            self.__received_bytes_overflow += raw_packet_size
+            self.__received_packets_overflow += 1
+            if (
+                self.__received_packets_overflow
+                >= self.REKEY_PACKETS_OVERFLOW_MAX
+            ) or (
+                self.__received_bytes_overflow >= self.REKEY_BYTES_OVERFLOW_MAX
+            ):
+                raise SSHException(
+                    "Remote transport is ignoring rekey requests"
+                )
+        elif (self.__received_packets >= self.REKEY_PACKETS) or (
+            self.__received_bytes >= self.REKEY_BYTES
+        ):
+            # only ask once for rekeying
+            err = "Rekeying (hit {} packets, {} bytes received)"
+            self._log(
+                DEBUG,
+                err.format(self.__received_packets, self.__received_bytes),
+            )
+            self.__received_bytes_overflow = 0
+            self.__received_packets_overflow = 0
+            self._trigger_rekey()
+
+        cmd = byte_ord(payload[0])
+        if cmd in MSG_NAMES:
+            cmd_name = MSG_NAMES[cmd]
+        else:
+            cmd_name = "${:x}".format(cmd)
+        if self.__dump_packets:
+            self._log(
+                DEBUG,
+                "Read packet <{}>, length {}".format(cmd_name, len(payload)),
+            )
+        return cmd, msg
+
+    # ...protected...
+
+    def _log(self, level, msg):
+        if self.__logger is None:
+            return
+        if issubclass(type(msg), list):
+            for m in msg:
+                self.__logger.log(level, m)
+        else:
+            self.__logger.log(level, msg)
+
+    def _check_keepalive(self):
+        if (
+            not self.__keepalive_interval
+            or not self.__block_engine_out
+            or self.__need_rekey
+        ):
+            # wait till we're encrypting, and not in the middle of rekeying
+            return
+        now = time.time()
+        if now > self.__keepalive_last + self.__keepalive_interval:
+            self.__keepalive_callback()
+            self.__keepalive_last = now
+
+    def _read_timeout(self, timeout):
+        start = time.time()
+        while True:
+            try:
+                x = self.__socket.recv(128)
+                if len(x) == 0:
+                    raise EOFError()
+                break
+            except socket.timeout:
+                pass
+            if self.__closed:
+                raise EOFError()
+            now = time.time()
+            if now - start >= timeout:
+                raise socket.timeout()
+        return x
+
+    def _build_packet(self, payload):
+        # pad up at least 4 bytes, to nearest block-size (usually 8)
+        bsize = self.__block_size_out
+        # do not include payload length in computations for padding in EtM mode
+        # (payload length won't be encrypted)
+        addlen = 4 if self.__etm_out else 8
+        padding = 3 + bsize - ((len(payload) + addlen) % bsize)
+        packet = struct.pack(">IB", len(payload) + padding + 1, padding)
+        packet += payload
+        if self.__sdctr_out or self.__block_engine_out is None:
+            # cute trick i caught openssh doing: if we're not encrypting or
+            # SDCTR mode (RFC4344),
+            # don't waste random bytes for the padding
+            packet += zero_byte * padding
+        else:
+            packet += os.urandom(padding)
+        return packet
+
+    def _trigger_rekey(self):
+        # outside code should check for this flag
+        self.__need_rekey = True
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/pipe.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/pipe.py
new file mode 100644
index 0000000000000000000000000000000000000000..65944fad3cb8418146b6b706a6efd9e161b08457
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/pipe.py
@@ -0,0 +1,148 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Abstraction of a one-way pipe where the read end can be used in
+`select.select`. Normally this is trivial, but Windows makes it nearly
+impossible.
+
+The pipe acts like an Event, which can be set or cleared. When set, the pipe
+will trigger as readable in `select <select.select>`.
+"""
+
+import sys
+import os
+import socket
+
+
+def make_pipe():
+    if sys.platform[:3] != "win":
+        p = PosixPipe()
+    else:
+        p = WindowsPipe()
+    return p
+
+
+class PosixPipe:
+    def __init__(self):
+        self._rfd, self._wfd = os.pipe()
+        self._set = False
+        self._forever = False
+        self._closed = False
+
+    def close(self):
+        os.close(self._rfd)
+        os.close(self._wfd)
+        # used for unit tests:
+        self._closed = True
+
+    def fileno(self):
+        return self._rfd
+
+    def clear(self):
+        if not self._set or self._forever:
+            return
+        os.read(self._rfd, 1)
+        self._set = False
+
+    def set(self):
+        if self._set or self._closed:
+            return
+        self._set = True
+        os.write(self._wfd, b"*")
+
+    def set_forever(self):
+        self._forever = True
+        self.set()
+
+
+class WindowsPipe:
+    """
+    On Windows, only an OS-level "WinSock" may be used in select(), but reads
+    and writes must be to the actual socket object.
+    """
+
+    def __init__(self):
+        serv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        serv.bind(("127.0.0.1", 0))
+        serv.listen(1)
+
+        # need to save sockets in _rsock/_wsock so they don't get closed
+        self._rsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+        self._rsock.connect(("127.0.0.1", serv.getsockname()[1]))
+
+        self._wsock, addr = serv.accept()
+        serv.close()
+        self._set = False
+        self._forever = False
+        self._closed = False
+
+    def close(self):
+        self._rsock.close()
+        self._wsock.close()
+        # used for unit tests:
+        self._closed = True
+
+    def fileno(self):
+        return self._rsock.fileno()
+
+    def clear(self):
+        if not self._set or self._forever:
+            return
+        self._rsock.recv(1)
+        self._set = False
+
+    def set(self):
+        if self._set or self._closed:
+            return
+        self._set = True
+        self._wsock.send(b"*")
+
+    def set_forever(self):
+        self._forever = True
+        self.set()
+
+
+class OrPipe:
+    def __init__(self, pipe):
+        self._set = False
+        self._partner = None
+        self._pipe = pipe
+
+    def set(self):
+        self._set = True
+        if not self._partner._set:
+            self._pipe.set()
+
+    def clear(self):
+        self._set = False
+        if not self._partner._set:
+            self._pipe.clear()
+
+
+def make_or_pipe(pipe):
+    """
+    wraps a pipe into two pipe-like objects which are "or"d together to
+    affect the real pipe. if either returned pipe is set, the wrapped pipe
+    is set. when both are cleared, the wrapped pipe is cleared.
+    """
+    p1 = OrPipe(pipe)
+    p2 = OrPipe(pipe)
+    p1._partner = p2
+    p2._partner = p1
+    return p1, p2
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/pkey.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/pkey.py
new file mode 100644
index 0000000000000000000000000000000000000000..ef371002a3acdfb8c9dbccc2cdcf7a2d985a6837
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/pkey.py
@@ -0,0 +1,938 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Common API for all public keys.
+"""
+
+import base64
+from base64 import encodebytes, decodebytes
+from binascii import unhexlify
+import os
+from pathlib import Path
+from hashlib import md5, sha256
+import re
+import struct
+
+import bcrypt
+
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives import serialization
+from cryptography.hazmat.primitives.ciphers import algorithms, modes, Cipher
+from cryptography.hazmat.primitives import asymmetric
+
+from paramiko import util
+from paramiko.util import u, b
+from paramiko.common import o600
+from paramiko.ssh_exception import SSHException, PasswordRequiredException
+from paramiko.message import Message
+
+
+OPENSSH_AUTH_MAGIC = b"openssh-key-v1\x00"
+
+
+def _unpad_openssh(data):
+    # At the moment, this is only used for unpadding private keys on disk. This
+    # really ought to be made constant time (possibly by upstreaming this logic
+    # into pyca/cryptography).
+    padding_length = data[-1]
+    if 0x20 <= padding_length < 0x7F:
+        return data  # no padding, last byte part comment (printable ascii)
+    if padding_length > 15:
+        raise SSHException("Invalid key")
+    for i in range(padding_length):
+        if data[i - padding_length] != i + 1:
+            raise SSHException("Invalid key")
+    return data[:-padding_length]
+
+
+class UnknownKeyType(Exception):
+    """
+    An unknown public/private key algorithm was attempted to be read.
+    """
+
+    def __init__(self, key_type=None, key_bytes=None):
+        self.key_type = key_type
+        self.key_bytes = key_bytes
+
+    def __str__(self):
+        return f"UnknownKeyType(type={self.key_type!r}, bytes=<{len(self.key_bytes)}>)"  # noqa
+
+
+class PKey:
+    """
+    Base class for public keys.
+
+    Also includes some "meta" level convenience constructors such as
+    `.from_type_string`.
+    """
+
+    # known encryption types for private key files:
+    _CIPHER_TABLE = {
+        "AES-128-CBC": {
+            "cipher": algorithms.AES,
+            "keysize": 16,
+            "blocksize": 16,
+            "mode": modes.CBC,
+        },
+        "AES-256-CBC": {
+            "cipher": algorithms.AES,
+            "keysize": 32,
+            "blocksize": 16,
+            "mode": modes.CBC,
+        },
+        "DES-EDE3-CBC": {
+            "cipher": algorithms.TripleDES,
+            "keysize": 24,
+            "blocksize": 8,
+            "mode": modes.CBC,
+        },
+    }
+    _PRIVATE_KEY_FORMAT_ORIGINAL = 1
+    _PRIVATE_KEY_FORMAT_OPENSSH = 2
+    BEGIN_TAG = re.compile(
+        r"^-{5}BEGIN (RSA|DSA|EC|OPENSSH) PRIVATE KEY-{5}\s*$"
+    )
+    END_TAG = re.compile(r"^-{5}END (RSA|DSA|EC|OPENSSH) PRIVATE KEY-{5}\s*$")
+
+    @staticmethod
+    def from_path(path, passphrase=None):
+        """
+        Attempt to instantiate appropriate key subclass from given file path.
+
+        :param Path path: The path to load (may also be a `str`).
+
+        :returns:
+            A `PKey` subclass instance.
+
+        :raises:
+            `UnknownKeyType`, if our crypto backend doesn't know this key type.
+
+        .. versionadded:: 3.2
+        """
+        # TODO: make sure sphinx is reading Path right in param list...
+
+        # Lazy import to avoid circular import issues
+        from paramiko import DSSKey, RSAKey, Ed25519Key, ECDSAKey
+
+        # Normalize to string, as cert suffix isn't quite an extension, so
+        # pathlib isn't useful for this.
+        path = str(path)
+
+        # Sort out cert vs key, i.e. it is 'legal' to hand this kind of API
+        # /either/ the key /or/ the cert, when there is a key/cert pair.
+        cert_suffix = "-cert.pub"
+        if str(path).endswith(cert_suffix):
+            key_path = path[: -len(cert_suffix)]
+            cert_path = path
+        else:
+            key_path = path
+            cert_path = path + cert_suffix
+
+        key_path = Path(key_path).expanduser()
+        cert_path = Path(cert_path).expanduser()
+
+        data = key_path.read_bytes()
+        # Like OpenSSH, try modern/OpenSSH-specific key load first
+        try:
+            loaded = serialization.load_ssh_private_key(
+                data=data, password=passphrase
+            )
+        # Then fall back to assuming legacy PEM type
+        except ValueError:
+            loaded = serialization.load_pem_private_key(
+                data=data, password=passphrase
+            )
+        # TODO Python 3.10: match statement? (NOTE: we cannot use a dict
+        # because the results from the loader are literal backend, eg openssl,
+        # private classes, so isinstance tests work but exact 'x class is y'
+        # tests will not work)
+        # TODO: leverage already-parsed/math'd obj to avoid duplicate cpu
+        # cycles? seemingly requires most of our key subclasses to be rewritten
+        # to be cryptography-object-forward. this is still likely faster than
+        # the old SSHClient code that just tried instantiating every class!
+        key_class = None
+        if isinstance(loaded, asymmetric.dsa.DSAPrivateKey):
+            key_class = DSSKey
+        elif isinstance(loaded, asymmetric.rsa.RSAPrivateKey):
+            key_class = RSAKey
+        elif isinstance(loaded, asymmetric.ed25519.Ed25519PrivateKey):
+            key_class = Ed25519Key
+        elif isinstance(loaded, asymmetric.ec.EllipticCurvePrivateKey):
+            key_class = ECDSAKey
+        else:
+            raise UnknownKeyType(key_bytes=data, key_type=loaded.__class__)
+        with key_path.open() as fd:
+            key = key_class.from_private_key(fd, password=passphrase)
+        if cert_path.exists():
+            # load_certificate can take Message, path-str, or value-str
+            key.load_certificate(str(cert_path))
+        return key
+
+    @staticmethod
+    def from_type_string(key_type, key_bytes):
+        """
+        Given type `str` & raw `bytes`, return a `PKey` subclass instance.
+
+        For example, ``PKey.from_type_string("ssh-ed25519", <public bytes>)``
+        will (if successful) return a new `.Ed25519Key`.
+
+        :param str key_type:
+            The key type, eg ``"ssh-ed25519"``.
+        :param bytes key_bytes:
+            The raw byte data forming the key material, as expected by
+            subclasses' ``data`` parameter.
+
+        :returns:
+            A `PKey` subclass instance.
+
+        :raises:
+            `UnknownKeyType`, if no registered classes knew about this type.
+
+        .. versionadded:: 3.2
+        """
+        from paramiko import key_classes
+
+        for key_class in key_classes:
+            if key_type in key_class.identifiers():
+                # TODO: needs to passthru things like passphrase
+                return key_class(data=key_bytes)
+        raise UnknownKeyType(key_type=key_type, key_bytes=key_bytes)
+
+    @classmethod
+    def identifiers(cls):
+        """
+        returns an iterable of key format/name strings this class can handle.
+
+        Most classes only have a single identifier, and thus this default
+        implementation suffices; see `.ECDSAKey` for one example of an
+        override.
+        """
+        return [cls.name]
+
+    # TODO 4.0: make this and subclasses consistent, some of our own
+    # classmethods even assume kwargs we don't define!
+    # TODO 4.0: prob also raise NotImplementedError instead of pass'ing; the
+    # contract is pretty obviously that you need to handle msg/data/filename
+    # appropriately. (If 'pass' is a concession to testing, see about doing the
+    # work to fix the tests instead)
+    def __init__(self, msg=None, data=None):
+        """
+        Create a new instance of this public key type.  If ``msg`` is given,
+        the key's public part(s) will be filled in from the message.  If
+        ``data`` is given, the key's public part(s) will be filled in from
+        the string.
+
+        :param .Message msg:
+            an optional SSH `.Message` containing a public key of this type.
+        :param bytes data:
+            optional, the bytes of a public key of this type
+
+        :raises: `.SSHException` --
+            if a key cannot be created from the ``data`` or ``msg`` given, or
+            no key was passed in.
+        """
+        pass
+
+    # TODO: arguably this might want to be __str__ instead? ehh
+    # TODO: ditto the interplay between showing class name (currently we just
+    # say PKey writ large) and algorithm (usually == class name, but not
+    # always, also sometimes shows certificate-ness)
+    # TODO: if we do change it, we also want to tweak eg AgentKey, as it
+    # currently displays agent-ness with a suffix
+    def __repr__(self):
+        comment = ""
+        # Works for AgentKey, may work for others?
+        if hasattr(self, "comment") and self.comment:
+            comment = f", comment={self.comment!r}"
+        return f"PKey(alg={self.algorithm_name}, bits={self.get_bits()}, fp={self.fingerprint}{comment})"  # noqa
+
+    # TODO 4.0: just merge into __bytes__ (everywhere)
+    def asbytes(self):
+        """
+        Return a string of an SSH `.Message` made up of the public part(s) of
+        this key.  This string is suitable for passing to `__init__` to
+        re-create the key object later.
+        """
+        return bytes()
+
+    def __bytes__(self):
+        return self.asbytes()
+
+    def __eq__(self, other):
+        return isinstance(other, PKey) and self._fields == other._fields
+
+    def __hash__(self):
+        return hash(self._fields)
+
+    @property
+    def _fields(self):
+        raise NotImplementedError
+
+    def get_name(self):
+        """
+        Return the name of this private key implementation.
+
+        :return:
+            name of this private key type, in SSH terminology, as a `str` (for
+            example, ``"ssh-rsa"``).
+        """
+        return ""
+
+    @property
+    def algorithm_name(self):
+        """
+        Return the key algorithm identifier for this key.
+
+        Similar to `get_name`, but aimed at pure algorithm name instead of SSH
+        protocol field value.
+        """
+        # Nuke the leading 'ssh-'
+        # TODO in Python 3.9: use .removeprefix()
+        name = self.get_name().replace("ssh-", "")
+        # Trim any cert suffix (but leave the -cert, as OpenSSH does)
+        cert_tail = "-cert-v01@openssh.com"
+        if cert_tail in name:
+            name = name.replace(cert_tail, "-cert")
+        # Nuke any eg ECDSA suffix, OpenSSH does basically this too.
+        else:
+            name = name.split("-")[0]
+        return name.upper()
+
+    def get_bits(self):
+        """
+        Return the number of significant bits in this key.  This is useful
+        for judging the relative security of a key.
+
+        :return: bits in the key (as an `int`)
+        """
+        # TODO 4.0: raise NotImplementedError, 0 is unlikely to ever be
+        # _correct_ and nothing in the critical path seems to use this.
+        return 0
+
+    def can_sign(self):
+        """
+        Return ``True`` if this key has the private part necessary for signing
+        data.
+        """
+        return False
+
+    def get_fingerprint(self):
+        """
+        Return an MD5 fingerprint of the public part of this key.  Nothing
+        secret is revealed.
+
+        :return:
+            a 16-byte `string <str>` (binary) of the MD5 fingerprint, in SSH
+            format.
+        """
+        return md5(self.asbytes()).digest()
+
+    @property
+    def fingerprint(self):
+        """
+        Modern fingerprint property designed to be comparable to OpenSSH.
+
+        Currently only does SHA256 (the OpenSSH default).
+
+        .. versionadded:: 3.2
+        """
+        hashy = sha256(bytes(self))
+        hash_name = hashy.name.upper()
+        b64ed = encodebytes(hashy.digest())
+        cleaned = u(b64ed).strip().rstrip("=")  # yes, OpenSSH does this too!
+        return f"{hash_name}:{cleaned}"
+
+    def get_base64(self):
+        """
+        Return a base64 string containing the public part of this key.  Nothing
+        secret is revealed.  This format is compatible with that used to store
+        public key files or recognized host keys.
+
+        :return: a base64 `string <str>` containing the public part of the key.
+        """
+        return u(encodebytes(self.asbytes())).replace("\n", "")
+
+    def sign_ssh_data(self, data, algorithm=None):
+        """
+        Sign a blob of data with this private key, and return a `.Message`
+        representing an SSH signature message.
+
+        :param bytes data:
+            the data to sign.
+        :param str algorithm:
+            the signature algorithm to use, if different from the key's
+            internal name. Default: ``None``.
+        :return: an SSH signature `message <.Message>`.
+
+        .. versionchanged:: 2.9
+            Added the ``algorithm`` kwarg.
+        """
+        return bytes()
+
+    def verify_ssh_sig(self, data, msg):
+        """
+        Given a blob of data, and an SSH message representing a signature of
+        that data, verify that it was signed with this key.
+
+        :param bytes data: the data that was signed.
+        :param .Message msg: an SSH signature message
+        :return:
+            ``True`` if the signature verifies correctly; ``False`` otherwise.
+        """
+        return False
+
+    @classmethod
+    def from_private_key_file(cls, filename, password=None):
+        """
+        Create a key object by reading a private key file.  If the private
+        key is encrypted and ``password`` is not ``None``, the given password
+        will be used to decrypt the key (otherwise `.PasswordRequiredException`
+        is thrown).  Through the magic of Python, this factory method will
+        exist in all subclasses of PKey (such as `.RSAKey` or `.DSSKey`), but
+        is useless on the abstract PKey class.
+
+        :param str filename: name of the file to read
+        :param str password:
+            an optional password to use to decrypt the key file, if it's
+            encrypted
+        :return: a new `.PKey` based on the given private key
+
+        :raises: ``IOError`` -- if there was an error reading the file
+        :raises: `.PasswordRequiredException` -- if the private key file is
+            encrypted, and ``password`` is ``None``
+        :raises: `.SSHException` -- if the key file is invalid
+        """
+        key = cls(filename=filename, password=password)
+        return key
+
+    @classmethod
+    def from_private_key(cls, file_obj, password=None):
+        """
+        Create a key object by reading a private key from a file (or file-like)
+        object.  If the private key is encrypted and ``password`` is not
+        ``None``, the given password will be used to decrypt the key (otherwise
+        `.PasswordRequiredException` is thrown).
+
+        :param file_obj: the file-like object to read from
+        :param str password:
+            an optional password to use to decrypt the key, if it's encrypted
+        :return: a new `.PKey` based on the given private key
+
+        :raises: ``IOError`` -- if there was an error reading the key
+        :raises: `.PasswordRequiredException` --
+            if the private key file is encrypted, and ``password`` is ``None``
+        :raises: `.SSHException` -- if the key file is invalid
+        """
+        key = cls(file_obj=file_obj, password=password)
+        return key
+
+    def write_private_key_file(self, filename, password=None):
+        """
+        Write private key contents into a file.  If the password is not
+        ``None``, the key is encrypted before writing.
+
+        :param str filename: name of the file to write
+        :param str password:
+            an optional password to use to encrypt the key file
+
+        :raises: ``IOError`` -- if there was an error writing the file
+        :raises: `.SSHException` -- if the key is invalid
+        """
+        raise Exception("Not implemented in PKey")
+
+    def write_private_key(self, file_obj, password=None):
+        """
+        Write private key contents into a file (or file-like) object.  If the
+        password is not ``None``, the key is encrypted before writing.
+
+        :param file_obj: the file-like object to write into
+        :param str password: an optional password to use to encrypt the key
+
+        :raises: ``IOError`` -- if there was an error writing to the file
+        :raises: `.SSHException` -- if the key is invalid
+        """
+        # TODO 4.0: NotImplementedError (plus everywhere else in here)
+        raise Exception("Not implemented in PKey")
+
+    def _read_private_key_file(self, tag, filename, password=None):
+        """
+        Read an SSH2-format private key file, looking for a string of the type
+        ``"BEGIN xxx PRIVATE KEY"`` for some ``xxx``, base64-decode the text we
+        find, and return it as a string.  If the private key is encrypted and
+        ``password`` is not ``None``, the given password will be used to
+        decrypt the key (otherwise `.PasswordRequiredException` is thrown).
+
+        :param str tag: ``"RSA"`` or ``"DSA"``, the tag used to mark the
+            data block.
+        :param str filename: name of the file to read.
+        :param str password:
+            an optional password to use to decrypt the key file, if it's
+            encrypted.
+        :return: the `bytes` that make up the private key.
+
+        :raises: ``IOError`` -- if there was an error reading the file.
+        :raises: `.PasswordRequiredException` -- if the private key file is
+            encrypted, and ``password`` is ``None``.
+        :raises: `.SSHException` -- if the key file is invalid.
+        """
+        with open(filename, "r") as f:
+            data = self._read_private_key(tag, f, password)
+        return data
+
+    def _read_private_key(self, tag, f, password=None):
+        lines = f.readlines()
+        if not lines:
+            raise SSHException("no lines in {} private key file".format(tag))
+
+        # find the BEGIN tag
+        start = 0
+        m = self.BEGIN_TAG.match(lines[start])
+        line_range = len(lines) - 1
+        while start < line_range and not m:
+            start += 1
+            m = self.BEGIN_TAG.match(lines[start])
+        start += 1
+        keytype = m.group(1) if m else None
+        if start >= len(lines) or keytype is None:
+            raise SSHException("not a valid {} private key file".format(tag))
+
+        # find the END tag
+        end = start
+        m = self.END_TAG.match(lines[end])
+        while end < line_range and not m:
+            end += 1
+            m = self.END_TAG.match(lines[end])
+
+        if keytype == tag:
+            data = self._read_private_key_pem(lines, end, password)
+            pkformat = self._PRIVATE_KEY_FORMAT_ORIGINAL
+        elif keytype == "OPENSSH":
+            data = self._read_private_key_openssh(lines[start:end], password)
+            pkformat = self._PRIVATE_KEY_FORMAT_OPENSSH
+        else:
+            raise SSHException(
+                "encountered {} key, expected {} key".format(keytype, tag)
+            )
+
+        return pkformat, data
+
+    def _got_bad_key_format_id(self, id_):
+        err = "{}._read_private_key() spat out an unknown key format id '{}'"
+        raise SSHException(err.format(self.__class__.__name__, id_))
+
+    def _read_private_key_pem(self, lines, end, password):
+        start = 0
+        # parse any headers first
+        headers = {}
+        start += 1
+        while start < len(lines):
+            line = lines[start].split(": ")
+            if len(line) == 1:
+                break
+            headers[line[0].lower()] = line[1].strip()
+            start += 1
+        # if we trudged to the end of the file, just try to cope.
+        try:
+            data = decodebytes(b("".join(lines[start:end])))
+        except base64.binascii.Error as e:
+            raise SSHException("base64 decoding error: {}".format(e))
+        if "proc-type" not in headers:
+            # unencryped: done
+            return data
+        # encrypted keyfile: will need a password
+        proc_type = headers["proc-type"]
+        if proc_type != "4,ENCRYPTED":
+            raise SSHException(
+                'Unknown private key structure "{}"'.format(proc_type)
+            )
+        try:
+            encryption_type, saltstr = headers["dek-info"].split(",")
+        except:
+            raise SSHException("Can't parse DEK-info in private key file")
+        if encryption_type not in self._CIPHER_TABLE:
+            raise SSHException(
+                'Unknown private key cipher "{}"'.format(encryption_type)
+            )
+        # if no password was passed in,
+        # raise an exception pointing out that we need one
+        if password is None:
+            raise PasswordRequiredException("Private key file is encrypted")
+        cipher = self._CIPHER_TABLE[encryption_type]["cipher"]
+        keysize = self._CIPHER_TABLE[encryption_type]["keysize"]
+        mode = self._CIPHER_TABLE[encryption_type]["mode"]
+        salt = unhexlify(b(saltstr))
+        key = util.generate_key_bytes(md5, salt, password, keysize)
+        decryptor = Cipher(
+            cipher(key), mode(salt), backend=default_backend()
+        ).decryptor()
+        return decryptor.update(data) + decryptor.finalize()
+
+    def _read_private_key_openssh(self, lines, password):
+        """
+        Read the new OpenSSH SSH2 private key format available
+        since OpenSSH version 6.5
+        Reference:
+        https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.key
+        """
+        try:
+            data = decodebytes(b("".join(lines)))
+        except base64.binascii.Error as e:
+            raise SSHException("base64 decoding error: {}".format(e))
+
+        # read data struct
+        auth_magic = data[:15]
+        if auth_magic != OPENSSH_AUTH_MAGIC:
+            raise SSHException("unexpected OpenSSH key header encountered")
+
+        cstruct = self._uint32_cstruct_unpack(data[15:], "sssur")
+        cipher, kdfname, kdf_options, num_pubkeys, remainder = cstruct
+        # For now, just support 1 key.
+        if num_pubkeys > 1:
+            raise SSHException(
+                "unsupported: private keyfile has multiple keys"
+            )
+        pubkey, privkey_blob = self._uint32_cstruct_unpack(remainder, "ss")
+
+        if kdfname == b("bcrypt"):
+            if cipher == b("aes256-cbc"):
+                mode = modes.CBC
+            elif cipher == b("aes256-ctr"):
+                mode = modes.CTR
+            else:
+                raise SSHException(
+                    "unknown cipher `{}` used in private key file".format(
+                        cipher.decode("utf-8")
+                    )
+                )
+            # Encrypted private key.
+            # If no password was passed in, raise an exception pointing
+            # out that we need one
+            if password is None:
+                raise PasswordRequiredException(
+                    "private key file is encrypted"
+                )
+
+            # Unpack salt and rounds from kdfoptions
+            salt, rounds = self._uint32_cstruct_unpack(kdf_options, "su")
+
+            # run bcrypt kdf to derive key and iv/nonce (32 + 16 bytes)
+            key_iv = bcrypt.kdf(
+                b(password),
+                b(salt),
+                48,
+                rounds,
+                # We can't control how many rounds are on disk, so no sense
+                # warning about it.
+                ignore_few_rounds=True,
+            )
+            key = key_iv[:32]
+            iv = key_iv[32:]
+
+            # decrypt private key blob
+            decryptor = Cipher(
+                algorithms.AES(key), mode(iv), default_backend()
+            ).decryptor()
+            decrypted_privkey = decryptor.update(privkey_blob)
+            decrypted_privkey += decryptor.finalize()
+        elif cipher == b("none") and kdfname == b("none"):
+            # Unencrypted private key
+            decrypted_privkey = privkey_blob
+        else:
+            raise SSHException(
+                "unknown cipher or kdf used in private key file"
+            )
+
+        # Unpack private key and verify checkints
+        cstruct = self._uint32_cstruct_unpack(decrypted_privkey, "uusr")
+        checkint1, checkint2, keytype, keydata = cstruct
+
+        if checkint1 != checkint2:
+            raise SSHException(
+                "OpenSSH private key file checkints do not match"
+            )
+
+        return _unpad_openssh(keydata)
+
+    def _uint32_cstruct_unpack(self, data, strformat):
+        """
+        Used to read new OpenSSH private key format.
+        Unpacks a c data structure containing a mix of 32-bit uints and
+        variable length strings prefixed by 32-bit uint size field,
+        according to the specified format. Returns the unpacked vars
+        in a tuple.
+        Format strings:
+          s - denotes a string
+          i - denotes a long integer, encoded as a byte string
+          u - denotes a 32-bit unsigned integer
+          r - the remainder of the input string, returned as a string
+        """
+        arr = []
+        idx = 0
+        try:
+            for f in strformat:
+                if f == "s":
+                    # string
+                    s_size = struct.unpack(">L", data[idx : idx + 4])[0]
+                    idx += 4
+                    s = data[idx : idx + s_size]
+                    idx += s_size
+                    arr.append(s)
+                if f == "i":
+                    # long integer
+                    s_size = struct.unpack(">L", data[idx : idx + 4])[0]
+                    idx += 4
+                    s = data[idx : idx + s_size]
+                    idx += s_size
+                    i = util.inflate_long(s, True)
+                    arr.append(i)
+                elif f == "u":
+                    # 32-bit unsigned int
+                    u = struct.unpack(">L", data[idx : idx + 4])[0]
+                    idx += 4
+                    arr.append(u)
+                elif f == "r":
+                    # remainder as string
+                    s = data[idx:]
+                    arr.append(s)
+                    break
+        except Exception as e:
+            # PKey-consuming code frequently wants to save-and-skip-over issues
+            # with loading keys, and uses SSHException as the (really friggin
+            # awful) signal for this. So for now...we do this.
+            raise SSHException(str(e))
+        return tuple(arr)
+
+    def _write_private_key_file(self, filename, key, format, password=None):
+        """
+        Write an SSH2-format private key file in a form that can be read by
+        paramiko or openssh.  If no password is given, the key is written in
+        a trivially-encoded format (base64) which is completely insecure.  If
+        a password is given, DES-EDE3-CBC is used.
+
+        :param str tag:
+            ``"RSA"`` or ``"DSA"``, the tag used to mark the data block.
+        :param filename: name of the file to write.
+        :param bytes data: data blob that makes up the private key.
+        :param str password: an optional password to use to encrypt the file.
+
+        :raises: ``IOError`` -- if there was an error writing the file.
+        """
+        # Ensure that we create new key files directly with a user-only mode,
+        # instead of opening, writing, then chmodding, which leaves us open to
+        # CVE-2022-24302.
+        with os.fdopen(
+            os.open(
+                filename,
+                # NOTE: O_TRUNC is a noop on new files, and O_CREAT is a noop
+                # on existing files, so using all 3 in both cases is fine.
+                flags=os.O_WRONLY | os.O_TRUNC | os.O_CREAT,
+                # Ditto the use of the 'mode' argument; it should be safe to
+                # give even for existing files (though it will not act like a
+                # chmod in that case).
+                mode=o600,
+            ),
+            # Yea, you still gotta inform the FLO that it is in "write" mode.
+            "w",
+        ) as f:
+            self._write_private_key(f, key, format, password=password)
+
+    def _write_private_key(self, f, key, format, password=None):
+        if password is None:
+            encryption = serialization.NoEncryption()
+        else:
+            encryption = serialization.BestAvailableEncryption(b(password))
+
+        f.write(
+            key.private_bytes(
+                serialization.Encoding.PEM, format, encryption
+            ).decode()
+        )
+
+    def _check_type_and_load_cert(self, msg, key_type, cert_type):
+        """
+        Perform message type-checking & optional certificate loading.
+
+        This includes fast-forwarding cert ``msg`` objects past the nonce, so
+        that the subsequent fields are the key numbers; thus the caller may
+        expect to treat the message as key material afterwards either way.
+
+        The obtained key type is returned for classes which need to know what
+        it was (e.g. ECDSA.)
+        """
+        # Normalization; most classes have a single key type and give a string,
+        # but eg ECDSA is a 1:N mapping.
+        key_types = key_type
+        cert_types = cert_type
+        if isinstance(key_type, str):
+            key_types = [key_types]
+        if isinstance(cert_types, str):
+            cert_types = [cert_types]
+        # Can't do much with no message, that should've been handled elsewhere
+        if msg is None:
+            raise SSHException("Key object may not be empty")
+        # First field is always key type, in either kind of object. (make sure
+        # we rewind before grabbing it - sometimes caller had to do their own
+        # introspection first!)
+        msg.rewind()
+        type_ = msg.get_text()
+        # Regular public key - nothing special to do besides the implicit
+        # type check.
+        if type_ in key_types:
+            pass
+        # OpenSSH-compatible certificate - store full copy as .public_blob
+        # (so signing works correctly) and then fast-forward past the
+        # nonce.
+        elif type_ in cert_types:
+            # This seems the cleanest way to 'clone' an already-being-read
+            # message; they're *IO objects at heart and their .getvalue()
+            # always returns the full value regardless of pointer position.
+            self.load_certificate(Message(msg.asbytes()))
+            # Read out nonce as it comes before the public numbers - our caller
+            # is likely going to use the (only borrowed by us, not owned)
+            # 'msg' object for loading those numbers right after this.
+            # TODO: usefully interpret it & other non-public-number fields
+            # (requires going back into per-type subclasses.)
+            msg.get_string()
+        else:
+            err = "Invalid key (class: {}, data type: {}"
+            raise SSHException(err.format(self.__class__.__name__, type_))
+
+    def load_certificate(self, value):
+        """
+        Supplement the private key contents with data loaded from an OpenSSH
+        public key (``.pub``) or certificate (``-cert.pub``) file, a string
+        containing such a file, or a `.Message` object.
+
+        The .pub contents adds no real value, since the private key
+        file includes sufficient information to derive the public
+        key info. For certificates, however, this can be used on
+        the client side to offer authentication requests to the server
+        based on certificate instead of raw public key.
+
+        See:
+        https://github.com/openssh/openssh-portable/blob/master/PROTOCOL.certkeys
+
+        Note: very little effort is made to validate the certificate contents,
+        that is for the server to decide if it is good enough to authenticate
+        successfully.
+        """
+        if isinstance(value, Message):
+            constructor = "from_message"
+        elif os.path.isfile(value):
+            constructor = "from_file"
+        else:
+            constructor = "from_string"
+        blob = getattr(PublicBlob, constructor)(value)
+        if not blob.key_type.startswith(self.get_name()):
+            err = "PublicBlob type {} incompatible with key type {}"
+            raise ValueError(err.format(blob.key_type, self.get_name()))
+        self.public_blob = blob
+
+
+# General construct for an OpenSSH style Public Key blob
+# readable from a one-line file of the format:
+#     <key-name> <base64-blob> [<comment>]
+# Of little value in the case of standard public keys
+# {ssh-rsa, ssh-dss, ssh-ecdsa, ssh-ed25519}, but should
+# provide rudimentary support for {*-cert.v01}
+class PublicBlob:
+    """
+    OpenSSH plain public key or OpenSSH signed public key (certificate).
+
+    Tries to be as dumb as possible and barely cares about specific
+    per-key-type data.
+
+    .. note::
+
+        Most of the time you'll want to call `from_file`, `from_string` or
+        `from_message` for useful instantiation, the main constructor is
+        basically "I should be using ``attrs`` for this."
+    """
+
+    def __init__(self, type_, blob, comment=None):
+        """
+        Create a new public blob of given type and contents.
+
+        :param str type_: Type indicator, eg ``ssh-rsa``.
+        :param bytes blob: The blob bytes themselves.
+        :param str comment: A comment, if one was given (e.g. file-based.)
+        """
+        self.key_type = type_
+        self.key_blob = blob
+        self.comment = comment
+
+    @classmethod
+    def from_file(cls, filename):
+        """
+        Create a public blob from a ``-cert.pub``-style file on disk.
+        """
+        with open(filename) as f:
+            string = f.read()
+        return cls.from_string(string)
+
+    @classmethod
+    def from_string(cls, string):
+        """
+        Create a public blob from a ``-cert.pub``-style string.
+        """
+        fields = string.split(None, 2)
+        if len(fields) < 2:
+            msg = "Not enough fields for public blob: {}"
+            raise ValueError(msg.format(fields))
+        key_type = fields[0]
+        key_blob = decodebytes(b(fields[1]))
+        try:
+            comment = fields[2].strip()
+        except IndexError:
+            comment = None
+        # Verify that the blob message first (string) field matches the
+        # key_type
+        m = Message(key_blob)
+        blob_type = m.get_text()
+        if blob_type != key_type:
+            deets = "key type={!r}, but blob type={!r}".format(
+                key_type, blob_type
+            )
+            raise ValueError("Invalid PublicBlob contents: {}".format(deets))
+        # All good? All good.
+        return cls(type_=key_type, blob=key_blob, comment=comment)
+
+    @classmethod
+    def from_message(cls, message):
+        """
+        Create a public blob from a network `.Message`.
+
+        Specifically, a cert-bearing pubkey auth packet, because by definition
+        OpenSSH-style certificates 'are' their own network representation."
+        """
+        type_ = message.get_text()
+        return cls(type_=type_, blob=message.asbytes())
+
+    def __str__(self):
+        ret = "{} public key/certificate".format(self.key_type)
+        if self.comment:
+            ret += "- {}".format(self.comment)
+        return ret
+
+    def __eq__(self, other):
+        # Just piggyback on Message/BytesIO, since both of these should be one.
+        return self and other and self.key_blob == other.key_blob
+
+    def __ne__(self, other):
+        return not self == other
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/primes.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/primes.py
new file mode 100644
index 0000000000000000000000000000000000000000..663c58ed4918a71546a969e90a1bbe1af831603f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/primes.py
@@ -0,0 +1,148 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Utility functions for dealing with primes.
+"""
+
+import os
+
+from paramiko import util
+from paramiko.common import byte_mask
+from paramiko.ssh_exception import SSHException
+
+
+def _roll_random(n):
+    """returns a random # from 0 to N-1"""
+    bits = util.bit_length(n - 1)
+    byte_count = (bits + 7) // 8
+    hbyte_mask = pow(2, bits % 8) - 1
+
+    # so here's the plan:
+    # we fetch as many random bits as we'd need to fit N-1, and if the
+    # generated number is >= N, we try again.  in the worst case (N-1 is a
+    # power of 2), we have slightly better than 50% odds of getting one that
+    # fits, so i can't guarantee that this loop will ever finish, but the odds
+    # of it looping forever should be infinitesimal.
+    while True:
+        x = os.urandom(byte_count)
+        if hbyte_mask > 0:
+            x = byte_mask(x[0], hbyte_mask) + x[1:]
+        num = util.inflate_long(x, 1)
+        if num < n:
+            break
+    return num
+
+
+class ModulusPack:
+    """
+    convenience object for holding the contents of the /etc/ssh/moduli file,
+    on systems that have such a file.
+    """
+
+    def __init__(self):
+        # pack is a hash of: bits -> [ (generator, modulus) ... ]
+        self.pack = {}
+        self.discarded = []
+
+    def _parse_modulus(self, line):
+        (
+            timestamp,
+            mod_type,
+            tests,
+            tries,
+            size,
+            generator,
+            modulus,
+        ) = line.split()
+        mod_type = int(mod_type)
+        tests = int(tests)
+        tries = int(tries)
+        size = int(size)
+        generator = int(generator)
+        modulus = int(modulus, 16)
+
+        # weed out primes that aren't at least:
+        # type 2 (meets basic structural requirements)
+        # test 4 (more than just a small-prime sieve)
+        # tries < 100 if test & 4 (at least 100 tries of miller-rabin)
+        if (
+            mod_type < 2
+            or tests < 4
+            or (tests & 4 and tests < 8 and tries < 100)
+        ):
+            self.discarded.append(
+                (modulus, "does not meet basic requirements")
+            )
+            return
+        if generator == 0:
+            generator = 2
+
+        # there's a bug in the ssh "moduli" file (yeah, i know: shock! dismay!
+        # call cnn!) where it understates the bit lengths of these primes by 1.
+        # this is okay.
+        bl = util.bit_length(modulus)
+        if (bl != size) and (bl != size + 1):
+            self.discarded.append(
+                (modulus, "incorrectly reported bit length {}".format(size))
+            )
+            return
+        if bl not in self.pack:
+            self.pack[bl] = []
+        self.pack[bl].append((generator, modulus))
+
+    def read_file(self, filename):
+        """
+        :raises IOError: passed from any file operations that fail.
+        """
+        self.pack = {}
+        with open(filename, "r") as f:
+            for line in f:
+                line = line.strip()
+                if (len(line) == 0) or (line[0] == "#"):
+                    continue
+                try:
+                    self._parse_modulus(line)
+                except:
+                    continue
+
+    def get_modulus(self, min, prefer, max):
+        bitsizes = sorted(self.pack.keys())
+        if len(bitsizes) == 0:
+            raise SSHException("no moduli available")
+        good = -1
+        # find nearest bitsize >= preferred
+        for b in bitsizes:
+            if (b >= prefer) and (b <= max) and (b < good or good == -1):
+                good = b
+        # if that failed, find greatest bitsize >= min
+        if good == -1:
+            for b in bitsizes:
+                if (b >= min) and (b <= max) and (b > good):
+                    good = b
+        if good == -1:
+            # their entire (min, max) range has no intersection with our range.
+            # if their range is below ours, pick the smallest.  otherwise pick
+            # the largest.  it'll be out of their range requirement either way,
+            # but we'll be sending them the closest one we have.
+            good = bitsizes[0]
+            if min > good:
+                good = bitsizes[-1]
+        # now pick a random modulus of this bitsize
+        n = _roll_random(len(self.pack[good]))
+        return self.pack[good][n]
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/proxy.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/proxy.py
new file mode 100644
index 0000000000000000000000000000000000000000..f7609c984026e043e292203b47540d38a35f8339
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/proxy.py
@@ -0,0 +1,134 @@
+# Copyright (C) 2012  Yipit, Inc <coders@yipit.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+
+import os
+import shlex
+import signal
+from select import select
+import socket
+import time
+
+# Try-and-ignore import so platforms w/o subprocess (eg Google App Engine) can
+# still import paramiko.
+subprocess, subprocess_import_error = None, None
+try:
+    import subprocess
+except ImportError as e:
+    subprocess_import_error = e
+
+from paramiko.ssh_exception import ProxyCommandFailure
+from paramiko.util import ClosingContextManager
+
+
+class ProxyCommand(ClosingContextManager):
+    """
+    Wraps a subprocess running ProxyCommand-driven programs.
+
+    This class implements a the socket-like interface needed by the
+    `.Transport` and `.Packetizer` classes. Using this class instead of a
+    regular socket makes it possible to talk with a Popen'd command that will
+    proxy traffic between the client and a server hosted in another machine.
+
+    Instances of this class may be used as context managers.
+    """
+
+    def __init__(self, command_line):
+        """
+        Create a new CommandProxy instance. The instance created by this
+        class can be passed as an argument to the `.Transport` class.
+
+        :param str command_line:
+            the command that should be executed and used as the proxy.
+        """
+        if subprocess is None:
+            raise subprocess_import_error
+        self.cmd = shlex.split(command_line)
+        self.process = subprocess.Popen(
+            self.cmd,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            bufsize=0,
+        )
+        self.timeout = None
+
+    def send(self, content):
+        """
+        Write the content received from the SSH client to the standard
+        input of the forked command.
+
+        :param str content: string to be sent to the forked command
+        """
+        try:
+            self.process.stdin.write(content)
+        except IOError as e:
+            # There was a problem with the child process. It probably
+            # died and we can't proceed. The best option here is to
+            # raise an exception informing the user that the informed
+            # ProxyCommand is not working.
+            raise ProxyCommandFailure(" ".join(self.cmd), e.strerror)
+        return len(content)
+
+    def recv(self, size):
+        """
+        Read from the standard output of the forked program.
+
+        :param int size: how many chars should be read
+
+        :return: the string of bytes read, which may be shorter than requested
+        """
+        try:
+            buffer = b""
+            start = time.time()
+            while len(buffer) < size:
+                select_timeout = None
+                if self.timeout is not None:
+                    elapsed = time.time() - start
+                    if elapsed >= self.timeout:
+                        raise socket.timeout()
+                    select_timeout = self.timeout - elapsed
+
+                r, w, x = select([self.process.stdout], [], [], select_timeout)
+                if r and r[0] == self.process.stdout:
+                    buffer += os.read(
+                        self.process.stdout.fileno(), size - len(buffer)
+                    )
+            return buffer
+        except socket.timeout:
+            if buffer:
+                # Don't raise socket.timeout, return partial result instead
+                return buffer
+            raise  # socket.timeout is a subclass of IOError
+        except IOError as e:
+            raise ProxyCommandFailure(" ".join(self.cmd), e.strerror)
+
+    def close(self):
+        os.kill(self.process.pid, signal.SIGTERM)
+
+    @property
+    def closed(self):
+        return self.process.returncode is not None
+
+    @property
+    def _closed(self):
+        # Concession to Python 3 socket-like API
+        return self.closed
+
+    def settimeout(self, timeout):
+        self.timeout = timeout
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/rsakey.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/rsakey.py
new file mode 100644
index 0000000000000000000000000000000000000000..b7ad3ce21668f53b602d26660ed0107da6d806e2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/rsakey.py
@@ -0,0 +1,227 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+RSA keys.
+"""
+
+from cryptography.exceptions import InvalidSignature, UnsupportedAlgorithm
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives import hashes, serialization
+from cryptography.hazmat.primitives.asymmetric import rsa, padding
+
+from paramiko.message import Message
+from paramiko.pkey import PKey
+from paramiko.ssh_exception import SSHException
+
+
+class RSAKey(PKey):
+    """
+    Representation of an RSA key which can be used to sign and verify SSH2
+    data.
+    """
+
+    name = "ssh-rsa"
+    HASHES = {
+        "ssh-rsa": hashes.SHA1,
+        "ssh-rsa-cert-v01@openssh.com": hashes.SHA1,
+        "rsa-sha2-256": hashes.SHA256,
+        "rsa-sha2-256-cert-v01@openssh.com": hashes.SHA256,
+        "rsa-sha2-512": hashes.SHA512,
+        "rsa-sha2-512-cert-v01@openssh.com": hashes.SHA512,
+    }
+
+    def __init__(
+        self,
+        msg=None,
+        data=None,
+        filename=None,
+        password=None,
+        key=None,
+        file_obj=None,
+    ):
+        self.key = None
+        self.public_blob = None
+        if file_obj is not None:
+            self._from_private_key(file_obj, password)
+            return
+        if filename is not None:
+            self._from_private_key_file(filename, password)
+            return
+        if (msg is None) and (data is not None):
+            msg = Message(data)
+        if key is not None:
+            self.key = key
+        else:
+            self._check_type_and_load_cert(
+                msg=msg,
+                # NOTE: this does NOT change when using rsa2 signatures; it's
+                # purely about key loading, not exchange or verification
+                key_type=self.name,
+                cert_type="ssh-rsa-cert-v01@openssh.com",
+            )
+            self.key = rsa.RSAPublicNumbers(
+                e=msg.get_mpint(), n=msg.get_mpint()
+            ).public_key(default_backend())
+
+    @classmethod
+    def identifiers(cls):
+        return list(cls.HASHES.keys())
+
+    @property
+    def size(self):
+        return self.key.key_size
+
+    @property
+    def public_numbers(self):
+        if isinstance(self.key, rsa.RSAPrivateKey):
+            return self.key.private_numbers().public_numbers
+        else:
+            return self.key.public_numbers()
+
+    def asbytes(self):
+        m = Message()
+        m.add_string(self.name)
+        m.add_mpint(self.public_numbers.e)
+        m.add_mpint(self.public_numbers.n)
+        return m.asbytes()
+
+    def __str__(self):
+        # NOTE: see #853 to explain some legacy behavior.
+        # TODO 4.0: replace with a nice clean fingerprint display or something
+        return self.asbytes().decode("utf8", errors="ignore")
+
+    @property
+    def _fields(self):
+        return (self.get_name(), self.public_numbers.e, self.public_numbers.n)
+
+    def get_name(self):
+        return self.name
+
+    def get_bits(self):
+        return self.size
+
+    def can_sign(self):
+        return isinstance(self.key, rsa.RSAPrivateKey)
+
+    def sign_ssh_data(self, data, algorithm=None):
+        if algorithm is None:
+            algorithm = self.name
+        sig = self.key.sign(
+            data,
+            padding=padding.PKCS1v15(),
+            # HASHES being just a map from long identifier to either SHA1 or
+            # SHA256 - cert'ness is not truly relevant.
+            algorithm=self.HASHES[algorithm](),
+        )
+        m = Message()
+        # And here again, cert'ness is irrelevant, so it is stripped out.
+        m.add_string(algorithm.replace("-cert-v01@openssh.com", ""))
+        m.add_string(sig)
+        return m
+
+    def verify_ssh_sig(self, data, msg):
+        sig_algorithm = msg.get_text()
+        if sig_algorithm not in self.HASHES:
+            return False
+        key = self.key
+        if isinstance(key, rsa.RSAPrivateKey):
+            key = key.public_key()
+
+        # NOTE: pad received signature with leading zeros, key.verify()
+        # expects a signature of key size (e.g. PuTTY doesn't pad)
+        sign = msg.get_binary()
+        diff = key.key_size - len(sign) * 8
+        if diff > 0:
+            sign = b"\x00" * ((diff + 7) // 8) + sign
+
+        try:
+            key.verify(
+                sign, data, padding.PKCS1v15(), self.HASHES[sig_algorithm]()
+            )
+        except InvalidSignature:
+            return False
+        else:
+            return True
+
+    def write_private_key_file(self, filename, password=None):
+        self._write_private_key_file(
+            filename,
+            self.key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    def write_private_key(self, file_obj, password=None):
+        self._write_private_key(
+            file_obj,
+            self.key,
+            serialization.PrivateFormat.TraditionalOpenSSL,
+            password=password,
+        )
+
+    @staticmethod
+    def generate(bits, progress_func=None):
+        """
+        Generate a new private RSA key.  This factory function can be used to
+        generate a new host key or authentication key.
+
+        :param int bits: number of bits the generated key should be.
+        :param progress_func: Unused
+        :return: new `.RSAKey` private key
+        """
+        key = rsa.generate_private_key(
+            public_exponent=65537, key_size=bits, backend=default_backend()
+        )
+        return RSAKey(key=key)
+
+    # ...internals...
+
+    def _from_private_key_file(self, filename, password):
+        data = self._read_private_key_file("RSA", filename, password)
+        self._decode_key(data)
+
+    def _from_private_key(self, file_obj, password):
+        data = self._read_private_key("RSA", file_obj, password)
+        self._decode_key(data)
+
+    def _decode_key(self, data):
+        pkformat, data = data
+        if pkformat == self._PRIVATE_KEY_FORMAT_ORIGINAL:
+            try:
+                key = serialization.load_der_private_key(
+                    data, password=None, backend=default_backend()
+                )
+            except (ValueError, TypeError, UnsupportedAlgorithm) as e:
+                raise SSHException(str(e))
+        elif pkformat == self._PRIVATE_KEY_FORMAT_OPENSSH:
+            n, e, d, iqmp, p, q = self._uint32_cstruct_unpack(data, "iiiiii")
+            public_numbers = rsa.RSAPublicNumbers(e=e, n=n)
+            key = rsa.RSAPrivateNumbers(
+                p=p,
+                q=q,
+                d=d,
+                dmp1=d % (p - 1),
+                dmq1=d % (q - 1),
+                iqmp=iqmp,
+                public_numbers=public_numbers,
+            ).private_key(default_backend())
+        else:
+            self._got_bad_key_format_id(pkformat)
+        assert isinstance(key, rsa.RSAPrivateKey)
+        self.key = key
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/server.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/server.py
new file mode 100644
index 0000000000000000000000000000000000000000..6923bdf54589fb0ddf3b65286d7beacfdd1af925
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/server.py
@@ -0,0 +1,732 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+`.ServerInterface` is an interface to override for server support.
+"""
+
+import threading
+from paramiko import util
+from paramiko.common import (
+    DEBUG,
+    ERROR,
+    OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED,
+    AUTH_FAILED,
+    AUTH_SUCCESSFUL,
+)
+
+
+class ServerInterface:
+    """
+    This class defines an interface for controlling the behavior of Paramiko
+    in server mode.
+
+    Methods on this class are called from Paramiko's primary thread, so you
+    shouldn't do too much work in them.  (Certainly nothing that blocks or
+    sleeps.)
+    """
+
+    def check_channel_request(self, kind, chanid):
+        """
+        Determine if a channel request of a given type will be granted, and
+        return ``OPEN_SUCCEEDED`` or an error code.  This method is
+        called in server mode when the client requests a channel, after
+        authentication is complete.
+
+        If you allow channel requests (and an ssh server that didn't would be
+        useless), you should also override some of the channel request methods
+        below, which are used to determine which services will be allowed on
+        a given channel:
+
+            - `check_channel_pty_request`
+            - `check_channel_shell_request`
+            - `check_channel_subsystem_request`
+            - `check_channel_window_change_request`
+            - `check_channel_x11_request`
+            - `check_channel_forward_agent_request`
+
+        The ``chanid`` parameter is a small number that uniquely identifies the
+        channel within a `.Transport`.  A `.Channel` object is not created
+        unless this method returns ``OPEN_SUCCEEDED`` -- once a
+        `.Channel` object is created, you can call `.Channel.get_id` to
+        retrieve the channel ID.
+
+        The return value should either be ``OPEN_SUCCEEDED`` (or
+        ``0``) to allow the channel request, or one of the following error
+        codes to reject it:
+
+            - ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``
+            - ``OPEN_FAILED_CONNECT_FAILED``
+            - ``OPEN_FAILED_UNKNOWN_CHANNEL_TYPE``
+            - ``OPEN_FAILED_RESOURCE_SHORTAGE``
+
+        The default implementation always returns
+        ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``.
+
+        :param str kind:
+            the kind of channel the client would like to open (usually
+            ``"session"``).
+        :param int chanid: ID of the channel
+        :return: an `int` success or failure code (listed above)
+        """
+        return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
+
+    def get_allowed_auths(self, username):
+        """
+        Return a list of authentication methods supported by the server.
+        This list is sent to clients attempting to authenticate, to inform them
+        of authentication methods that might be successful.
+
+        The "list" is actually a string of comma-separated names of types of
+        authentication.  Possible values are ``"password"``, ``"publickey"``,
+        and ``"none"``.
+
+        The default implementation always returns ``"password"``.
+
+        :param str username: the username requesting authentication.
+        :return: a comma-separated `str` of authentication types
+        """
+        return "password"
+
+    def check_auth_none(self, username):
+        """
+        Determine if a client may open channels with no (further)
+        authentication.
+
+        Return ``AUTH_FAILED`` if the client must authenticate, or
+        ``AUTH_SUCCESSFUL`` if it's okay for the client to not
+        authenticate.
+
+        The default implementation always returns ``AUTH_FAILED``.
+
+        :param str username: the username of the client.
+        :return:
+            ``AUTH_FAILED`` if the authentication fails; ``AUTH_SUCCESSFUL`` if
+            it succeeds.
+        :rtype: int
+        """
+        return AUTH_FAILED
+
+    def check_auth_password(self, username, password):
+        """
+        Determine if a given username and password supplied by the client is
+        acceptable for use in authentication.
+
+        Return ``AUTH_FAILED`` if the password is not accepted,
+        ``AUTH_SUCCESSFUL`` if the password is accepted and completes
+        the authentication, or ``AUTH_PARTIALLY_SUCCESSFUL`` if your
+        authentication is stateful, and this key is accepted for
+        authentication, but more authentication is required.  (In this latter
+        case, `get_allowed_auths` will be called to report to the client what
+        options it has for continuing the authentication.)
+
+        The default implementation always returns ``AUTH_FAILED``.
+
+        :param str username: the username of the authenticating client.
+        :param str password: the password given by the client.
+        :return:
+            ``AUTH_FAILED`` if the authentication fails; ``AUTH_SUCCESSFUL`` if
+            it succeeds; ``AUTH_PARTIALLY_SUCCESSFUL`` if the password auth is
+            successful, but authentication must continue.
+        :rtype: int
+        """
+        return AUTH_FAILED
+
+    def check_auth_publickey(self, username, key):
+        """
+        Determine if a given key supplied by the client is acceptable for use
+        in authentication.  You should override this method in server mode to
+        check the username and key and decide if you would accept a signature
+        made using this key.
+
+        Return ``AUTH_FAILED`` if the key is not accepted,
+        ``AUTH_SUCCESSFUL`` if the key is accepted and completes the
+        authentication, or ``AUTH_PARTIALLY_SUCCESSFUL`` if your
+        authentication is stateful, and this password is accepted for
+        authentication, but more authentication is required.  (In this latter
+        case, `get_allowed_auths` will be called to report to the client what
+        options it has for continuing the authentication.)
+
+        Note that you don't have to actually verify any key signtature here.
+        If you're willing to accept the key, Paramiko will do the work of
+        verifying the client's signature.
+
+        The default implementation always returns ``AUTH_FAILED``.
+
+        :param str username: the username of the authenticating client
+        :param .PKey key: the key object provided by the client
+        :return:
+            ``AUTH_FAILED`` if the client can't authenticate with this key;
+            ``AUTH_SUCCESSFUL`` if it can; ``AUTH_PARTIALLY_SUCCESSFUL`` if it
+            can authenticate with this key but must continue with
+            authentication
+        :rtype: int
+        """
+        return AUTH_FAILED
+
+    def check_auth_interactive(self, username, submethods):
+        """
+        Begin an interactive authentication challenge, if supported.  You
+        should override this method in server mode if you want to support the
+        ``"keyboard-interactive"`` auth type, which requires you to send a
+        series of questions for the client to answer.
+
+        Return ``AUTH_FAILED`` if this auth method isn't supported.  Otherwise,
+        you should return an `.InteractiveQuery` object containing the prompts
+        and instructions for the user.  The response will be sent via a call
+        to `check_auth_interactive_response`.
+
+        The default implementation always returns ``AUTH_FAILED``.
+
+        :param str username: the username of the authenticating client
+        :param str submethods:
+            a comma-separated list of methods preferred by the client (usually
+            empty)
+        :return:
+            ``AUTH_FAILED`` if this auth method isn't supported; otherwise an
+            object containing queries for the user
+        :rtype: int or `.InteractiveQuery`
+        """
+        return AUTH_FAILED
+
+    def check_auth_interactive_response(self, responses):
+        """
+        Continue or finish an interactive authentication challenge, if
+        supported.  You should override this method in server mode if you want
+        to support the ``"keyboard-interactive"`` auth type.
+
+        Return ``AUTH_FAILED`` if the responses are not accepted,
+        ``AUTH_SUCCESSFUL`` if the responses are accepted and complete
+        the authentication, or ``AUTH_PARTIALLY_SUCCESSFUL`` if your
+        authentication is stateful, and this set of responses is accepted for
+        authentication, but more authentication is required.  (In this latter
+        case, `get_allowed_auths` will be called to report to the client what
+        options it has for continuing the authentication.)
+
+        If you wish to continue interactive authentication with more questions,
+        you may return an `.InteractiveQuery` object, which should cause the
+        client to respond with more answers, calling this method again.  This
+        cycle can continue indefinitely.
+
+        The default implementation always returns ``AUTH_FAILED``.
+
+        :param responses: list of `str` responses from the client
+        :return:
+            ``AUTH_FAILED`` if the authentication fails; ``AUTH_SUCCESSFUL`` if
+            it succeeds; ``AUTH_PARTIALLY_SUCCESSFUL`` if the interactive auth
+            is successful, but authentication must continue; otherwise an
+            object containing queries for the user
+        :rtype: int or `.InteractiveQuery`
+        """
+        return AUTH_FAILED
+
+    def check_auth_gssapi_with_mic(
+        self, username, gss_authenticated=AUTH_FAILED, cc_file=None
+    ):
+        """
+        Authenticate the given user to the server if he is a valid krb5
+        principal.
+
+        :param str username: The username of the authenticating client
+        :param int gss_authenticated: The result of the krb5 authentication
+        :param str cc_filename: The krb5 client credentials cache filename
+        :return: ``AUTH_FAILED`` if the user is not authenticated otherwise
+                 ``AUTH_SUCCESSFUL``
+        :rtype: int
+        :note: Kerberos credential delegation is not supported.
+        :see: `.ssh_gss`
+        :note: : We are just checking in L{AuthHandler} that the given user is
+                 a valid krb5 principal!
+                 We don't check if the krb5 principal is allowed to log in on
+                 the server, because there is no way to do that in python. So
+                 if you develop your own SSH server with paramiko for a certain
+                 platform like Linux, you should call C{krb5_kuserok()} in
+                 your local kerberos library to make sure that the
+                 krb5_principal has an account on the server and is allowed to
+                 log in as a user.
+        :see: http://www.unix.com/man-page/all/3/krb5_kuserok/
+        """
+        if gss_authenticated == AUTH_SUCCESSFUL:
+            return AUTH_SUCCESSFUL
+        return AUTH_FAILED
+
+    def check_auth_gssapi_keyex(
+        self, username, gss_authenticated=AUTH_FAILED, cc_file=None
+    ):
+        """
+        Authenticate the given user to the server if he is a valid krb5
+        principal and GSS-API Key Exchange was performed.
+        If GSS-API Key Exchange was not performed, this authentication method
+        won't be available.
+
+        :param str username: The username of the authenticating client
+        :param int gss_authenticated: The result of the krb5 authentication
+        :param str cc_filename: The krb5 client credentials cache filename
+        :return: ``AUTH_FAILED`` if the user is not authenticated otherwise
+                 ``AUTH_SUCCESSFUL``
+        :rtype: int
+        :note: Kerberos credential delegation is not supported.
+        :see: `.ssh_gss` `.kex_gss`
+        :note: : We are just checking in L{AuthHandler} that the given user is
+                 a valid krb5 principal!
+                 We don't check if the krb5 principal is allowed to log in on
+                 the server, because there is no way to do that in python. So
+                 if you develop your own SSH server with paramiko for a certain
+                 platform like Linux, you should call C{krb5_kuserok()} in
+                 your local kerberos library to make sure that the
+                 krb5_principal has an account on the server and is allowed
+                 to log in as a user.
+        :see: http://www.unix.com/man-page/all/3/krb5_kuserok/
+        """
+        if gss_authenticated == AUTH_SUCCESSFUL:
+            return AUTH_SUCCESSFUL
+        return AUTH_FAILED
+
+    def enable_auth_gssapi(self):
+        """
+        Overwrite this function in your SSH server to enable GSSAPI
+        authentication.
+        The default implementation always returns false.
+
+        :returns bool: Whether GSSAPI authentication is enabled.
+        :see: `.ssh_gss`
+        """
+        UseGSSAPI = False
+        return UseGSSAPI
+
+    def check_port_forward_request(self, address, port):
+        """
+        Handle a request for port forwarding.  The client is asking that
+        connections to the given address and port be forwarded back across
+        this ssh connection.  An address of ``"0.0.0.0"`` indicates a global
+        address (any address associated with this server) and a port of ``0``
+        indicates that no specific port is requested (usually the OS will pick
+        a port).
+
+        The default implementation always returns ``False``, rejecting the
+        port forwarding request.  If the request is accepted, you should return
+        the port opened for listening.
+
+        :param str address: the requested address
+        :param int port: the requested port
+        :return:
+            the port number (`int`) that was opened for listening, or ``False``
+            to reject
+        """
+        return False
+
+    def cancel_port_forward_request(self, address, port):
+        """
+        The client would like to cancel a previous port-forwarding request.
+        If the given address and port is being forwarded across this ssh
+        connection, the port should be closed.
+
+        :param str address: the forwarded address
+        :param int port: the forwarded port
+        """
+        pass
+
+    def check_global_request(self, kind, msg):
+        """
+        Handle a global request of the given ``kind``.  This method is called
+        in server mode and client mode, whenever the remote host makes a global
+        request.  If there are any arguments to the request, they will be in
+        ``msg``.
+
+        There aren't any useful global requests defined, aside from port
+        forwarding, so usually this type of request is an extension to the
+        protocol.
+
+        If the request was successful and you would like to return contextual
+        data to the remote host, return a tuple.  Items in the tuple will be
+        sent back with the successful result.  (Note that the items in the
+        tuple can only be strings, ints, or bools.)
+
+        The default implementation always returns ``False``, indicating that it
+        does not support any global requests.
+
+        .. note:: Port forwarding requests are handled separately, in
+            `check_port_forward_request`.
+
+        :param str kind: the kind of global request being made.
+        :param .Message msg: any extra arguments to the request.
+        :return:
+            ``True`` or a `tuple` of data if the request was granted; ``False``
+            otherwise.
+        """
+        return False
+
+    # ...Channel requests...
+
+    def check_channel_pty_request(
+        self, channel, term, width, height, pixelwidth, pixelheight, modes
+    ):
+        """
+        Determine if a pseudo-terminal of the given dimensions (usually
+        requested for shell access) can be provided on the given channel.
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the pty request arrived on.
+        :param str term: type of terminal requested (for example, ``"vt100"``).
+        :param int width: width of screen in characters.
+        :param int height: height of screen in characters.
+        :param int pixelwidth:
+            width of screen in pixels, if known (may be ``0`` if unknown).
+        :param int pixelheight:
+            height of screen in pixels, if known (may be ``0`` if unknown).
+        :return:
+            ``True`` if the pseudo-terminal has been allocated; ``False``
+            otherwise.
+        """
+        return False
+
+    def check_channel_shell_request(self, channel):
+        """
+        Determine if a shell will be provided to the client on the given
+        channel.  If this method returns ``True``, the channel should be
+        connected to the stdin/stdout of a shell (or something that acts like
+        a shell).
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the request arrived on.
+        :return:
+            ``True`` if this channel is now hooked up to a shell; ``False`` if
+            a shell can't or won't be provided.
+        """
+        return False
+
+    def check_channel_exec_request(self, channel, command):
+        """
+        Determine if a shell command will be executed for the client.  If this
+        method returns ``True``, the channel should be connected to the stdin,
+        stdout, and stderr of the shell command.
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the request arrived on.
+        :param str command: the command to execute.
+        :return:
+            ``True`` if this channel is now hooked up to the stdin, stdout, and
+            stderr of the executing command; ``False`` if the command will not
+            be executed.
+
+        .. versionadded:: 1.1
+        """
+        return False
+
+    def check_channel_subsystem_request(self, channel, name):
+        """
+        Determine if a requested subsystem will be provided to the client on
+        the given channel.  If this method returns ``True``, all future I/O
+        through this channel will be assumed to be connected to the requested
+        subsystem.  An example of a subsystem is ``sftp``.
+
+        The default implementation checks for a subsystem handler assigned via
+        `.Transport.set_subsystem_handler`.
+        If one has been set, the handler is invoked and this method returns
+        ``True``.  Otherwise it returns ``False``.
+
+        .. note:: Because the default implementation uses the `.Transport` to
+            identify valid subsystems, you probably won't need to override this
+            method.
+
+        :param .Channel channel: the `.Channel` the pty request arrived on.
+        :param str name: name of the requested subsystem.
+        :return:
+            ``True`` if this channel is now hooked up to the requested
+            subsystem; ``False`` if that subsystem can't or won't be provided.
+        """
+        transport = channel.get_transport()
+        handler_class, args, kwargs = transport._get_subsystem_handler(name)
+        if handler_class is None:
+            return False
+        handler = handler_class(channel, name, self, *args, **kwargs)
+        handler.start()
+        return True
+
+    def check_channel_window_change_request(
+        self, channel, width, height, pixelwidth, pixelheight
+    ):
+        """
+        Determine if the pseudo-terminal on the given channel can be resized.
+        This only makes sense if a pty was previously allocated on it.
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the pty request arrived on.
+        :param int width: width of screen in characters.
+        :param int height: height of screen in characters.
+        :param int pixelwidth:
+            width of screen in pixels, if known (may be ``0`` if unknown).
+        :param int pixelheight:
+            height of screen in pixels, if known (may be ``0`` if unknown).
+        :return: ``True`` if the terminal was resized; ``False`` if not.
+        """
+        return False
+
+    def check_channel_x11_request(
+        self,
+        channel,
+        single_connection,
+        auth_protocol,
+        auth_cookie,
+        screen_number,
+    ):
+        """
+        Determine if the client will be provided with an X11 session.  If this
+        method returns ``True``, X11 applications should be routed through new
+        SSH channels, using `.Transport.open_x11_channel`.
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the X11 request arrived on
+        :param bool single_connection:
+            ``True`` if only a single X11 channel should be opened, else
+            ``False``.
+        :param str auth_protocol: the protocol used for X11 authentication
+        :param str auth_cookie: the cookie used to authenticate to X11
+        :param int screen_number: the number of the X11 screen to connect to
+        :return: ``True`` if the X11 session was opened; ``False`` if not
+        """
+        return False
+
+    def check_channel_forward_agent_request(self, channel):
+        """
+        Determine if the client will be provided with an forward agent session.
+        If this method returns ``True``, the server will allow SSH Agent
+        forwarding.
+
+        The default implementation always returns ``False``.
+
+        :param .Channel channel: the `.Channel` the request arrived on
+        :return: ``True`` if the AgentForward was loaded; ``False`` if not
+
+        If ``True`` is returned, the server should create an
+        :class:`AgentServerProxy` to access the agent.
+        """
+        return False
+
+    def check_channel_direct_tcpip_request(self, chanid, origin, destination):
+        """
+        Determine if a local port forwarding channel will be granted, and
+        return ``OPEN_SUCCEEDED`` or an error code.  This method is
+        called in server mode when the client requests a channel, after
+        authentication is complete.
+
+        The ``chanid`` parameter is a small number that uniquely identifies the
+        channel within a `.Transport`.  A `.Channel` object is not created
+        unless this method returns ``OPEN_SUCCEEDED`` -- once a
+        `.Channel` object is created, you can call `.Channel.get_id` to
+        retrieve the channel ID.
+
+        The origin and destination parameters are (ip_address, port) tuples
+        that correspond to both ends of the TCP connection in the forwarding
+        tunnel.
+
+        The return value should either be ``OPEN_SUCCEEDED`` (or
+        ``0``) to allow the channel request, or one of the following error
+        codes to reject it:
+
+            - ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``
+            - ``OPEN_FAILED_CONNECT_FAILED``
+            - ``OPEN_FAILED_UNKNOWN_CHANNEL_TYPE``
+            - ``OPEN_FAILED_RESOURCE_SHORTAGE``
+
+        The default implementation always returns
+        ``OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED``.
+
+        :param int chanid: ID of the channel
+        :param tuple origin:
+            2-tuple containing the IP address and port of the originator
+            (client side)
+        :param tuple destination:
+            2-tuple containing the IP address and port of the destination
+            (server side)
+        :return: an `int` success or failure code (listed above)
+        """
+        return OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
+
+    def check_channel_env_request(self, channel, name, value):
+        """
+        Check whether a given environment variable can be specified for the
+        given channel.  This method should return ``True`` if the server
+        is willing to set the specified environment variable.  Note that
+        some environment variables (e.g., PATH) can be exceedingly
+        dangerous, so blindly allowing the client to set the environment
+        is almost certainly not a good idea.
+
+        The default implementation always returns ``False``.
+
+        :param channel: the `.Channel` the env request arrived on
+        :param str name: name
+        :param str value: Channel value
+        :returns: A boolean
+        """
+        return False
+
+    def get_banner(self):
+        """
+        A pre-login banner to display to the user. The message may span
+        multiple lines separated by crlf pairs. The language should be in
+        rfc3066 style, for example: en-US
+
+        The default implementation always returns ``(None, None)``.
+
+        :returns: A tuple containing the banner and language code.
+
+        .. versionadded:: 2.3
+        """
+        return (None, None)
+
+
+class InteractiveQuery:
+    """
+    A query (set of prompts) for a user during interactive authentication.
+    """
+
+    def __init__(self, name="", instructions="", *prompts):
+        """
+        Create a new interactive query to send to the client.  The name and
+        instructions are optional, but are generally displayed to the end
+        user.  A list of prompts may be included, or they may be added via
+        the `add_prompt` method.
+
+        :param str name: name of this query
+        :param str instructions:
+            user instructions (usually short) about this query
+        :param str prompts: one or more authentication prompts
+        """
+        self.name = name
+        self.instructions = instructions
+        self.prompts = []
+        for x in prompts:
+            if isinstance(x, str):
+                self.add_prompt(x)
+            else:
+                self.add_prompt(x[0], x[1])
+
+    def add_prompt(self, prompt, echo=True):
+        """
+        Add a prompt to this query.  The prompt should be a (reasonably short)
+        string.  Multiple prompts can be added to the same query.
+
+        :param str prompt: the user prompt
+        :param bool echo:
+            ``True`` (default) if the user's response should be echoed;
+            ``False`` if not (for a password or similar)
+        """
+        self.prompts.append((prompt, echo))
+
+
+class SubsystemHandler(threading.Thread):
+    """
+    Handler for a subsystem in server mode.  If you create a subclass of this
+    class and pass it to `.Transport.set_subsystem_handler`, an object of this
+    class will be created for each request for this subsystem.  Each new object
+    will be executed within its own new thread by calling `start_subsystem`.
+    When that method completes, the channel is closed.
+
+    For example, if you made a subclass ``MP3Handler`` and registered it as the
+    handler for subsystem ``"mp3"``, then whenever a client has successfully
+    authenticated and requests subsystem ``"mp3"``, an object of class
+    ``MP3Handler`` will be created, and `start_subsystem` will be called on
+    it from a new thread.
+    """
+
+    def __init__(self, channel, name, server):
+        """
+        Create a new handler for a channel.  This is used by `.ServerInterface`
+        to start up a new handler when a channel requests this subsystem.  You
+        don't need to override this method, but if you do, be sure to pass the
+        ``channel`` and ``name`` parameters through to the original
+        ``__init__`` method here.
+
+        :param .Channel channel: the channel associated with this
+            subsystem request.
+        :param str name: name of the requested subsystem.
+        :param .ServerInterface server:
+            the server object for the session that started this subsystem
+        """
+        threading.Thread.__init__(self, target=self._run)
+        self.__channel = channel
+        self.__transport = channel.get_transport()
+        self.__name = name
+        self.__server = server
+
+    def get_server(self):
+        """
+        Return the `.ServerInterface` object associated with this channel and
+        subsystem.
+        """
+        return self.__server
+
+    def _run(self):
+        try:
+            self.__transport._log(
+                DEBUG, "Starting handler for subsystem {}".format(self.__name)
+            )
+            self.start_subsystem(self.__name, self.__transport, self.__channel)
+        except Exception as e:
+            self.__transport._log(
+                ERROR,
+                'Exception in subsystem handler for "{}": {}'.format(
+                    self.__name, e
+                ),
+            )
+            self.__transport._log(ERROR, util.tb_strings())
+        try:
+            self.finish_subsystem()
+        except:
+            pass
+
+    def start_subsystem(self, name, transport, channel):
+        """
+        Process an ssh subsystem in server mode.  This method is called on a
+        new object (and in a new thread) for each subsystem request.  It is
+        assumed that all subsystem logic will take place here, and when the
+        subsystem is finished, this method will return.  After this method
+        returns, the channel is closed.
+
+        The combination of ``transport`` and ``channel`` are unique; this
+        handler corresponds to exactly one `.Channel` on one `.Transport`.
+
+        .. note::
+            It is the responsibility of this method to exit if the underlying
+            `.Transport` is closed.  This can be done by checking
+            `.Transport.is_active` or noticing an EOF on the `.Channel`.  If
+            this method loops forever without checking for this case, your
+            Python interpreter may refuse to exit because this thread will
+            still be running.
+
+        :param str name: name of the requested subsystem.
+        :param .Transport transport: the server-mode `.Transport`.
+        :param .Channel channel: the channel associated with this subsystem
+            request.
+        """
+        pass
+
+    def finish_subsystem(self):
+        """
+        Perform any cleanup at the end of a subsystem.  The default
+        implementation just closes the channel.
+
+        .. versionadded:: 1.1
+        """
+        self.__channel.close()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp.py
new file mode 100644
index 0000000000000000000000000000000000000000..b3528d4ebdabdf2375e574920872ed11fdbff828
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp.py
@@ -0,0 +1,224 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+import select
+import socket
+import struct
+
+from paramiko import util
+from paramiko.common import DEBUG, byte_chr, byte_ord
+from paramiko.message import Message
+
+
+(
+    CMD_INIT,
+    CMD_VERSION,
+    CMD_OPEN,
+    CMD_CLOSE,
+    CMD_READ,
+    CMD_WRITE,
+    CMD_LSTAT,
+    CMD_FSTAT,
+    CMD_SETSTAT,
+    CMD_FSETSTAT,
+    CMD_OPENDIR,
+    CMD_READDIR,
+    CMD_REMOVE,
+    CMD_MKDIR,
+    CMD_RMDIR,
+    CMD_REALPATH,
+    CMD_STAT,
+    CMD_RENAME,
+    CMD_READLINK,
+    CMD_SYMLINK,
+) = range(1, 21)
+(CMD_STATUS, CMD_HANDLE, CMD_DATA, CMD_NAME, CMD_ATTRS) = range(101, 106)
+(CMD_EXTENDED, CMD_EXTENDED_REPLY) = range(200, 202)
+
+SFTP_OK = 0
+(
+    SFTP_EOF,
+    SFTP_NO_SUCH_FILE,
+    SFTP_PERMISSION_DENIED,
+    SFTP_FAILURE,
+    SFTP_BAD_MESSAGE,
+    SFTP_NO_CONNECTION,
+    SFTP_CONNECTION_LOST,
+    SFTP_OP_UNSUPPORTED,
+) = range(1, 9)
+
+SFTP_DESC = [
+    "Success",
+    "End of file",
+    "No such file",
+    "Permission denied",
+    "Failure",
+    "Bad message",
+    "No connection",
+    "Connection lost",
+    "Operation unsupported",
+]
+
+SFTP_FLAG_READ = 0x1
+SFTP_FLAG_WRITE = 0x2
+SFTP_FLAG_APPEND = 0x4
+SFTP_FLAG_CREATE = 0x8
+SFTP_FLAG_TRUNC = 0x10
+SFTP_FLAG_EXCL = 0x20
+
+_VERSION = 3
+
+
+# for debugging
+CMD_NAMES = {
+    CMD_INIT: "init",
+    CMD_VERSION: "version",
+    CMD_OPEN: "open",
+    CMD_CLOSE: "close",
+    CMD_READ: "read",
+    CMD_WRITE: "write",
+    CMD_LSTAT: "lstat",
+    CMD_FSTAT: "fstat",
+    CMD_SETSTAT: "setstat",
+    CMD_FSETSTAT: "fsetstat",
+    CMD_OPENDIR: "opendir",
+    CMD_READDIR: "readdir",
+    CMD_REMOVE: "remove",
+    CMD_MKDIR: "mkdir",
+    CMD_RMDIR: "rmdir",
+    CMD_REALPATH: "realpath",
+    CMD_STAT: "stat",
+    CMD_RENAME: "rename",
+    CMD_READLINK: "readlink",
+    CMD_SYMLINK: "symlink",
+    CMD_STATUS: "status",
+    CMD_HANDLE: "handle",
+    CMD_DATA: "data",
+    CMD_NAME: "name",
+    CMD_ATTRS: "attrs",
+    CMD_EXTENDED: "extended",
+    CMD_EXTENDED_REPLY: "extended_reply",
+}
+
+
+# TODO: rewrite SFTP file/server modules' overly-flexible "make a request with
+# xyz components" so we don't need this very silly method of signaling whether
+# a given Python integer should be 32- or 64-bit.
+# NOTE: this only became an issue when dropping Python 2 support; prior to
+# doing so, we had to support actual-longs, which served as that signal. This
+# is simply recreating that structure in a more tightly scoped fashion.
+class int64(int):
+    pass
+
+
+class SFTPError(Exception):
+    pass
+
+
+class BaseSFTP:
+    def __init__(self):
+        self.logger = util.get_logger("paramiko.sftp")
+        self.sock = None
+        self.ultra_debug = False
+
+    # ...internals...
+
+    def _send_version(self):
+        m = Message()
+        m.add_int(_VERSION)
+        self._send_packet(CMD_INIT, m)
+        t, data = self._read_packet()
+        if t != CMD_VERSION:
+            raise SFTPError("Incompatible sftp protocol")
+        version = struct.unpack(">I", data[:4])[0]
+        #        if version != _VERSION:
+        #            raise SFTPError('Incompatible sftp protocol')
+        return version
+
+    def _send_server_version(self):
+        # winscp will freak out if the server sends version info before the
+        # client finishes sending INIT.
+        t, data = self._read_packet()
+        if t != CMD_INIT:
+            raise SFTPError("Incompatible sftp protocol")
+        version = struct.unpack(">I", data[:4])[0]
+        # advertise that we support "check-file"
+        extension_pairs = ["check-file", "md5,sha1"]
+        msg = Message()
+        msg.add_int(_VERSION)
+        msg.add(*extension_pairs)
+        self._send_packet(CMD_VERSION, msg)
+        return version
+
+    def _log(self, level, msg, *args):
+        self.logger.log(level, msg, *args)
+
+    def _write_all(self, out):
+        while len(out) > 0:
+            n = self.sock.send(out)
+            if n <= 0:
+                raise EOFError()
+            if n == len(out):
+                return
+            out = out[n:]
+        return
+
+    def _read_all(self, n):
+        out = bytes()
+        while n > 0:
+            if isinstance(self.sock, socket.socket):
+                # sometimes sftp is used directly over a socket instead of
+                # through a paramiko channel.  in this case, check periodically
+                # if the socket is closed.  (for some reason, recv() won't ever
+                # return or raise an exception, but calling select on a closed
+                # socket will.)
+                while True:
+                    read, write, err = select.select([self.sock], [], [], 0.1)
+                    if len(read) > 0:
+                        x = self.sock.recv(n)
+                        break
+            else:
+                x = self.sock.recv(n)
+
+            if len(x) == 0:
+                raise EOFError()
+            out += x
+            n -= len(x)
+        return out
+
+    def _send_packet(self, t, packet):
+        packet = packet.asbytes()
+        out = struct.pack(">I", len(packet) + 1) + byte_chr(t) + packet
+        if self.ultra_debug:
+            self._log(DEBUG, util.format_binary(out, "OUT: "))
+        self._write_all(out)
+
+    def _read_packet(self):
+        x = self._read_all(4)
+        # most sftp servers won't accept packets larger than about 32k, so
+        # anything with the high byte set (> 16MB) is just garbage.
+        if byte_ord(x[0]):
+            raise SFTPError("Garbage packet received")
+        size = struct.unpack(">I", x)[0]
+        data = self._read_all(size)
+        if self.ultra_debug:
+            self._log(DEBUG, util.format_binary(data, "IN: "))
+        if size > 0:
+            t = byte_ord(data[0])
+            return t, data[1:]
+        return 0, bytes()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_attr.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_attr.py
new file mode 100644
index 0000000000000000000000000000000000000000..18ffbf868db5fe2e33858d95f097c5366d59f880
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_attr.py
@@ -0,0 +1,239 @@
+# Copyright (C) 2003-2006 Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+import stat
+import time
+from paramiko.common import x80000000, o700, o70, xffffffff
+
+
+class SFTPAttributes:
+    """
+    Representation of the attributes of a file (or proxied file) for SFTP in
+    client or server mode.  It attempts to mirror the object returned by
+    `os.stat` as closely as possible, so it may have the following fields,
+    with the same meanings as those returned by an `os.stat` object:
+
+        - ``st_size``
+        - ``st_uid``
+        - ``st_gid``
+        - ``st_mode``
+        - ``st_atime``
+        - ``st_mtime``
+
+    Because SFTP allows flags to have other arbitrary named attributes, these
+    are stored in a dict named ``attr``.  Occasionally, the filename is also
+    stored, in ``filename``.
+    """
+
+    FLAG_SIZE = 1
+    FLAG_UIDGID = 2
+    FLAG_PERMISSIONS = 4
+    FLAG_AMTIME = 8
+    FLAG_EXTENDED = x80000000
+
+    def __init__(self):
+        """
+        Create a new (empty) SFTPAttributes object.  All fields will be empty.
+        """
+        self._flags = 0
+        self.st_size = None
+        self.st_uid = None
+        self.st_gid = None
+        self.st_mode = None
+        self.st_atime = None
+        self.st_mtime = None
+        self.attr = {}
+
+    @classmethod
+    def from_stat(cls, obj, filename=None):
+        """
+        Create an `.SFTPAttributes` object from an existing ``stat`` object (an
+        object returned by `os.stat`).
+
+        :param object obj: an object returned by `os.stat` (or equivalent).
+        :param str filename: the filename associated with this file.
+        :return: new `.SFTPAttributes` object with the same attribute fields.
+        """
+        attr = cls()
+        attr.st_size = obj.st_size
+        attr.st_uid = obj.st_uid
+        attr.st_gid = obj.st_gid
+        attr.st_mode = obj.st_mode
+        attr.st_atime = obj.st_atime
+        attr.st_mtime = obj.st_mtime
+        if filename is not None:
+            attr.filename = filename
+        return attr
+
+    def __repr__(self):
+        return "<SFTPAttributes: {}>".format(self._debug_str())
+
+    # ...internals...
+    @classmethod
+    def _from_msg(cls, msg, filename=None, longname=None):
+        attr = cls()
+        attr._unpack(msg)
+        if filename is not None:
+            attr.filename = filename
+        if longname is not None:
+            attr.longname = longname
+        return attr
+
+    def _unpack(self, msg):
+        self._flags = msg.get_int()
+        if self._flags & self.FLAG_SIZE:
+            self.st_size = msg.get_int64()
+        if self._flags & self.FLAG_UIDGID:
+            self.st_uid = msg.get_int()
+            self.st_gid = msg.get_int()
+        if self._flags & self.FLAG_PERMISSIONS:
+            self.st_mode = msg.get_int()
+        if self._flags & self.FLAG_AMTIME:
+            self.st_atime = msg.get_int()
+            self.st_mtime = msg.get_int()
+        if self._flags & self.FLAG_EXTENDED:
+            count = msg.get_int()
+            for i in range(count):
+                self.attr[msg.get_string()] = msg.get_string()
+
+    def _pack(self, msg):
+        self._flags = 0
+        if self.st_size is not None:
+            self._flags |= self.FLAG_SIZE
+        if (self.st_uid is not None) and (self.st_gid is not None):
+            self._flags |= self.FLAG_UIDGID
+        if self.st_mode is not None:
+            self._flags |= self.FLAG_PERMISSIONS
+        if (self.st_atime is not None) and (self.st_mtime is not None):
+            self._flags |= self.FLAG_AMTIME
+        if len(self.attr) > 0:
+            self._flags |= self.FLAG_EXTENDED
+        msg.add_int(self._flags)
+        if self._flags & self.FLAG_SIZE:
+            msg.add_int64(self.st_size)
+        if self._flags & self.FLAG_UIDGID:
+            msg.add_int(self.st_uid)
+            msg.add_int(self.st_gid)
+        if self._flags & self.FLAG_PERMISSIONS:
+            msg.add_int(self.st_mode)
+        if self._flags & self.FLAG_AMTIME:
+            # throw away any fractional seconds
+            msg.add_int(int(self.st_atime))
+            msg.add_int(int(self.st_mtime))
+        if self._flags & self.FLAG_EXTENDED:
+            msg.add_int(len(self.attr))
+            for key, val in self.attr.items():
+                msg.add_string(key)
+                msg.add_string(val)
+        return
+
+    def _debug_str(self):
+        out = "[ "
+        if self.st_size is not None:
+            out += "size={} ".format(self.st_size)
+        if (self.st_uid is not None) and (self.st_gid is not None):
+            out += "uid={} gid={} ".format(self.st_uid, self.st_gid)
+        if self.st_mode is not None:
+            out += "mode=" + oct(self.st_mode) + " "
+        if (self.st_atime is not None) and (self.st_mtime is not None):
+            out += "atime={} mtime={} ".format(self.st_atime, self.st_mtime)
+        for k, v in self.attr.items():
+            out += '"{}"={!r} '.format(str(k), v)
+        out += "]"
+        return out
+
+    @staticmethod
+    def _rwx(n, suid, sticky=False):
+        if suid:
+            suid = 2
+        out = "-r"[n >> 2] + "-w"[(n >> 1) & 1]
+        if sticky:
+            out += "-xTt"[suid + (n & 1)]
+        else:
+            out += "-xSs"[suid + (n & 1)]
+        return out
+
+    def __str__(self):
+        """create a unix-style long description of the file (like ls -l)"""
+        if self.st_mode is not None:
+            kind = stat.S_IFMT(self.st_mode)
+            if kind == stat.S_IFIFO:
+                ks = "p"
+            elif kind == stat.S_IFCHR:
+                ks = "c"
+            elif kind == stat.S_IFDIR:
+                ks = "d"
+            elif kind == stat.S_IFBLK:
+                ks = "b"
+            elif kind == stat.S_IFREG:
+                ks = "-"
+            elif kind == stat.S_IFLNK:
+                ks = "l"
+            elif kind == stat.S_IFSOCK:
+                ks = "s"
+            else:
+                ks = "?"
+            ks += self._rwx(
+                (self.st_mode & o700) >> 6, self.st_mode & stat.S_ISUID
+            )
+            ks += self._rwx(
+                (self.st_mode & o70) >> 3, self.st_mode & stat.S_ISGID
+            )
+            ks += self._rwx(
+                self.st_mode & 7, self.st_mode & stat.S_ISVTX, True
+            )
+        else:
+            ks = "?---------"
+        # compute display date
+        if (self.st_mtime is None) or (self.st_mtime == xffffffff):
+            # shouldn't really happen
+            datestr = "(unknown date)"
+        else:
+            time_tuple = time.localtime(self.st_mtime)
+            if abs(time.time() - self.st_mtime) > 15_552_000:
+                # (15,552,000s = 6 months)
+                datestr = time.strftime("%d %b %Y", time_tuple)
+            else:
+                datestr = time.strftime("%d %b %H:%M", time_tuple)
+        filename = getattr(self, "filename", "?")
+
+        # not all servers support uid/gid
+        uid = self.st_uid
+        gid = self.st_gid
+        size = self.st_size
+        if uid is None:
+            uid = 0
+        if gid is None:
+            gid = 0
+        if size is None:
+            size = 0
+
+        # TODO: not sure this actually worked as expected beforehand, leaving
+        # it untouched for the time being, re: .format() upgrade, until someone
+        # has time to doublecheck
+        return "%s   1 %-8d %-8d %8d %-12s %s" % (
+            ks,
+            uid,
+            gid,
+            size,
+            datestr,
+            filename,
+        )
+
+    def asbytes(self):
+        return str(self).encode()
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_client.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_client.py
new file mode 100644
index 0000000000000000000000000000000000000000..066cd83f03297b53169ffda2db8478b85d89f842
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_client.py
@@ -0,0 +1,965 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of Paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+
+from binascii import hexlify
+import errno
+import os
+import stat
+import threading
+import time
+import weakref
+from paramiko import util
+from paramiko.channel import Channel
+from paramiko.message import Message
+from paramiko.common import INFO, DEBUG, o777
+from paramiko.sftp import (
+    BaseSFTP,
+    CMD_OPENDIR,
+    CMD_HANDLE,
+    SFTPError,
+    CMD_READDIR,
+    CMD_NAME,
+    CMD_CLOSE,
+    SFTP_FLAG_READ,
+    SFTP_FLAG_WRITE,
+    SFTP_FLAG_CREATE,
+    SFTP_FLAG_TRUNC,
+    SFTP_FLAG_APPEND,
+    SFTP_FLAG_EXCL,
+    CMD_OPEN,
+    CMD_REMOVE,
+    CMD_RENAME,
+    CMD_MKDIR,
+    CMD_RMDIR,
+    CMD_STAT,
+    CMD_ATTRS,
+    CMD_LSTAT,
+    CMD_SYMLINK,
+    CMD_SETSTAT,
+    CMD_READLINK,
+    CMD_REALPATH,
+    CMD_STATUS,
+    CMD_EXTENDED,
+    SFTP_OK,
+    SFTP_EOF,
+    SFTP_NO_SUCH_FILE,
+    SFTP_PERMISSION_DENIED,
+    int64,
+)
+
+from paramiko.sftp_attr import SFTPAttributes
+from paramiko.ssh_exception import SSHException
+from paramiko.sftp_file import SFTPFile
+from paramiko.util import ClosingContextManager, b, u
+
+
+def _to_unicode(s):
+    """
+    decode a string as ascii or utf8 if possible (as required by the sftp
+    protocol).  if neither works, just return a byte string because the server
+    probably doesn't know the filename's encoding.
+    """
+    try:
+        return s.encode("ascii")
+    except (UnicodeError, AttributeError):
+        try:
+            return s.decode("utf-8")
+        except UnicodeError:
+            return s
+
+
+b_slash = b"/"
+
+
+class SFTPClient(BaseSFTP, ClosingContextManager):
+    """
+    SFTP client object.
+
+    Used to open an SFTP session across an open SSH `.Transport` and perform
+    remote file operations.
+
+    Instances of this class may be used as context managers.
+    """
+
+    def __init__(self, sock):
+        """
+        Create an SFTP client from an existing `.Channel`.  The channel
+        should already have requested the ``"sftp"`` subsystem.
+
+        An alternate way to create an SFTP client context is by using
+        `from_transport`.
+
+        :param .Channel sock: an open `.Channel` using the ``"sftp"`` subsystem
+
+        :raises:
+            `.SSHException` -- if there's an exception while negotiating sftp
+        """
+        BaseSFTP.__init__(self)
+        self.sock = sock
+        self.ultra_debug = False
+        self.request_number = 1
+        # lock for request_number
+        self._lock = threading.Lock()
+        self._cwd = None
+        # request # -> SFTPFile
+        self._expecting = weakref.WeakValueDictionary()
+        if type(sock) is Channel:
+            # override default logger
+            transport = self.sock.get_transport()
+            self.logger = util.get_logger(
+                transport.get_log_channel() + ".sftp"
+            )
+            self.ultra_debug = transport.get_hexdump()
+        try:
+            server_version = self._send_version()
+        except EOFError:
+            raise SSHException("EOF during negotiation")
+        self._log(
+            INFO,
+            "Opened sftp connection (server version {})".format(
+                server_version
+            ),
+        )
+
+    @classmethod
+    def from_transport(cls, t, window_size=None, max_packet_size=None):
+        """
+        Create an SFTP client channel from an open `.Transport`.
+
+        Setting the window and packet sizes might affect the transfer speed.
+        The default settings in the `.Transport` class are the same as in
+        OpenSSH and should work adequately for both files transfers and
+        interactive sessions.
+
+        :param .Transport t: an open `.Transport` which is already
+            authenticated
+        :param int window_size:
+            optional window size for the `.SFTPClient` session.
+        :param int max_packet_size:
+            optional max packet size for the `.SFTPClient` session..
+
+        :return:
+            a new `.SFTPClient` object, referring to an sftp session (channel)
+            across the transport
+
+        .. versionchanged:: 1.15
+            Added the ``window_size`` and ``max_packet_size`` arguments.
+        """
+        chan = t.open_session(
+            window_size=window_size, max_packet_size=max_packet_size
+        )
+        if chan is None:
+            return None
+        chan.invoke_subsystem("sftp")
+        return cls(chan)
+
+    def _log(self, level, msg, *args):
+        if isinstance(msg, list):
+            for m in msg:
+                self._log(level, m, *args)
+        else:
+            # NOTE: these bits MUST continue using %-style format junk because
+            # logging.Logger.log() explicitly requires it. Grump.
+            # escape '%' in msg (they could come from file or directory names)
+            # before logging
+            msg = msg.replace("%", "%%")
+            super()._log(
+                level,
+                "[chan %s] " + msg,
+                *([self.sock.get_name()] + list(args))
+            )
+
+    def close(self):
+        """
+        Close the SFTP session and its underlying channel.
+
+        .. versionadded:: 1.4
+        """
+        self._log(INFO, "sftp session closed.")
+        self.sock.close()
+
+    def get_channel(self):
+        """
+        Return the underlying `.Channel` object for this SFTP session.  This
+        might be useful for doing things like setting a timeout on the channel.
+
+        .. versionadded:: 1.7.1
+        """
+        return self.sock
+
+    def listdir(self, path="."):
+        """
+        Return a list containing the names of the entries in the given
+        ``path``.
+
+        The list is in arbitrary order.  It does not include the special
+        entries ``'.'`` and ``'..'`` even if they are present in the folder.
+        This method is meant to mirror ``os.listdir`` as closely as possible.
+        For a list of full `.SFTPAttributes` objects, see `listdir_attr`.
+
+        :param str path: path to list (defaults to ``'.'``)
+        """
+        return [f.filename for f in self.listdir_attr(path)]
+
+    def listdir_attr(self, path="."):
+        """
+        Return a list containing `.SFTPAttributes` objects corresponding to
+        files in the given ``path``.  The list is in arbitrary order.  It does
+        not include the special entries ``'.'`` and ``'..'`` even if they are
+        present in the folder.
+
+        The returned `.SFTPAttributes` objects will each have an additional
+        field: ``longname``, which may contain a formatted string of the file's
+        attributes, in unix format.  The content of this string will probably
+        depend on the SFTP server implementation.
+
+        :param str path: path to list (defaults to ``'.'``)
+        :return: list of `.SFTPAttributes` objects
+
+        .. versionadded:: 1.2
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "listdir({!r})".format(path))
+        t, msg = self._request(CMD_OPENDIR, path)
+        if t != CMD_HANDLE:
+            raise SFTPError("Expected handle")
+        handle = msg.get_binary()
+        filelist = []
+        while True:
+            try:
+                t, msg = self._request(CMD_READDIR, handle)
+            except EOFError:
+                # done with handle
+                break
+            if t != CMD_NAME:
+                raise SFTPError("Expected name response")
+            count = msg.get_int()
+            for i in range(count):
+                filename = msg.get_text()
+                longname = msg.get_text()
+                attr = SFTPAttributes._from_msg(msg, filename, longname)
+                if (filename != ".") and (filename != ".."):
+                    filelist.append(attr)
+        self._request(CMD_CLOSE, handle)
+        return filelist
+
+    def listdir_iter(self, path=".", read_aheads=50):
+        """
+        Generator version of `.listdir_attr`.
+
+        See the API docs for `.listdir_attr` for overall details.
+
+        This function adds one more kwarg on top of `.listdir_attr`:
+        ``read_aheads``, an integer controlling how many
+        ``SSH_FXP_READDIR`` requests are made to the server. The default of 50
+        should suffice for most file listings as each request/response cycle
+        may contain multiple files (dependent on server implementation.)
+
+        .. versionadded:: 1.15
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "listdir({!r})".format(path))
+        t, msg = self._request(CMD_OPENDIR, path)
+
+        if t != CMD_HANDLE:
+            raise SFTPError("Expected handle")
+
+        handle = msg.get_string()
+
+        nums = list()
+        while True:
+            try:
+                # Send out a bunch of readdir requests so that we can read the
+                # responses later on Section 6.7 of the SSH file transfer RFC
+                # explains this
+                # http://filezilla-project.org/specs/draft-ietf-secsh-filexfer-02.txt
+                for i in range(read_aheads):
+                    num = self._async_request(type(None), CMD_READDIR, handle)
+                    nums.append(num)
+
+                # For each of our sent requests
+                # Read and parse the corresponding packets
+                # If we're at the end of our queued requests, then fire off
+                # some more requests
+                # Exit the loop when we've reached the end of the directory
+                # handle
+                for num in nums:
+                    t, pkt_data = self._read_packet()
+                    msg = Message(pkt_data)
+                    new_num = msg.get_int()
+                    if num == new_num:
+                        if t == CMD_STATUS:
+                            self._convert_status(msg)
+                    count = msg.get_int()
+                    for i in range(count):
+                        filename = msg.get_text()
+                        longname = msg.get_text()
+                        attr = SFTPAttributes._from_msg(
+                            msg, filename, longname
+                        )
+                        if (filename != ".") and (filename != ".."):
+                            yield attr
+
+                # If we've hit the end of our queued requests, reset nums.
+                nums = list()
+
+            except EOFError:
+                self._request(CMD_CLOSE, handle)
+                return
+
+    def open(self, filename, mode="r", bufsize=-1):
+        """
+        Open a file on the remote server.  The arguments are the same as for
+        Python's built-in `python:file` (aka `python:open`).  A file-like
+        object is returned, which closely mimics the behavior of a normal
+        Python file object, including the ability to be used as a context
+        manager.
+
+        The mode indicates how the file is to be opened: ``'r'`` for reading,
+        ``'w'`` for writing (truncating an existing file), ``'a'`` for
+        appending, ``'r+'`` for reading/writing, ``'w+'`` for reading/writing
+        (truncating an existing file), ``'a+'`` for reading/appending.  The
+        Python ``'b'`` flag is ignored, since SSH treats all files as binary.
+        The ``'U'`` flag is supported in a compatible way.
+
+        Since 1.5.2, an ``'x'`` flag indicates that the operation should only
+        succeed if the file was created and did not previously exist.  This has
+        no direct mapping to Python's file flags, but is commonly known as the
+        ``O_EXCL`` flag in posix.
+
+        The file will be buffered in standard Python style by default, but
+        can be altered with the ``bufsize`` parameter.  ``<=0`` turns off
+        buffering, ``1`` uses line buffering, and any number greater than 1
+        (``>1``) uses that specific buffer size.
+
+        :param str filename: name of the file to open
+        :param str mode: mode (Python-style) to open in
+        :param int bufsize: desired buffering (default: ``-1``)
+        :return: an `.SFTPFile` object representing the open file
+
+        :raises: ``IOError`` -- if the file could not be opened.
+        """
+        filename = self._adjust_cwd(filename)
+        self._log(DEBUG, "open({!r}, {!r})".format(filename, mode))
+        imode = 0
+        if ("r" in mode) or ("+" in mode):
+            imode |= SFTP_FLAG_READ
+        if ("w" in mode) or ("+" in mode) or ("a" in mode):
+            imode |= SFTP_FLAG_WRITE
+        if "w" in mode:
+            imode |= SFTP_FLAG_CREATE | SFTP_FLAG_TRUNC
+        if "a" in mode:
+            imode |= SFTP_FLAG_CREATE | SFTP_FLAG_APPEND
+        if "x" in mode:
+            imode |= SFTP_FLAG_CREATE | SFTP_FLAG_EXCL
+        attrblock = SFTPAttributes()
+        t, msg = self._request(CMD_OPEN, filename, imode, attrblock)
+        if t != CMD_HANDLE:
+            raise SFTPError("Expected handle")
+        handle = msg.get_binary()
+        self._log(
+            DEBUG,
+            "open({!r}, {!r}) -> {}".format(
+                filename, mode, u(hexlify(handle))
+            ),
+        )
+        return SFTPFile(self, handle, mode, bufsize)
+
+    # Python continues to vacillate about "open" vs "file"...
+    file = open
+
+    def remove(self, path):
+        """
+        Remove the file at the given path.  This only works on files; for
+        removing folders (directories), use `rmdir`.
+
+        :param str path: path (absolute or relative) of the file to remove
+
+        :raises: ``IOError`` -- if the path refers to a folder (directory)
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "remove({!r})".format(path))
+        self._request(CMD_REMOVE, path)
+
+    unlink = remove
+
+    def rename(self, oldpath, newpath):
+        """
+        Rename a file or folder from ``oldpath`` to ``newpath``.
+
+        .. note::
+            This method implements 'standard' SFTP ``RENAME`` behavior; those
+            seeking the OpenSSH "POSIX rename" extension behavior should use
+            `posix_rename`.
+
+        :param str oldpath:
+            existing name of the file or folder
+        :param str newpath:
+            new name for the file or folder, must not exist already
+
+        :raises:
+            ``IOError`` -- if ``newpath`` is a folder, or something else goes
+            wrong
+        """
+        oldpath = self._adjust_cwd(oldpath)
+        newpath = self._adjust_cwd(newpath)
+        self._log(DEBUG, "rename({!r}, {!r})".format(oldpath, newpath))
+        self._request(CMD_RENAME, oldpath, newpath)
+
+    def posix_rename(self, oldpath, newpath):
+        """
+        Rename a file or folder from ``oldpath`` to ``newpath``, following
+        posix conventions.
+
+        :param str oldpath: existing name of the file or folder
+        :param str newpath: new name for the file or folder, will be
+            overwritten if it already exists
+
+        :raises:
+            ``IOError`` -- if ``newpath`` is a folder, posix-rename is not
+            supported by the server or something else goes wrong
+
+        :versionadded: 2.2
+        """
+        oldpath = self._adjust_cwd(oldpath)
+        newpath = self._adjust_cwd(newpath)
+        self._log(DEBUG, "posix_rename({!r}, {!r})".format(oldpath, newpath))
+        self._request(
+            CMD_EXTENDED, "posix-rename@openssh.com", oldpath, newpath
+        )
+
+    def mkdir(self, path, mode=o777):
+        """
+        Create a folder (directory) named ``path`` with numeric mode ``mode``.
+        The default mode is 0777 (octal).  On some systems, mode is ignored.
+        Where it is used, the current umask value is first masked out.
+
+        :param str path: name of the folder to create
+        :param int mode: permissions (posix-style) for the newly-created folder
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "mkdir({!r}, {!r})".format(path, mode))
+        attr = SFTPAttributes()
+        attr.st_mode = mode
+        self._request(CMD_MKDIR, path, attr)
+
+    def rmdir(self, path):
+        """
+        Remove the folder named ``path``.
+
+        :param str path: name of the folder to remove
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "rmdir({!r})".format(path))
+        self._request(CMD_RMDIR, path)
+
+    def stat(self, path):
+        """
+        Retrieve information about a file on the remote system.  The return
+        value is an object whose attributes correspond to the attributes of
+        Python's ``stat`` structure as returned by ``os.stat``, except that it
+        contains fewer fields.  An SFTP server may return as much or as little
+        info as it wants, so the results may vary from server to server.
+
+        Unlike a Python `python:stat` object, the result may not be accessed as
+        a tuple.  This is mostly due to the author's slack factor.
+
+        The fields supported are: ``st_mode``, ``st_size``, ``st_uid``,
+        ``st_gid``, ``st_atime``, and ``st_mtime``.
+
+        :param str path: the filename to stat
+        :return:
+            an `.SFTPAttributes` object containing attributes about the given
+            file
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "stat({!r})".format(path))
+        t, msg = self._request(CMD_STAT, path)
+        if t != CMD_ATTRS:
+            raise SFTPError("Expected attributes")
+        return SFTPAttributes._from_msg(msg)
+
+    def lstat(self, path):
+        """
+        Retrieve information about a file on the remote system, without
+        following symbolic links (shortcuts).  This otherwise behaves exactly
+        the same as `stat`.
+
+        :param str path: the filename to stat
+        :return:
+            an `.SFTPAttributes` object containing attributes about the given
+            file
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "lstat({!r})".format(path))
+        t, msg = self._request(CMD_LSTAT, path)
+        if t != CMD_ATTRS:
+            raise SFTPError("Expected attributes")
+        return SFTPAttributes._from_msg(msg)
+
+    def symlink(self, source, dest):
+        """
+        Create a symbolic link to the ``source`` path at ``destination``.
+
+        :param str source: path of the original file
+        :param str dest: path of the newly created symlink
+        """
+        dest = self._adjust_cwd(dest)
+        self._log(DEBUG, "symlink({!r}, {!r})".format(source, dest))
+        source = b(source)
+        self._request(CMD_SYMLINK, source, dest)
+
+    def chmod(self, path, mode):
+        """
+        Change the mode (permissions) of a file.  The permissions are
+        unix-style and identical to those used by Python's `os.chmod`
+        function.
+
+        :param str path: path of the file to change the permissions of
+        :param int mode: new permissions
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "chmod({!r}, {!r})".format(path, mode))
+        attr = SFTPAttributes()
+        attr.st_mode = mode
+        self._request(CMD_SETSTAT, path, attr)
+
+    def chown(self, path, uid, gid):
+        """
+        Change the owner (``uid``) and group (``gid``) of a file.  As with
+        Python's `os.chown` function, you must pass both arguments, so if you
+        only want to change one, use `stat` first to retrieve the current
+        owner and group.
+
+        :param str path: path of the file to change the owner and group of
+        :param int uid: new owner's uid
+        :param int gid: new group id
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "chown({!r}, {!r}, {!r})".format(path, uid, gid))
+        attr = SFTPAttributes()
+        attr.st_uid, attr.st_gid = uid, gid
+        self._request(CMD_SETSTAT, path, attr)
+
+    def utime(self, path, times):
+        """
+        Set the access and modified times of the file specified by ``path``.
+        If ``times`` is ``None``, then the file's access and modified times
+        are set to the current time.  Otherwise, ``times`` must be a 2-tuple
+        of numbers, of the form ``(atime, mtime)``, which is used to set the
+        access and modified times, respectively.  This bizarre API is mimicked
+        from Python for the sake of consistency -- I apologize.
+
+        :param str path: path of the file to modify
+        :param tuple times:
+            ``None`` or a tuple of (access time, modified time) in standard
+            internet epoch time (seconds since 01 January 1970 GMT)
+        """
+        path = self._adjust_cwd(path)
+        if times is None:
+            times = (time.time(), time.time())
+        self._log(DEBUG, "utime({!r}, {!r})".format(path, times))
+        attr = SFTPAttributes()
+        attr.st_atime, attr.st_mtime = times
+        self._request(CMD_SETSTAT, path, attr)
+
+    def truncate(self, path, size):
+        """
+        Change the size of the file specified by ``path``.  This usually
+        extends or shrinks the size of the file, just like the `~file.truncate`
+        method on Python file objects.
+
+        :param str path: path of the file to modify
+        :param int size: the new size of the file
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "truncate({!r}, {!r})".format(path, size))
+        attr = SFTPAttributes()
+        attr.st_size = size
+        self._request(CMD_SETSTAT, path, attr)
+
+    def readlink(self, path):
+        """
+        Return the target of a symbolic link (shortcut).  You can use
+        `symlink` to create these.  The result may be either an absolute or
+        relative pathname.
+
+        :param str path: path of the symbolic link file
+        :return: target path, as a `str`
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "readlink({!r})".format(path))
+        t, msg = self._request(CMD_READLINK, path)
+        if t != CMD_NAME:
+            raise SFTPError("Expected name response")
+        count = msg.get_int()
+        if count == 0:
+            return None
+        if count != 1:
+            raise SFTPError("Readlink returned {} results".format(count))
+        return _to_unicode(msg.get_string())
+
+    def normalize(self, path):
+        """
+        Return the normalized path (on the server) of a given path.  This
+        can be used to quickly resolve symbolic links or determine what the
+        server is considering to be the "current folder" (by passing ``'.'``
+        as ``path``).
+
+        :param str path: path to be normalized
+        :return: normalized form of the given path (as a `str`)
+
+        :raises: ``IOError`` -- if the path can't be resolved on the server
+        """
+        path = self._adjust_cwd(path)
+        self._log(DEBUG, "normalize({!r})".format(path))
+        t, msg = self._request(CMD_REALPATH, path)
+        if t != CMD_NAME:
+            raise SFTPError("Expected name response")
+        count = msg.get_int()
+        if count != 1:
+            raise SFTPError("Realpath returned {} results".format(count))
+        return msg.get_text()
+
+    def chdir(self, path=None):
+        """
+        Change the "current directory" of this SFTP session.  Since SFTP
+        doesn't really have the concept of a current working directory, this is
+        emulated by Paramiko.  Once you use this method to set a working
+        directory, all operations on this `.SFTPClient` object will be relative
+        to that path. You can pass in ``None`` to stop using a current working
+        directory.
+
+        :param str path: new current working directory
+
+        :raises:
+            ``IOError`` -- if the requested path doesn't exist on the server
+
+        .. versionadded:: 1.4
+        """
+        if path is None:
+            self._cwd = None
+            return
+        if not stat.S_ISDIR(self.stat(path).st_mode):
+            code = errno.ENOTDIR
+            raise SFTPError(code, "{}: {}".format(os.strerror(code), path))
+        self._cwd = b(self.normalize(path))
+
+    def getcwd(self):
+        """
+        Return the "current working directory" for this SFTP session, as
+        emulated by Paramiko.  If no directory has been set with `chdir`,
+        this method will return ``None``.
+
+        .. versionadded:: 1.4
+        """
+        # TODO: make class initialize with self._cwd set to self.normalize('.')
+        return self._cwd and u(self._cwd)
+
+    def _transfer_with_callback(self, reader, writer, file_size, callback):
+        size = 0
+        while True:
+            data = reader.read(32768)
+            writer.write(data)
+            size += len(data)
+            if len(data) == 0:
+                break
+            if callback is not None:
+                callback(size, file_size)
+        return size
+
+    def putfo(self, fl, remotepath, file_size=0, callback=None, confirm=True):
+        """
+        Copy the contents of an open file object (``fl``) to the SFTP server as
+        ``remotepath``. Any exception raised by operations will be passed
+        through.
+
+        The SFTP operations use pipelining for speed.
+
+        :param fl: opened file or file-like object to copy
+        :param str remotepath: the destination path on the SFTP server
+        :param int file_size:
+            optional size parameter passed to callback. If none is specified,
+            size defaults to 0
+        :param callable callback:
+            optional callback function (form: ``func(int, int)``) that accepts
+            the bytes transferred so far and the total bytes to be transferred
+            (since 1.7.4)
+        :param bool confirm:
+            whether to do a stat() on the file afterwards to confirm the file
+            size (since 1.7.7)
+
+        :return:
+            an `.SFTPAttributes` object containing attributes about the given
+            file.
+
+        .. versionadded:: 1.10
+        """
+        with self.file(remotepath, "wb") as fr:
+            fr.set_pipelined(True)
+            size = self._transfer_with_callback(
+                reader=fl, writer=fr, file_size=file_size, callback=callback
+            )
+        if confirm:
+            s = self.stat(remotepath)
+            if s.st_size != size:
+                raise IOError(
+                    "size mismatch in put!  {} != {}".format(s.st_size, size)
+                )
+        else:
+            s = SFTPAttributes()
+        return s
+
+    def put(self, localpath, remotepath, callback=None, confirm=True):
+        """
+        Copy a local file (``localpath``) to the SFTP server as ``remotepath``.
+        Any exception raised by operations will be passed through.  This
+        method is primarily provided as a convenience.
+
+        The SFTP operations use pipelining for speed.
+
+        :param str localpath: the local file to copy
+        :param str remotepath: the destination path on the SFTP server. Note
+            that the filename should be included. Only specifying a directory
+            may result in an error.
+        :param callable callback:
+            optional callback function (form: ``func(int, int)``) that accepts
+            the bytes transferred so far and the total bytes to be transferred
+        :param bool confirm:
+            whether to do a stat() on the file afterwards to confirm the file
+            size
+
+        :return: an `.SFTPAttributes` object containing attributes about the
+            given file
+
+        .. versionadded:: 1.4
+        .. versionchanged:: 1.7.4
+            ``callback`` and rich attribute return value added.
+        .. versionchanged:: 1.7.7
+            ``confirm`` param added.
+        """
+        file_size = os.stat(localpath).st_size
+        with open(localpath, "rb") as fl:
+            return self.putfo(fl, remotepath, file_size, callback, confirm)
+
+    def getfo(
+        self,
+        remotepath,
+        fl,
+        callback=None,
+        prefetch=True,
+        max_concurrent_prefetch_requests=None,
+    ):
+        """
+        Copy a remote file (``remotepath``) from the SFTP server and write to
+        an open file or file-like object, ``fl``.  Any exception raised by
+        operations will be passed through.  This method is primarily provided
+        as a convenience.
+
+        :param object remotepath: opened file or file-like object to copy to
+        :param str fl:
+            the destination path on the local host or open file object
+        :param callable callback:
+            optional callback function (form: ``func(int, int)``) that accepts
+            the bytes transferred so far and the total bytes to be transferred
+        :param bool prefetch:
+            controls whether prefetching is performed (default: True)
+        :param int max_concurrent_prefetch_requests:
+            The maximum number of concurrent read requests to prefetch. See
+            `.SFTPClient.get` (its ``max_concurrent_prefetch_requests`` param)
+            for details.
+        :return: the `number <int>` of bytes written to the opened file object
+
+        .. versionadded:: 1.10
+        .. versionchanged:: 2.8
+            Added the ``prefetch`` keyword argument.
+        .. versionchanged:: 3.3
+            Added ``max_concurrent_prefetch_requests``.
+        """
+        file_size = self.stat(remotepath).st_size
+        with self.open(remotepath, "rb") as fr:
+            if prefetch:
+                fr.prefetch(file_size, max_concurrent_prefetch_requests)
+            return self._transfer_with_callback(
+                reader=fr, writer=fl, file_size=file_size, callback=callback
+            )
+
+    def get(
+        self,
+        remotepath,
+        localpath,
+        callback=None,
+        prefetch=True,
+        max_concurrent_prefetch_requests=None,
+    ):
+        """
+        Copy a remote file (``remotepath``) from the SFTP server to the local
+        host as ``localpath``.  Any exception raised by operations will be
+        passed through.  This method is primarily provided as a convenience.
+
+        :param str remotepath: the remote file to copy
+        :param str localpath: the destination path on the local host
+        :param callable callback:
+            optional callback function (form: ``func(int, int)``) that accepts
+            the bytes transferred so far and the total bytes to be transferred
+        :param bool prefetch:
+            controls whether prefetching is performed (default: True)
+        :param int max_concurrent_prefetch_requests:
+            The maximum number of concurrent read requests to prefetch.
+            When this is ``None`` (the default), do not limit the number of
+            concurrent prefetch requests. Note: OpenSSH's sftp internally
+            imposes a limit of 64 concurrent requests, while Paramiko imposes
+            no limit by default; consider setting a limit if a file can be
+            successfully received with sftp but hangs with Paramiko.
+
+        .. versionadded:: 1.4
+        .. versionchanged:: 1.7.4
+            Added the ``callback`` param
+        .. versionchanged:: 2.8
+            Added the ``prefetch`` keyword argument.
+        .. versionchanged:: 3.3
+            Added ``max_concurrent_prefetch_requests``.
+        """
+        with open(localpath, "wb") as fl:
+            size = self.getfo(
+                remotepath,
+                fl,
+                callback,
+                prefetch,
+                max_concurrent_prefetch_requests,
+            )
+        s = os.stat(localpath)
+        if s.st_size != size:
+            raise IOError(
+                "size mismatch in get!  {} != {}".format(s.st_size, size)
+            )
+
+    # ...internals...
+
+    def _request(self, t, *args):
+        num = self._async_request(type(None), t, *args)
+        return self._read_response(num)
+
+    def _async_request(self, fileobj, t, *args):
+        # this method may be called from other threads (prefetch)
+        self._lock.acquire()
+        try:
+            msg = Message()
+            msg.add_int(self.request_number)
+            for item in args:
+                if isinstance(item, int64):
+                    msg.add_int64(item)
+                elif isinstance(item, int):
+                    msg.add_int(item)
+                elif isinstance(item, SFTPAttributes):
+                    item._pack(msg)
+                else:
+                    # For all other types, rely on as_string() to either coerce
+                    # to bytes before writing or raise a suitable exception.
+                    msg.add_string(item)
+            num = self.request_number
+            self._expecting[num] = fileobj
+            self.request_number += 1
+        finally:
+            self._lock.release()
+        self._send_packet(t, msg)
+        return num
+
+    def _read_response(self, waitfor=None):
+        while True:
+            try:
+                t, data = self._read_packet()
+            except EOFError as e:
+                raise SSHException("Server connection dropped: {}".format(e))
+            msg = Message(data)
+            num = msg.get_int()
+            self._lock.acquire()
+            try:
+                if num not in self._expecting:
+                    # might be response for a file that was closed before
+                    # responses came back
+                    self._log(DEBUG, "Unexpected response #{}".format(num))
+                    if waitfor is None:
+                        # just doing a single check
+                        break
+                    continue
+                fileobj = self._expecting[num]
+                del self._expecting[num]
+            finally:
+                self._lock.release()
+            if num == waitfor:
+                # synchronous
+                if t == CMD_STATUS:
+                    self._convert_status(msg)
+                return t, msg
+
+            # can not rewrite this to deal with E721, either as a None check
+            # nor as not an instance of None or NoneType
+            if fileobj is not type(None):  # noqa
+                fileobj._async_response(t, msg, num)
+            if waitfor is None:
+                # just doing a single check
+                break
+        return None, None
+
+    def _finish_responses(self, fileobj):
+        while fileobj in self._expecting.values():
+            self._read_response()
+            fileobj._check_exception()
+
+    def _convert_status(self, msg):
+        """
+        Raises EOFError or IOError on error status; otherwise does nothing.
+        """
+        code = msg.get_int()
+        text = msg.get_text()
+        if code == SFTP_OK:
+            return
+        elif code == SFTP_EOF:
+            raise EOFError(text)
+        elif code == SFTP_NO_SUCH_FILE:
+            # clever idea from john a. meinel: map the error codes to errno
+            raise IOError(errno.ENOENT, text)
+        elif code == SFTP_PERMISSION_DENIED:
+            raise IOError(errno.EACCES, text)
+        else:
+            raise IOError(text)
+
+    def _adjust_cwd(self, path):
+        """
+        Return an adjusted path if we're emulating a "current working
+        directory" for the server.
+        """
+        path = b(path)
+        if self._cwd is None:
+            return path
+        if len(path) and path[0:1] == b_slash:
+            # absolute path
+            return path
+        if self._cwd == b_slash:
+            return self._cwd + path
+        return self._cwd + b_slash + path
+
+
+class SFTP(SFTPClient):
+    """
+    An alias for `.SFTPClient` for backwards compatibility.
+    """
+
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_file.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_file.py
new file mode 100644
index 0000000000000000000000000000000000000000..c74695e0ccc26bbe60f2b64dd3d45ba00b179671
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_file.py
@@ -0,0 +1,594 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+SFTP file object
+"""
+
+
+from binascii import hexlify
+from collections import deque
+import socket
+import threading
+import time
+from paramiko.common import DEBUG, io_sleep
+
+from paramiko.file import BufferedFile
+from paramiko.util import u
+from paramiko.sftp import (
+    CMD_CLOSE,
+    CMD_READ,
+    CMD_DATA,
+    SFTPError,
+    CMD_WRITE,
+    CMD_STATUS,
+    CMD_FSTAT,
+    CMD_ATTRS,
+    CMD_FSETSTAT,
+    CMD_EXTENDED,
+    int64,
+)
+from paramiko.sftp_attr import SFTPAttributes
+
+
+class SFTPFile(BufferedFile):
+    """
+    Proxy object for a file on the remote server, in client mode SFTP.
+
+    Instances of this class may be used as context managers in the same way
+    that built-in Python file objects are.
+    """
+
+    # Some sftp servers will choke if you send read/write requests larger than
+    # this size.
+    MAX_REQUEST_SIZE = 32768
+
+    def __init__(self, sftp, handle, mode="r", bufsize=-1):
+        BufferedFile.__init__(self)
+        self.sftp = sftp
+        self.handle = handle
+        BufferedFile._set_mode(self, mode, bufsize)
+        self.pipelined = False
+        self._prefetching = False
+        self._prefetch_done = False
+        self._prefetch_data = {}
+        self._prefetch_extents = {}
+        self._prefetch_lock = threading.Lock()
+        self._saved_exception = None
+        self._reqs = deque()
+
+    def __del__(self):
+        self._close(async_=True)
+
+    def close(self):
+        """
+        Close the file.
+        """
+        self._close(async_=False)
+
+    def _close(self, async_=False):
+        # We allow double-close without signaling an error, because real
+        # Python file objects do.  However, we must protect against actually
+        # sending multiple CMD_CLOSE packets, because after we close our
+        # handle, the same handle may be re-allocated by the server, and we
+        # may end up mysteriously closing some random other file.  (This is
+        # especially important because we unconditionally call close() from
+        # __del__.)
+        if self._closed:
+            return
+        self.sftp._log(DEBUG, "close({})".format(u(hexlify(self.handle))))
+        if self.pipelined:
+            self.sftp._finish_responses(self)
+        BufferedFile.close(self)
+        try:
+            if async_:
+                # GC'd file handle could be called from an arbitrary thread
+                # -- don't wait for a response
+                self.sftp._async_request(type(None), CMD_CLOSE, self.handle)
+            else:
+                self.sftp._request(CMD_CLOSE, self.handle)
+        except EOFError:
+            # may have outlived the Transport connection
+            pass
+        except (IOError, socket.error):
+            # may have outlived the Transport connection
+            pass
+
+    def _data_in_prefetch_requests(self, offset, size):
+        k = [
+            x for x in list(self._prefetch_extents.values()) if x[0] <= offset
+        ]
+        if len(k) == 0:
+            return False
+        k.sort(key=lambda x: x[0])
+        buf_offset, buf_size = k[-1]
+        if buf_offset + buf_size <= offset:
+            # prefetch request ends before this one begins
+            return False
+        if buf_offset + buf_size >= offset + size:
+            # inclusive
+            return True
+        # well, we have part of the request.  see if another chunk has
+        # the rest.
+        return self._data_in_prefetch_requests(
+            buf_offset + buf_size, offset + size - buf_offset - buf_size
+        )
+
+    def _data_in_prefetch_buffers(self, offset):
+        """
+        if a block of data is present in the prefetch buffers, at the given
+        offset, return the offset of the relevant prefetch buffer.  otherwise,
+        return None.  this guarantees nothing about the number of bytes
+        collected in the prefetch buffer so far.
+        """
+        k = [i for i in self._prefetch_data.keys() if i <= offset]
+        if len(k) == 0:
+            return None
+        index = max(k)
+        buf_offset = offset - index
+        if buf_offset >= len(self._prefetch_data[index]):
+            # it's not here
+            return None
+        return index
+
+    def _read_prefetch(self, size):
+        """
+        read data out of the prefetch buffer, if possible.  if the data isn't
+        in the buffer, return None.  otherwise, behaves like a normal read.
+        """
+        # while not closed, and haven't fetched past the current position,
+        # and haven't reached EOF...
+        while True:
+            offset = self._data_in_prefetch_buffers(self._realpos)
+            if offset is not None:
+                break
+            if self._prefetch_done or self._closed:
+                break
+            self.sftp._read_response()
+            self._check_exception()
+        if offset is None:
+            self._prefetching = False
+            return None
+        prefetch = self._prefetch_data[offset]
+        del self._prefetch_data[offset]
+
+        buf_offset = self._realpos - offset
+        if buf_offset > 0:
+            self._prefetch_data[offset] = prefetch[:buf_offset]
+            prefetch = prefetch[buf_offset:]
+        if size < len(prefetch):
+            self._prefetch_data[self._realpos + size] = prefetch[size:]
+            prefetch = prefetch[:size]
+        return prefetch
+
+    def _read(self, size):
+        size = min(size, self.MAX_REQUEST_SIZE)
+        if self._prefetching:
+            data = self._read_prefetch(size)
+            if data is not None:
+                return data
+        t, msg = self.sftp._request(
+            CMD_READ, self.handle, int64(self._realpos), int(size)
+        )
+        if t != CMD_DATA:
+            raise SFTPError("Expected data")
+        return msg.get_string()
+
+    def _write(self, data):
+        # may write less than requested if it would exceed max packet size
+        chunk = min(len(data), self.MAX_REQUEST_SIZE)
+        sftp_async_request = self.sftp._async_request(
+            type(None),
+            CMD_WRITE,
+            self.handle,
+            int64(self._realpos),
+            data[:chunk],
+        )
+        self._reqs.append(sftp_async_request)
+        if not self.pipelined or (
+            len(self._reqs) > 100 and self.sftp.sock.recv_ready()
+        ):
+            while len(self._reqs):
+                req = self._reqs.popleft()
+                t, msg = self.sftp._read_response(req)
+                if t != CMD_STATUS:
+                    raise SFTPError("Expected status")
+                # convert_status already called
+        return chunk
+
+    def settimeout(self, timeout):
+        """
+        Set a timeout on read/write operations on the underlying socket or
+        ssh `.Channel`.
+
+        :param float timeout:
+            seconds to wait for a pending read/write operation before raising
+            ``socket.timeout``, or ``None`` for no timeout
+
+        .. seealso:: `.Channel.settimeout`
+        """
+        self.sftp.sock.settimeout(timeout)
+
+    def gettimeout(self):
+        """
+        Returns the timeout in seconds (as a `float`) associated with the
+        socket or ssh `.Channel` used for this file.
+
+        .. seealso:: `.Channel.gettimeout`
+        """
+        return self.sftp.sock.gettimeout()
+
+    def setblocking(self, blocking):
+        """
+        Set blocking or non-blocking mode on the underiying socket or ssh
+        `.Channel`.
+
+        :param int blocking:
+            0 to set non-blocking mode; non-0 to set blocking mode.
+
+        .. seealso:: `.Channel.setblocking`
+        """
+        self.sftp.sock.setblocking(blocking)
+
+    def seekable(self):
+        """
+        Check if the file supports random access.
+
+        :return:
+            `True` if the file supports random access. If `False`,
+            :meth:`seek` will raise an exception
+        """
+        return True
+
+    def seek(self, offset, whence=0):
+        """
+        Set the file's current position.
+
+        See `file.seek` for details.
+        """
+        self.flush()
+        if whence == self.SEEK_SET:
+            self._realpos = self._pos = offset
+        elif whence == self.SEEK_CUR:
+            self._pos += offset
+            self._realpos = self._pos
+        else:
+            self._realpos = self._pos = self._get_size() + offset
+        self._rbuffer = bytes()
+
+    def stat(self):
+        """
+        Retrieve information about this file from the remote system.  This is
+        exactly like `.SFTPClient.stat`, except that it operates on an
+        already-open file.
+
+        :returns:
+            an `.SFTPAttributes` object containing attributes about this file.
+        """
+        t, msg = self.sftp._request(CMD_FSTAT, self.handle)
+        if t != CMD_ATTRS:
+            raise SFTPError("Expected attributes")
+        return SFTPAttributes._from_msg(msg)
+
+    def chmod(self, mode):
+        """
+        Change the mode (permissions) of this file.  The permissions are
+        unix-style and identical to those used by Python's `os.chmod`
+        function.
+
+        :param int mode: new permissions
+        """
+        self.sftp._log(
+            DEBUG, "chmod({}, {!r})".format(hexlify(self.handle), mode)
+        )
+        attr = SFTPAttributes()
+        attr.st_mode = mode
+        self.sftp._request(CMD_FSETSTAT, self.handle, attr)
+
+    def chown(self, uid, gid):
+        """
+        Change the owner (``uid``) and group (``gid``) of this file.  As with
+        Python's `os.chown` function, you must pass both arguments, so if you
+        only want to change one, use `stat` first to retrieve the current
+        owner and group.
+
+        :param int uid: new owner's uid
+        :param int gid: new group id
+        """
+        self.sftp._log(
+            DEBUG,
+            "chown({}, {!r}, {!r})".format(hexlify(self.handle), uid, gid),
+        )
+        attr = SFTPAttributes()
+        attr.st_uid, attr.st_gid = uid, gid
+        self.sftp._request(CMD_FSETSTAT, self.handle, attr)
+
+    def utime(self, times):
+        """
+        Set the access and modified times of this file.  If
+        ``times`` is ``None``, then the file's access and modified times are
+        set to the current time.  Otherwise, ``times`` must be a 2-tuple of
+        numbers, of the form ``(atime, mtime)``, which is used to set the
+        access and modified times, respectively.  This bizarre API is mimicked
+        from Python for the sake of consistency -- I apologize.
+
+        :param tuple times:
+            ``None`` or a tuple of (access time, modified time) in standard
+            internet epoch time (seconds since 01 January 1970 GMT)
+        """
+        if times is None:
+            times = (time.time(), time.time())
+        self.sftp._log(
+            DEBUG, "utime({}, {!r})".format(hexlify(self.handle), times)
+        )
+        attr = SFTPAttributes()
+        attr.st_atime, attr.st_mtime = times
+        self.sftp._request(CMD_FSETSTAT, self.handle, attr)
+
+    def truncate(self, size):
+        """
+        Change the size of this file.  This usually extends
+        or shrinks the size of the file, just like the ``truncate()`` method on
+        Python file objects.
+
+        :param size: the new size of the file
+        """
+        self.sftp._log(
+            DEBUG, "truncate({}, {!r})".format(hexlify(self.handle), size)
+        )
+        attr = SFTPAttributes()
+        attr.st_size = size
+        self.sftp._request(CMD_FSETSTAT, self.handle, attr)
+
+    def check(self, hash_algorithm, offset=0, length=0, block_size=0):
+        """
+        Ask the server for a hash of a section of this file.  This can be used
+        to verify a successful upload or download, or for various rsync-like
+        operations.
+
+        The file is hashed from ``offset``, for ``length`` bytes.
+        If ``length`` is 0, the remainder of the file is hashed.  Thus, if both
+        ``offset`` and ``length`` are zero, the entire file is hashed.
+
+        Normally, ``block_size`` will be 0 (the default), and this method will
+        return a byte string representing the requested hash (for example, a
+        string of length 16 for MD5, or 20 for SHA-1).  If a non-zero
+        ``block_size`` is given, each chunk of the file (from ``offset`` to
+        ``offset + length``) of ``block_size`` bytes is computed as a separate
+        hash.  The hash results are all concatenated and returned as a single
+        string.
+
+        For example, ``check('sha1', 0, 1024, 512)`` will return a string of
+        length 40.  The first 20 bytes will be the SHA-1 of the first 512 bytes
+        of the file, and the last 20 bytes will be the SHA-1 of the next 512
+        bytes.
+
+        :param str hash_algorithm:
+            the name of the hash algorithm to use (normally ``"sha1"`` or
+            ``"md5"``)
+        :param offset:
+            offset into the file to begin hashing (0 means to start from the
+            beginning)
+        :param length:
+            number of bytes to hash (0 means continue to the end of the file)
+        :param int block_size:
+            number of bytes to hash per result (must not be less than 256; 0
+            means to compute only one hash of the entire segment)
+        :return:
+            `str` of bytes representing the hash of each block, concatenated
+            together
+
+        :raises:
+            ``IOError`` -- if the server doesn't support the "check-file"
+            extension, or possibly doesn't support the hash algorithm requested
+
+        .. note:: Many (most?) servers don't support this extension yet.
+
+        .. versionadded:: 1.4
+        """
+        t, msg = self.sftp._request(
+            CMD_EXTENDED,
+            "check-file",
+            self.handle,
+            hash_algorithm,
+            int64(offset),
+            int64(length),
+            block_size,
+        )
+        msg.get_text()  # ext
+        msg.get_text()  # alg
+        data = msg.get_remainder()
+        return data
+
+    def set_pipelined(self, pipelined=True):
+        """
+        Turn on/off the pipelining of write operations to this file.  When
+        pipelining is on, paramiko won't wait for the server response after
+        each write operation.  Instead, they're collected as they come in. At
+        the first non-write operation (including `.close`), all remaining
+        server responses are collected.  This means that if there was an error
+        with one of your later writes, an exception might be thrown from within
+        `.close` instead of `.write`.
+
+        By default, files are not pipelined.
+
+        :param bool pipelined:
+            ``True`` if pipelining should be turned on for this file; ``False``
+            otherwise
+
+        .. versionadded:: 1.5
+        """
+        self.pipelined = pipelined
+
+    def prefetch(self, file_size=None, max_concurrent_requests=None):
+        """
+        Pre-fetch the remaining contents of this file in anticipation of future
+        `.read` calls.  If reading the entire file, pre-fetching can
+        dramatically improve the download speed by avoiding roundtrip latency.
+        The file's contents are incrementally buffered in a background thread.
+
+        The prefetched data is stored in a buffer until read via the `.read`
+        method.  Once data has been read, it's removed from the buffer.  The
+        data may be read in a random order (using `.seek`); chunks of the
+        buffer that haven't been read will continue to be buffered.
+
+        :param int file_size:
+            When this is ``None`` (the default), this method calls `stat` to
+            determine the remote file size. In some situations, doing so can
+            cause exceptions or hangs (see `#562
+            <https://github.com/paramiko/paramiko/pull/562>`_); as a
+            workaround, one may call `stat` explicitly and pass its value in
+            via this parameter.
+        :param int max_concurrent_requests:
+            The maximum number of concurrent read requests to prefetch. See
+            `.SFTPClient.get` (its ``max_concurrent_prefetch_requests`` param)
+            for details.
+
+        .. versionadded:: 1.5.1
+        .. versionchanged:: 1.16.0
+            The ``file_size`` parameter was added (with no default value).
+        .. versionchanged:: 1.16.1
+            The ``file_size`` parameter was made optional for backwards
+            compatibility.
+        .. versionchanged:: 3.3
+            Added ``max_concurrent_requests``.
+        """
+        if file_size is None:
+            file_size = self.stat().st_size
+
+        # queue up async reads for the rest of the file
+        chunks = []
+        n = self._realpos
+        while n < file_size:
+            chunk = min(self.MAX_REQUEST_SIZE, file_size - n)
+            chunks.append((n, chunk))
+            n += chunk
+        if len(chunks) > 0:
+            self._start_prefetch(chunks, max_concurrent_requests)
+
+    def readv(self, chunks, max_concurrent_prefetch_requests=None):
+        """
+        Read a set of blocks from the file by (offset, length).  This is more
+        efficient than doing a series of `.seek` and `.read` calls, since the
+        prefetch machinery is used to retrieve all the requested blocks at
+        once.
+
+        :param chunks:
+            a list of ``(offset, length)`` tuples indicating which sections of
+            the file to read
+        :param int max_concurrent_prefetch_requests:
+            The maximum number of concurrent read requests to prefetch. See
+            `.SFTPClient.get` (its ``max_concurrent_prefetch_requests`` param)
+            for details.
+        :return: a list of blocks read, in the same order as in ``chunks``
+
+        .. versionadded:: 1.5.4
+        .. versionchanged:: 3.3
+            Added ``max_concurrent_prefetch_requests``.
+        """
+        self.sftp._log(
+            DEBUG, "readv({}, {!r})".format(hexlify(self.handle), chunks)
+        )
+
+        read_chunks = []
+        for offset, size in chunks:
+            # don't fetch data that's already in the prefetch buffer
+            if self._data_in_prefetch_buffers(
+                offset
+            ) or self._data_in_prefetch_requests(offset, size):
+                continue
+
+            # break up anything larger than the max read size
+            while size > 0:
+                chunk_size = min(size, self.MAX_REQUEST_SIZE)
+                read_chunks.append((offset, chunk_size))
+                offset += chunk_size
+                size -= chunk_size
+
+        self._start_prefetch(read_chunks, max_concurrent_prefetch_requests)
+        # now we can just devolve to a bunch of read()s :)
+        for x in chunks:
+            self.seek(x[0])
+            yield self.read(x[1])
+
+    # ...internals...
+
+    def _get_size(self):
+        try:
+            return self.stat().st_size
+        except:
+            return 0
+
+    def _start_prefetch(self, chunks, max_concurrent_requests=None):
+        self._prefetching = True
+        self._prefetch_done = False
+
+        t = threading.Thread(
+            target=self._prefetch_thread,
+            args=(chunks, max_concurrent_requests),
+        )
+        t.daemon = True
+        t.start()
+
+    def _prefetch_thread(self, chunks, max_concurrent_requests):
+        # do these read requests in a temporary thread because there may be
+        # a lot of them, so it may block.
+        for offset, length in chunks:
+            # Limit the number of concurrent requests in a busy-loop
+            if max_concurrent_requests is not None:
+                while True:
+                    with self._prefetch_lock:
+                        pf_len = len(self._prefetch_extents)
+                        if pf_len < max_concurrent_requests:
+                            break
+                    time.sleep(io_sleep)
+
+            num = self.sftp._async_request(
+                self, CMD_READ, self.handle, int64(offset), int(length)
+            )
+            with self._prefetch_lock:
+                self._prefetch_extents[num] = (offset, length)
+
+    def _async_response(self, t, msg, num):
+        if t == CMD_STATUS:
+            # save exception and re-raise it on next file operation
+            try:
+                self.sftp._convert_status(msg)
+            except Exception as e:
+                self._saved_exception = e
+            return
+        if t != CMD_DATA:
+            raise SFTPError("Expected data")
+        data = msg.get_string()
+        while True:
+            with self._prefetch_lock:
+                # spin if in race with _prefetch_thread
+                if num in self._prefetch_extents:
+                    offset, length = self._prefetch_extents[num]
+                    self._prefetch_data[offset] = data
+                    del self._prefetch_extents[num]
+                    if len(self._prefetch_extents) == 0:
+                        self._prefetch_done = True
+                    break
+
+    def _check_exception(self):
+        """if there's a saved exception, raise & clear it"""
+        if self._saved_exception is not None:
+            x = self._saved_exception
+            self._saved_exception = None
+            raise x
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_handle.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_handle.py
new file mode 100644
index 0000000000000000000000000000000000000000..b20465260684008413600f10509b00fa80739c04
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_handle.py
@@ -0,0 +1,196 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Abstraction of an SFTP file handle (for server mode).
+"""
+
+import os
+from paramiko.sftp import SFTP_OP_UNSUPPORTED, SFTP_OK
+from paramiko.util import ClosingContextManager
+
+
+class SFTPHandle(ClosingContextManager):
+    """
+    Abstract object representing a handle to an open file (or folder) in an
+    SFTP server implementation.  Each handle has a string representation used
+    by the client to refer to the underlying file.
+
+    Server implementations can (and should) subclass SFTPHandle to implement
+    features of a file handle, like `stat` or `chattr`.
+
+    Instances of this class may be used as context managers.
+    """
+
+    def __init__(self, flags=0):
+        """
+        Create a new file handle representing a local file being served over
+        SFTP.  If ``flags`` is passed in, it's used to determine if the file
+        is open in append mode.
+
+        :param int flags: optional flags as passed to
+            `.SFTPServerInterface.open`
+        """
+        self.__flags = flags
+        self.__name = None
+        # only for handles to folders:
+        self.__files = {}
+        self.__tell = None
+
+    def close(self):
+        """
+        When a client closes a file, this method is called on the handle.
+        Normally you would use this method to close the underlying OS level
+        file object(s).
+
+        The default implementation checks for attributes on ``self`` named
+        ``readfile`` and/or ``writefile``, and if either or both are present,
+        their ``close()`` methods are called.  This means that if you are
+        using the default implementations of `read` and `write`, this
+        method's default implementation should be fine also.
+        """
+        readfile = getattr(self, "readfile", None)
+        if readfile is not None:
+            readfile.close()
+        writefile = getattr(self, "writefile", None)
+        if writefile is not None:
+            writefile.close()
+
+    def read(self, offset, length):
+        """
+        Read up to ``length`` bytes from this file, starting at position
+        ``offset``.  The offset may be a Python long, since SFTP allows it
+        to be 64 bits.
+
+        If the end of the file has been reached, this method may return an
+        empty string to signify EOF, or it may also return ``SFTP_EOF``.
+
+        The default implementation checks for an attribute on ``self`` named
+        ``readfile``, and if present, performs the read operation on the Python
+        file-like object found there.  (This is meant as a time saver for the
+        common case where you are wrapping a Python file object.)
+
+        :param offset: position in the file to start reading from.
+        :param int length: number of bytes to attempt to read.
+        :return: the `bytes` read, or an error code `int`.
+        """
+        readfile = getattr(self, "readfile", None)
+        if readfile is None:
+            return SFTP_OP_UNSUPPORTED
+        try:
+            if self.__tell is None:
+                self.__tell = readfile.tell()
+            if offset != self.__tell:
+                readfile.seek(offset)
+                self.__tell = offset
+            data = readfile.read(length)
+        except IOError as e:
+            self.__tell = None
+            return SFTPServer.convert_errno(e.errno)
+        self.__tell += len(data)
+        return data
+
+    def write(self, offset, data):
+        """
+        Write ``data`` into this file at position ``offset``.  Extending the
+        file past its original end is expected.  Unlike Python's normal
+        ``write()`` methods, this method cannot do a partial write: it must
+        write all of ``data`` or else return an error.
+
+        The default implementation checks for an attribute on ``self`` named
+        ``writefile``, and if present, performs the write operation on the
+        Python file-like object found there.  The attribute is named
+        differently from ``readfile`` to make it easy to implement read-only
+        (or write-only) files, but if both attributes are present, they should
+        refer to the same file.
+
+        :param offset: position in the file to start reading from.
+        :param bytes data: data to write into the file.
+        :return: an SFTP error code like ``SFTP_OK``.
+        """
+        writefile = getattr(self, "writefile", None)
+        if writefile is None:
+            return SFTP_OP_UNSUPPORTED
+        try:
+            # in append mode, don't care about seeking
+            if (self.__flags & os.O_APPEND) == 0:
+                if self.__tell is None:
+                    self.__tell = writefile.tell()
+                if offset != self.__tell:
+                    writefile.seek(offset)
+                    self.__tell = offset
+            writefile.write(data)
+            writefile.flush()
+        except IOError as e:
+            self.__tell = None
+            return SFTPServer.convert_errno(e.errno)
+        if self.__tell is not None:
+            self.__tell += len(data)
+        return SFTP_OK
+
+    def stat(self):
+        """
+        Return an `.SFTPAttributes` object referring to this open file, or an
+        error code.  This is equivalent to `.SFTPServerInterface.stat`, except
+        it's called on an open file instead of a path.
+
+        :return:
+            an attributes object for the given file, or an SFTP error code
+            (like ``SFTP_PERMISSION_DENIED``).
+        :rtype: `.SFTPAttributes` or error code
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def chattr(self, attr):
+        """
+        Change the attributes of this file.  The ``attr`` object will contain
+        only those fields provided by the client in its request, so you should
+        check for the presence of fields before using them.
+
+        :param .SFTPAttributes attr: the attributes to change on this file.
+        :return: an `int` error code like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    # ...internals...
+
+    def _set_files(self, files):
+        """
+        Used by the SFTP server code to cache a directory listing.  (In
+        the SFTP protocol, listing a directory is a multi-stage process
+        requiring a temporary handle.)
+        """
+        self.__files = files
+
+    def _get_next_files(self):
+        """
+        Used by the SFTP server code to retrieve a cached directory
+        listing.
+        """
+        fnlist = self.__files[:16]
+        self.__files = self.__files[16:]
+        return fnlist
+
+    def _get_name(self):
+        return self.__name
+
+    def _set_name(self, name):
+        self.__name = name
+
+
+from paramiko.sftp_server import SFTPServer
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_server.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_server.py
new file mode 100644
index 0000000000000000000000000000000000000000..cd3910dcb9b1a99cb719edc71f4381f7cbd70a1f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_server.py
@@ -0,0 +1,537 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Server-mode SFTP support.
+"""
+
+import os
+import errno
+import sys
+from hashlib import md5, sha1
+
+from paramiko import util
+from paramiko.sftp import (
+    BaseSFTP,
+    Message,
+    SFTP_FAILURE,
+    SFTP_PERMISSION_DENIED,
+    SFTP_NO_SUCH_FILE,
+    int64,
+)
+from paramiko.sftp_si import SFTPServerInterface
+from paramiko.sftp_attr import SFTPAttributes
+from paramiko.common import DEBUG
+from paramiko.server import SubsystemHandler
+from paramiko.util import b
+
+
+# known hash algorithms for the "check-file" extension
+from paramiko.sftp import (
+    CMD_HANDLE,
+    SFTP_DESC,
+    CMD_STATUS,
+    SFTP_EOF,
+    CMD_NAME,
+    SFTP_BAD_MESSAGE,
+    CMD_EXTENDED_REPLY,
+    SFTP_FLAG_READ,
+    SFTP_FLAG_WRITE,
+    SFTP_FLAG_APPEND,
+    SFTP_FLAG_CREATE,
+    SFTP_FLAG_TRUNC,
+    SFTP_FLAG_EXCL,
+    CMD_NAMES,
+    CMD_OPEN,
+    CMD_CLOSE,
+    SFTP_OK,
+    CMD_READ,
+    CMD_DATA,
+    CMD_WRITE,
+    CMD_REMOVE,
+    CMD_RENAME,
+    CMD_MKDIR,
+    CMD_RMDIR,
+    CMD_OPENDIR,
+    CMD_READDIR,
+    CMD_STAT,
+    CMD_ATTRS,
+    CMD_LSTAT,
+    CMD_FSTAT,
+    CMD_SETSTAT,
+    CMD_FSETSTAT,
+    CMD_READLINK,
+    CMD_SYMLINK,
+    CMD_REALPATH,
+    CMD_EXTENDED,
+    SFTP_OP_UNSUPPORTED,
+)
+
+_hash_class = {"sha1": sha1, "md5": md5}
+
+
+class SFTPServer(BaseSFTP, SubsystemHandler):
+    """
+    Server-side SFTP subsystem support.  Since this is a `.SubsystemHandler`,
+    it can be (and is meant to be) set as the handler for ``"sftp"`` requests.
+    Use `.Transport.set_subsystem_handler` to activate this class.
+    """
+
+    def __init__(
+        self,
+        channel,
+        name,
+        server,
+        sftp_si=SFTPServerInterface,
+        *args,
+        **kwargs
+    ):
+        """
+        The constructor for SFTPServer is meant to be called from within the
+        `.Transport` as a subsystem handler.  ``server`` and any additional
+        parameters or keyword parameters are passed from the original call to
+        `.Transport.set_subsystem_handler`.
+
+        :param .Channel channel: channel passed from the `.Transport`.
+        :param str name: name of the requested subsystem.
+        :param .ServerInterface server:
+            the server object associated with this channel and subsystem
+        :param sftp_si:
+            a subclass of `.SFTPServerInterface` to use for handling individual
+            requests.
+        """
+        BaseSFTP.__init__(self)
+        SubsystemHandler.__init__(self, channel, name, server)
+        transport = channel.get_transport()
+        self.logger = util.get_logger(transport.get_log_channel() + ".sftp")
+        self.ultra_debug = transport.get_hexdump()
+        self.next_handle = 1
+        # map of handle-string to SFTPHandle for files & folders:
+        self.file_table = {}
+        self.folder_table = {}
+        self.server = sftp_si(server, *args, **kwargs)
+
+    def _log(self, level, msg):
+        if issubclass(type(msg), list):
+            for m in msg:
+                super()._log(level, "[chan " + self.sock.get_name() + "] " + m)
+        else:
+            super()._log(level, "[chan " + self.sock.get_name() + "] " + msg)
+
+    def start_subsystem(self, name, transport, channel):
+        self.sock = channel
+        self._log(DEBUG, "Started sftp server on channel {!r}".format(channel))
+        self._send_server_version()
+        self.server.session_started()
+        while True:
+            try:
+                t, data = self._read_packet()
+            except EOFError:
+                self._log(DEBUG, "EOF -- end of session")
+                return
+            except Exception as e:
+                self._log(DEBUG, "Exception on channel: " + str(e))
+                self._log(DEBUG, util.tb_strings())
+                return
+            msg = Message(data)
+            request_number = msg.get_int()
+            try:
+                self._process(t, request_number, msg)
+            except Exception as e:
+                self._log(DEBUG, "Exception in server processing: " + str(e))
+                self._log(DEBUG, util.tb_strings())
+                # send some kind of failure message, at least
+                try:
+                    self._send_status(request_number, SFTP_FAILURE)
+                except:
+                    pass
+
+    def finish_subsystem(self):
+        self.server.session_ended()
+        super().finish_subsystem()
+        # close any file handles that were left open
+        # (so we can return them to the OS quickly)
+        for f in self.file_table.values():
+            f.close()
+        for f in self.folder_table.values():
+            f.close()
+        self.file_table = {}
+        self.folder_table = {}
+
+    @staticmethod
+    def convert_errno(e):
+        """
+        Convert an errno value (as from an ``OSError`` or ``IOError``) into a
+        standard SFTP result code.  This is a convenience function for trapping
+        exceptions in server code and returning an appropriate result.
+
+        :param int e: an errno code, as from ``OSError.errno``.
+        :return: an `int` SFTP error code like ``SFTP_NO_SUCH_FILE``.
+        """
+        if e == errno.EACCES:
+            # permission denied
+            return SFTP_PERMISSION_DENIED
+        elif (e == errno.ENOENT) or (e == errno.ENOTDIR):
+            # no such file
+            return SFTP_NO_SUCH_FILE
+        else:
+            return SFTP_FAILURE
+
+    @staticmethod
+    def set_file_attr(filename, attr):
+        """
+        Change a file's attributes on the local filesystem.  The contents of
+        ``attr`` are used to change the permissions, owner, group ownership,
+        and/or modification & access time of the file, depending on which
+        attributes are present in ``attr``.
+
+        This is meant to be a handy helper function for translating SFTP file
+        requests into local file operations.
+
+        :param str filename:
+            name of the file to alter (should usually be an absolute path).
+        :param .SFTPAttributes attr: attributes to change.
+        """
+        if sys.platform != "win32":
+            # mode operations are meaningless on win32
+            if attr._flags & attr.FLAG_PERMISSIONS:
+                os.chmod(filename, attr.st_mode)
+            if attr._flags & attr.FLAG_UIDGID:
+                os.chown(filename, attr.st_uid, attr.st_gid)
+        if attr._flags & attr.FLAG_AMTIME:
+            os.utime(filename, (attr.st_atime, attr.st_mtime))
+        if attr._flags & attr.FLAG_SIZE:
+            with open(filename, "w+") as f:
+                f.truncate(attr.st_size)
+
+    # ...internals...
+
+    def _response(self, request_number, t, *args):
+        msg = Message()
+        msg.add_int(request_number)
+        for item in args:
+            # NOTE: this is a very silly tiny class used for SFTPFile mostly
+            if isinstance(item, int64):
+                msg.add_int64(item)
+            elif isinstance(item, int):
+                msg.add_int(item)
+            elif isinstance(item, (str, bytes)):
+                msg.add_string(item)
+            elif type(item) is SFTPAttributes:
+                item._pack(msg)
+            else:
+                raise Exception(
+                    "unknown type for {!r} type {!r}".format(item, type(item))
+                )
+        self._send_packet(t, msg)
+
+    def _send_handle_response(self, request_number, handle, folder=False):
+        if not issubclass(type(handle), SFTPHandle):
+            # must be error code
+            self._send_status(request_number, handle)
+            return
+        handle._set_name(b("hx{:d}".format(self.next_handle)))
+        self.next_handle += 1
+        if folder:
+            self.folder_table[handle._get_name()] = handle
+        else:
+            self.file_table[handle._get_name()] = handle
+        self._response(request_number, CMD_HANDLE, handle._get_name())
+
+    def _send_status(self, request_number, code, desc=None):
+        if desc is None:
+            try:
+                desc = SFTP_DESC[code]
+            except IndexError:
+                desc = "Unknown"
+        # some clients expect a "language" tag at the end
+        # (but don't mind it being blank)
+        self._response(request_number, CMD_STATUS, code, desc, "")
+
+    def _open_folder(self, request_number, path):
+        resp = self.server.list_folder(path)
+        if issubclass(type(resp), list):
+            # got an actual list of filenames in the folder
+            folder = SFTPHandle()
+            folder._set_files(resp)
+            self._send_handle_response(request_number, folder, True)
+            return
+        # must be an error code
+        self._send_status(request_number, resp)
+
+    def _read_folder(self, request_number, folder):
+        flist = folder._get_next_files()
+        if len(flist) == 0:
+            self._send_status(request_number, SFTP_EOF)
+            return
+        msg = Message()
+        msg.add_int(request_number)
+        msg.add_int(len(flist))
+        for attr in flist:
+            msg.add_string(attr.filename)
+            msg.add_string(attr)
+            attr._pack(msg)
+        self._send_packet(CMD_NAME, msg)
+
+    def _check_file(self, request_number, msg):
+        # this extension actually comes from v6 protocol, but since it's an
+        # extension, i feel like we can reasonably support it backported.
+        # it's very useful for verifying uploaded files or checking for
+        # rsync-like differences between local and remote files.
+        handle = msg.get_binary()
+        alg_list = msg.get_list()
+        start = msg.get_int64()
+        length = msg.get_int64()
+        block_size = msg.get_int()
+        if handle not in self.file_table:
+            self._send_status(
+                request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+            )
+            return
+        f = self.file_table[handle]
+        for x in alg_list:
+            if x in _hash_class:
+                algname = x
+                alg = _hash_class[x]
+                break
+        else:
+            self._send_status(
+                request_number, SFTP_FAILURE, "No supported hash types found"
+            )
+            return
+        if length == 0:
+            st = f.stat()
+            if not issubclass(type(st), SFTPAttributes):
+                self._send_status(request_number, st, "Unable to stat file")
+                return
+            length = st.st_size - start
+        if block_size == 0:
+            block_size = length
+        if block_size < 256:
+            self._send_status(
+                request_number, SFTP_FAILURE, "Block size too small"
+            )
+            return
+
+        sum_out = bytes()
+        offset = start
+        while offset < start + length:
+            blocklen = min(block_size, start + length - offset)
+            # don't try to read more than about 64KB at a time
+            chunklen = min(blocklen, 65536)
+            count = 0
+            hash_obj = alg()
+            while count < blocklen:
+                data = f.read(offset, chunklen)
+                if not isinstance(data, bytes):
+                    self._send_status(
+                        request_number, data, "Unable to hash file"
+                    )
+                    return
+                hash_obj.update(data)
+                count += len(data)
+                offset += count
+            sum_out += hash_obj.digest()
+
+        msg = Message()
+        msg.add_int(request_number)
+        msg.add_string("check-file")
+        msg.add_string(algname)
+        msg.add_bytes(sum_out)
+        self._send_packet(CMD_EXTENDED_REPLY, msg)
+
+    def _convert_pflags(self, pflags):
+        """convert SFTP-style open() flags to Python's os.open() flags"""
+        if (pflags & SFTP_FLAG_READ) and (pflags & SFTP_FLAG_WRITE):
+            flags = os.O_RDWR
+        elif pflags & SFTP_FLAG_WRITE:
+            flags = os.O_WRONLY
+        else:
+            flags = os.O_RDONLY
+        if pflags & SFTP_FLAG_APPEND:
+            flags |= os.O_APPEND
+        if pflags & SFTP_FLAG_CREATE:
+            flags |= os.O_CREAT
+        if pflags & SFTP_FLAG_TRUNC:
+            flags |= os.O_TRUNC
+        if pflags & SFTP_FLAG_EXCL:
+            flags |= os.O_EXCL
+        return flags
+
+    def _process(self, t, request_number, msg):
+        self._log(DEBUG, "Request: {}".format(CMD_NAMES[t]))
+        if t == CMD_OPEN:
+            path = msg.get_text()
+            flags = self._convert_pflags(msg.get_int())
+            attr = SFTPAttributes._from_msg(msg)
+            self._send_handle_response(
+                request_number, self.server.open(path, flags, attr)
+            )
+        elif t == CMD_CLOSE:
+            handle = msg.get_binary()
+            if handle in self.folder_table:
+                del self.folder_table[handle]
+                self._send_status(request_number, SFTP_OK)
+                return
+            if handle in self.file_table:
+                self.file_table[handle].close()
+                del self.file_table[handle]
+                self._send_status(request_number, SFTP_OK)
+                return
+            self._send_status(
+                request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+            )
+        elif t == CMD_READ:
+            handle = msg.get_binary()
+            offset = msg.get_int64()
+            length = msg.get_int()
+            if handle not in self.file_table:
+                self._send_status(
+                    request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+                )
+                return
+            data = self.file_table[handle].read(offset, length)
+            if isinstance(data, (bytes, str)):
+                if len(data) == 0:
+                    self._send_status(request_number, SFTP_EOF)
+                else:
+                    self._response(request_number, CMD_DATA, data)
+            else:
+                self._send_status(request_number, data)
+        elif t == CMD_WRITE:
+            handle = msg.get_binary()
+            offset = msg.get_int64()
+            data = msg.get_binary()
+            if handle not in self.file_table:
+                self._send_status(
+                    request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+                )
+                return
+            self._send_status(
+                request_number, self.file_table[handle].write(offset, data)
+            )
+        elif t == CMD_REMOVE:
+            path = msg.get_text()
+            self._send_status(request_number, self.server.remove(path))
+        elif t == CMD_RENAME:
+            oldpath = msg.get_text()
+            newpath = msg.get_text()
+            self._send_status(
+                request_number, self.server.rename(oldpath, newpath)
+            )
+        elif t == CMD_MKDIR:
+            path = msg.get_text()
+            attr = SFTPAttributes._from_msg(msg)
+            self._send_status(request_number, self.server.mkdir(path, attr))
+        elif t == CMD_RMDIR:
+            path = msg.get_text()
+            self._send_status(request_number, self.server.rmdir(path))
+        elif t == CMD_OPENDIR:
+            path = msg.get_text()
+            self._open_folder(request_number, path)
+            return
+        elif t == CMD_READDIR:
+            handle = msg.get_binary()
+            if handle not in self.folder_table:
+                self._send_status(
+                    request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+                )
+                return
+            folder = self.folder_table[handle]
+            self._read_folder(request_number, folder)
+        elif t == CMD_STAT:
+            path = msg.get_text()
+            resp = self.server.stat(path)
+            if issubclass(type(resp), SFTPAttributes):
+                self._response(request_number, CMD_ATTRS, resp)
+            else:
+                self._send_status(request_number, resp)
+        elif t == CMD_LSTAT:
+            path = msg.get_text()
+            resp = self.server.lstat(path)
+            if issubclass(type(resp), SFTPAttributes):
+                self._response(request_number, CMD_ATTRS, resp)
+            else:
+                self._send_status(request_number, resp)
+        elif t == CMD_FSTAT:
+            handle = msg.get_binary()
+            if handle not in self.file_table:
+                self._send_status(
+                    request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+                )
+                return
+            resp = self.file_table[handle].stat()
+            if issubclass(type(resp), SFTPAttributes):
+                self._response(request_number, CMD_ATTRS, resp)
+            else:
+                self._send_status(request_number, resp)
+        elif t == CMD_SETSTAT:
+            path = msg.get_text()
+            attr = SFTPAttributes._from_msg(msg)
+            self._send_status(request_number, self.server.chattr(path, attr))
+        elif t == CMD_FSETSTAT:
+            handle = msg.get_binary()
+            attr = SFTPAttributes._from_msg(msg)
+            if handle not in self.file_table:
+                self._response(
+                    request_number, SFTP_BAD_MESSAGE, "Invalid handle"
+                )
+                return
+            self._send_status(
+                request_number, self.file_table[handle].chattr(attr)
+            )
+        elif t == CMD_READLINK:
+            path = msg.get_text()
+            resp = self.server.readlink(path)
+            if isinstance(resp, (bytes, str)):
+                self._response(
+                    request_number, CMD_NAME, 1, resp, "", SFTPAttributes()
+                )
+            else:
+                self._send_status(request_number, resp)
+        elif t == CMD_SYMLINK:
+            # the sftp 2 draft is incorrect here!
+            # path always follows target_path
+            target_path = msg.get_text()
+            path = msg.get_text()
+            self._send_status(
+                request_number, self.server.symlink(target_path, path)
+            )
+        elif t == CMD_REALPATH:
+            path = msg.get_text()
+            rpath = self.server.canonicalize(path)
+            self._response(
+                request_number, CMD_NAME, 1, rpath, "", SFTPAttributes()
+            )
+        elif t == CMD_EXTENDED:
+            tag = msg.get_text()
+            if tag == "check-file":
+                self._check_file(request_number, msg)
+            elif tag == "posix-rename@openssh.com":
+                oldpath = msg.get_text()
+                newpath = msg.get_text()
+                self._send_status(
+                    request_number, self.server.posix_rename(oldpath, newpath)
+                )
+            else:
+                self._send_status(request_number, SFTP_OP_UNSUPPORTED)
+        else:
+            self._send_status(request_number, SFTP_OP_UNSUPPORTED)
+
+
+from paramiko.sftp_handle import SFTPHandle
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_si.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_si.py
new file mode 100644
index 0000000000000000000000000000000000000000..72b5db940bfc8f2527e9a1b3d0d762167dd064e3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/sftp_si.py
@@ -0,0 +1,316 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+An interface to override for SFTP server support.
+"""
+
+import os
+import sys
+from paramiko.sftp import SFTP_OP_UNSUPPORTED
+
+
+class SFTPServerInterface:
+    """
+    This class defines an interface for controlling the behavior of paramiko
+    when using the `.SFTPServer` subsystem to provide an SFTP server.
+
+    Methods on this class are called from the SFTP session's thread, so you can
+    block as long as necessary without affecting other sessions (even other
+    SFTP sessions).  However, raising an exception will usually cause the SFTP
+    session to abruptly end, so you will usually want to catch exceptions and
+    return an appropriate error code.
+
+    All paths are in string form instead of unicode because not all SFTP
+    clients & servers obey the requirement that paths be encoded in UTF-8.
+    """
+
+    def __init__(self, server, *args, **kwargs):
+        """
+        Create a new SFTPServerInterface object.  This method does nothing by
+        default and is meant to be overridden by subclasses.
+
+        :param .ServerInterface server:
+            the server object associated with this channel and SFTP subsystem
+        """
+        super().__init__(*args, **kwargs)
+
+    def session_started(self):
+        """
+        The SFTP server session has just started.  This method is meant to be
+        overridden to perform any necessary setup before handling callbacks
+        from SFTP operations.
+        """
+        pass
+
+    def session_ended(self):
+        """
+        The SFTP server session has just ended, either cleanly or via an
+        exception.  This method is meant to be overridden to perform any
+        necessary cleanup before this `.SFTPServerInterface` object is
+        destroyed.
+        """
+        pass
+
+    def open(self, path, flags, attr):
+        """
+        Open a file on the server and create a handle for future operations
+        on that file.  On success, a new object subclassed from `.SFTPHandle`
+        should be returned.  This handle will be used for future operations
+        on the file (read, write, etc).  On failure, an error code such as
+        ``SFTP_PERMISSION_DENIED`` should be returned.
+
+        ``flags`` contains the requested mode for opening (read-only,
+        write-append, etc) as a bitset of flags from the ``os`` module:
+
+            - ``os.O_RDONLY``
+            - ``os.O_WRONLY``
+            - ``os.O_RDWR``
+            - ``os.O_APPEND``
+            - ``os.O_CREAT``
+            - ``os.O_TRUNC``
+            - ``os.O_EXCL``
+
+        (One of ``os.O_RDONLY``, ``os.O_WRONLY``, or ``os.O_RDWR`` will always
+        be set.)
+
+        The ``attr`` object contains requested attributes of the file if it
+        has to be created.  Some or all attribute fields may be missing if
+        the client didn't specify them.
+
+        .. note:: The SFTP protocol defines all files to be in "binary" mode.
+            There is no equivalent to Python's "text" mode.
+
+        :param str path:
+            the requested path (relative or absolute) of the file to be opened.
+        :param int flags:
+            flags or'd together from the ``os`` module indicating the requested
+            mode for opening the file.
+        :param .SFTPAttributes attr:
+            requested attributes of the file if it is newly created.
+        :return: a new `.SFTPHandle` or error code.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def list_folder(self, path):
+        """
+        Return a list of files within a given folder.  The ``path`` will use
+        posix notation (``"/"`` separates folder names) and may be an absolute
+        or relative path.
+
+        The list of files is expected to be a list of `.SFTPAttributes`
+        objects, which are similar in structure to the objects returned by
+        ``os.stat``.  In addition, each object should have its ``filename``
+        field filled in, since this is important to a directory listing and
+        not normally present in ``os.stat`` results.  The method
+        `.SFTPAttributes.from_stat` will usually do what you want.
+
+        In case of an error, you should return one of the ``SFTP_*`` error
+        codes, such as ``SFTP_PERMISSION_DENIED``.
+
+        :param str path: the requested path (relative or absolute) to be
+            listed.
+        :return:
+            a list of the files in the given folder, using `.SFTPAttributes`
+            objects.
+
+        .. note::
+            You should normalize the given ``path`` first (see the `os.path`
+            module) and check appropriate permissions before returning the list
+            of files.  Be careful of malicious clients attempting to use
+            relative paths to escape restricted folders, if you're doing a
+            direct translation from the SFTP server path to your local
+            filesystem.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def stat(self, path):
+        """
+        Return an `.SFTPAttributes` object for a path on the server, or an
+        error code.  If your server supports symbolic links (also known as
+        "aliases"), you should follow them.  (`lstat` is the corresponding
+        call that doesn't follow symlinks/aliases.)
+
+        :param str path:
+            the requested path (relative or absolute) to fetch file statistics
+            for.
+        :return:
+            an `.SFTPAttributes` object for the given file, or an SFTP error
+            code (like ``SFTP_PERMISSION_DENIED``).
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def lstat(self, path):
+        """
+        Return an `.SFTPAttributes` object for a path on the server, or an
+        error code.  If your server supports symbolic links (also known as
+        "aliases"), you should not follow them -- instead, you should
+        return data on the symlink or alias itself.  (`stat` is the
+        corresponding call that follows symlinks/aliases.)
+
+        :param str path:
+            the requested path (relative or absolute) to fetch file statistics
+            for.
+        :type path: str
+        :return:
+            an `.SFTPAttributes` object for the given file, or an SFTP error
+            code (like ``SFTP_PERMISSION_DENIED``).
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def remove(self, path):
+        """
+        Delete a file, if possible.
+
+        :param str path:
+            the requested path (relative or absolute) of the file to delete.
+        :return: an SFTP error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def rename(self, oldpath, newpath):
+        """
+        Rename (or move) a file.  The SFTP specification implies that this
+        method can be used to move an existing file into a different folder,
+        and since there's no other (easy) way to move files via SFTP, it's
+        probably a good idea to implement "move" in this method too, even for
+        files that cross disk partition boundaries, if at all possible.
+
+        .. note:: You should return an error if a file with the same name as
+            ``newpath`` already exists.  (The rename operation should be
+            non-desctructive.)
+
+        .. note::
+            This method implements 'standard' SFTP ``RENAME`` behavior; those
+            seeking the OpenSSH "POSIX rename" extension behavior should use
+            `posix_rename`.
+
+        :param str oldpath:
+            the requested path (relative or absolute) of the existing file.
+        :param str newpath: the requested new path of the file.
+        :return: an SFTP error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def posix_rename(self, oldpath, newpath):
+        """
+        Rename (or move) a file, following posix conventions. If newpath
+        already exists, it will be overwritten.
+
+        :param str oldpath:
+            the requested path (relative or absolute) of the existing file.
+        :param str newpath: the requested new path of the file.
+        :return: an SFTP error code `int` like ``SFTP_OK``.
+
+        :versionadded: 2.2
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def mkdir(self, path, attr):
+        """
+        Create a new directory with the given attributes.  The ``attr``
+        object may be considered a "hint" and ignored.
+
+        The ``attr`` object will contain only those fields provided by the
+        client in its request, so you should use ``hasattr`` to check for
+        the presence of fields before using them.  In some cases, the ``attr``
+        object may be completely empty.
+
+        :param str path:
+            requested path (relative or absolute) of the new folder.
+        :param .SFTPAttributes attr: requested attributes of the new folder.
+        :return: an SFTP error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def rmdir(self, path):
+        """
+        Remove a directory if it exists.  The ``path`` should refer to an
+        existing, empty folder -- otherwise this method should return an
+        error.
+
+        :param str path:
+            requested path (relative or absolute) of the folder to remove.
+        :return: an SFTP error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def chattr(self, path, attr):
+        """
+        Change the attributes of a file.  The ``attr`` object will contain
+        only those fields provided by the client in its request, so you
+        should check for the presence of fields before using them.
+
+        :param str path:
+            requested path (relative or absolute) of the file to change.
+        :param attr:
+            requested attributes to change on the file (an `.SFTPAttributes`
+            object)
+        :return: an error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def canonicalize(self, path):
+        """
+        Return the canonical form of a path on the server.  For example,
+        if the server's home folder is ``/home/foo``, the path
+        ``"../betty"`` would be canonicalized to ``"/home/betty"``.  Note
+        the obvious security issues: if you're serving files only from a
+        specific folder, you probably don't want this method to reveal path
+        names outside that folder.
+
+        You may find the Python methods in ``os.path`` useful, especially
+        ``os.path.normpath`` and ``os.path.realpath``.
+
+        The default implementation returns ``os.path.normpath('/' + path)``.
+        """
+        if os.path.isabs(path):
+            out = os.path.normpath(path)
+        else:
+            out = os.path.normpath("/" + path)
+        if sys.platform == "win32":
+            # on windows, normalize backslashes to sftp/posix format
+            out = out.replace("\\", "/")
+        return out
+
+    def readlink(self, path):
+        """
+        Return the target of a symbolic link (or shortcut) on the server.
+        If the specified path doesn't refer to a symbolic link, an error
+        should be returned.
+
+        :param str path: path (relative or absolute) of the symbolic link.
+        :return:
+            the target `str` path of the symbolic link, or an error code like
+            ``SFTP_NO_SUCH_FILE``.
+        """
+        return SFTP_OP_UNSUPPORTED
+
+    def symlink(self, target_path, path):
+        """
+        Create a symbolic link on the server, as new pathname ``path``,
+        with ``target_path`` as the target of the link.
+
+        :param str target_path:
+            path (relative or absolute) of the target for this new symbolic
+            link.
+        :param str path:
+            path (relative or absolute) of the symbolic link to create.
+        :return: an error code `int` like ``SFTP_OK``.
+        """
+        return SFTP_OP_UNSUPPORTED
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_exception.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_exception.py
new file mode 100644
index 0000000000000000000000000000000000000000..a1e1cfc39dd516c641fc94579e6e2a9969417cc1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_exception.py
@@ -0,0 +1,240 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+import socket
+
+
+class SSHException(Exception):
+    """
+    Exception raised by failures in SSH2 protocol negotiation or logic errors.
+    """
+
+    pass
+
+
+class AuthenticationException(SSHException):
+    """
+    Exception raised when authentication failed for some reason.  It may be
+    possible to retry with different credentials.  (Other classes specify more
+    specific reasons.)
+
+    .. versionadded:: 1.6
+    """
+
+    pass
+
+
+class PasswordRequiredException(AuthenticationException):
+    """
+    Exception raised when a password is needed to unlock a private key file.
+    """
+
+    pass
+
+
+class BadAuthenticationType(AuthenticationException):
+    """
+    Exception raised when an authentication type (like password) is used, but
+    the server isn't allowing that type.  (It may only allow public-key, for
+    example.)
+
+    .. versionadded:: 1.1
+    """
+
+    allowed_types = []
+
+    # TODO 4.0: remove explanation kwarg
+    def __init__(self, explanation, types):
+        # TODO 4.0: remove this supercall unless it's actually required for
+        # pickling (after fixing pickling)
+        AuthenticationException.__init__(self, explanation, types)
+        self.explanation = explanation
+        self.allowed_types = types
+
+    def __str__(self):
+        return "{}; allowed types: {!r}".format(
+            self.explanation, self.allowed_types
+        )
+
+
+class PartialAuthentication(AuthenticationException):
+    """
+    An internal exception thrown in the case of partial authentication.
+    """
+
+    allowed_types = []
+
+    def __init__(self, types):
+        AuthenticationException.__init__(self, types)
+        self.allowed_types = types
+
+    def __str__(self):
+        return "Partial authentication; allowed types: {!r}".format(
+            self.allowed_types
+        )
+
+
+# TODO 4.0: stop inheriting from SSHException, move to auth.py
+class UnableToAuthenticate(AuthenticationException):
+    pass
+
+
+class ChannelException(SSHException):
+    """
+    Exception raised when an attempt to open a new `.Channel` fails.
+
+    :param int code: the error code returned by the server
+
+    .. versionadded:: 1.6
+    """
+
+    def __init__(self, code, text):
+        SSHException.__init__(self, code, text)
+        self.code = code
+        self.text = text
+
+    def __str__(self):
+        return "ChannelException({!r}, {!r})".format(self.code, self.text)
+
+
+class BadHostKeyException(SSHException):
+    """
+    The host key given by the SSH server did not match what we were expecting.
+
+    :param str hostname: the hostname of the SSH server
+    :param PKey got_key: the host key presented by the server
+    :param PKey expected_key: the host key expected
+
+    .. versionadded:: 1.6
+    """
+
+    def __init__(self, hostname, got_key, expected_key):
+        SSHException.__init__(self, hostname, got_key, expected_key)
+        self.hostname = hostname
+        self.key = got_key
+        self.expected_key = expected_key
+
+    def __str__(self):
+        msg = "Host key for server '{}' does not match: got '{}', expected '{}'"  # noqa
+        return msg.format(
+            self.hostname,
+            self.key.get_base64(),
+            self.expected_key.get_base64(),
+        )
+
+
+class IncompatiblePeer(SSHException):
+    """
+    A disagreement arose regarding an algorithm required for key exchange.
+
+    .. versionadded:: 2.9
+    """
+
+    # TODO 4.0: consider making this annotate w/ 1..N 'missing' algorithms,
+    # either just the first one that would halt kex, or even updating the
+    # Transport logic so we record /all/ that /could/ halt kex.
+    # TODO: update docstrings where this may end up raised so they are more
+    # specific.
+    pass
+
+
+class ProxyCommandFailure(SSHException):
+    """
+    The "ProxyCommand" found in the .ssh/config file returned an error.
+
+    :param str command: The command line that is generating this exception.
+    :param str error: The error captured from the proxy command output.
+    """
+
+    def __init__(self, command, error):
+        SSHException.__init__(self, command, error)
+        self.command = command
+        self.error = error
+
+    def __str__(self):
+        return 'ProxyCommand("{}") returned nonzero exit status: {}'.format(
+            self.command, self.error
+        )
+
+
+class NoValidConnectionsError(socket.error):
+    """
+    Multiple connection attempts were made and no families succeeded.
+
+    This exception class wraps multiple "real" underlying connection errors,
+    all of which represent failed connection attempts. Because these errors are
+    not guaranteed to all be of the same error type (i.e. different errno,
+    `socket.error` subclass, message, etc) we expose a single unified error
+    message and a ``None`` errno so that instances of this class match most
+    normal handling of `socket.error` objects.
+
+    To see the wrapped exception objects, access the ``errors`` attribute.
+    ``errors`` is a dict whose keys are address tuples (e.g. ``('127.0.0.1',
+    22)``) and whose values are the exception encountered trying to connect to
+    that address.
+
+    It is implied/assumed that all the errors given to a single instance of
+    this class are from connecting to the same hostname + port (and thus that
+    the differences are in the resolution of the hostname - e.g. IPv4 vs v6).
+
+    .. versionadded:: 1.16
+    """
+
+    def __init__(self, errors):
+        """
+        :param dict errors:
+            The errors dict to store, as described by class docstring.
+        """
+        addrs = sorted(errors.keys())
+        body = ", ".join([x[0] for x in addrs[:-1]])
+        tail = addrs[-1][0]
+        if body:
+            msg = "Unable to connect to port {0} on {1} or {2}"
+        else:
+            msg = "Unable to connect to port {0} on {2}"
+        super().__init__(
+            None, msg.format(addrs[0][1], body, tail)  # stand-in for errno
+        )
+        self.errors = errors
+
+    def __reduce__(self):
+        return (self.__class__, (self.errors,))
+
+
+class CouldNotCanonicalize(SSHException):
+    """
+    Raised when hostname canonicalization fails & fallback is disabled.
+
+    .. versionadded:: 2.7
+    """
+
+    pass
+
+
+class ConfigParseError(SSHException):
+    """
+    A fatal error was encountered trying to parse SSH config data.
+
+    Typically this means a config file violated the ``ssh_config``
+    specification in a manner that requires exiting immediately, such as not
+    matching ``key = value`` syntax or misusing certain ``Match`` keywords.
+
+    .. versionadded:: 2.7
+    """
+
+    pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_gss.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_gss.py
new file mode 100644
index 0000000000000000000000000000000000000000..ee49c34dd59b25b2c6d6dfff39a6393743566ecb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/ssh_gss.py
@@ -0,0 +1,778 @@
+# Copyright (C) 2013-2014 science + computing ag
+# Author: Sebastian Deiss <sebastian.deiss@t-online.de>
+#
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+
+"""
+This module provides GSS-API / SSPI  authentication as defined in :rfc:`4462`.
+
+.. note:: Credential delegation is not supported in server mode.
+
+.. seealso:: :doc:`/api/kex_gss`
+
+.. versionadded:: 1.15
+"""
+
+import struct
+import os
+import sys
+
+
+#: A boolean constraint that indicates if GSS-API / SSPI is available.
+GSS_AUTH_AVAILABLE = True
+
+
+#: A tuple of the exception types used by the underlying GSSAPI implementation.
+GSS_EXCEPTIONS = ()
+
+
+#: :var str _API: Constraint for the used API
+_API = None
+
+try:
+    import gssapi
+
+    if hasattr(gssapi, "__title__") and gssapi.__title__ == "python-gssapi":
+        # old, unmaintained python-gssapi package
+        _API = "MIT"  # keep this for compatibility
+        GSS_EXCEPTIONS = (gssapi.GSSException,)
+    else:
+        _API = "PYTHON-GSSAPI-NEW"
+        GSS_EXCEPTIONS = (
+            gssapi.exceptions.GeneralError,
+            gssapi.raw.misc.GSSError,
+        )
+except (ImportError, OSError):
+    try:
+        import pywintypes
+        import sspicon
+        import sspi
+
+        _API = "SSPI"
+        GSS_EXCEPTIONS = (pywintypes.error,)
+    except ImportError:
+        GSS_AUTH_AVAILABLE = False
+        _API = None
+
+from paramiko.common import MSG_USERAUTH_REQUEST
+from paramiko.ssh_exception import SSHException
+from paramiko._version import __version_info__
+
+
+def GSSAuth(auth_method, gss_deleg_creds=True):
+    """
+    Provide SSH2 GSS-API / SSPI authentication.
+
+    :param str auth_method: The name of the SSH authentication mechanism
+                            (gssapi-with-mic or gss-keyex)
+    :param bool gss_deleg_creds: Delegate client credentials or not.
+                                 We delegate credentials by default.
+    :return: Either an `._SSH_GSSAPI_OLD` or `._SSH_GSSAPI_NEW` (Unix)
+             object or an `_SSH_SSPI` (Windows) object
+    :rtype: object
+
+    :raises: ``ImportError`` -- If no GSS-API / SSPI module could be imported.
+
+    :see: `RFC 4462 <http://www.ietf.org/rfc/rfc4462.txt>`_
+    :note: Check for the available API and return either an `._SSH_GSSAPI_OLD`
+           (MIT GSSAPI using python-gssapi package) object, an
+           `._SSH_GSSAPI_NEW` (MIT GSSAPI using gssapi package) object
+           or an `._SSH_SSPI` (MS SSPI) object.
+           If there is no supported API available,
+           ``None`` will be returned.
+    """
+    if _API == "MIT":
+        return _SSH_GSSAPI_OLD(auth_method, gss_deleg_creds)
+    elif _API == "PYTHON-GSSAPI-NEW":
+        return _SSH_GSSAPI_NEW(auth_method, gss_deleg_creds)
+    elif _API == "SSPI" and os.name == "nt":
+        return _SSH_SSPI(auth_method, gss_deleg_creds)
+    else:
+        raise ImportError("Unable to import a GSS-API / SSPI module!")
+
+
+class _SSH_GSSAuth:
+    """
+    Contains the shared variables and methods of `._SSH_GSSAPI_OLD`,
+    `._SSH_GSSAPI_NEW` and `._SSH_SSPI`.
+    """
+
+    def __init__(self, auth_method, gss_deleg_creds):
+        """
+        :param str auth_method: The name of the SSH authentication mechanism
+                                (gssapi-with-mic or gss-keyex)
+        :param bool gss_deleg_creds: Delegate client credentials or not
+        """
+        self._auth_method = auth_method
+        self._gss_deleg_creds = gss_deleg_creds
+        self._gss_host = None
+        self._username = None
+        self._session_id = None
+        self._service = "ssh-connection"
+        """
+        OpenSSH supports Kerberos V5 mechanism only for GSS-API authentication,
+        so we also support the krb5 mechanism only.
+        """
+        self._krb5_mech = "1.2.840.113554.1.2.2"
+
+        # client mode
+        self._gss_ctxt = None
+        self._gss_ctxt_status = False
+
+        # server mode
+        self._gss_srv_ctxt = None
+        self._gss_srv_ctxt_status = False
+        self.cc_file = None
+
+    def set_service(self, service):
+        """
+        This is just a setter to use a non default service.
+        I added this method, because RFC 4462 doesn't specify "ssh-connection"
+        as the only service value.
+
+        :param str service: The desired SSH service
+        """
+        if service.find("ssh-"):
+            self._service = service
+
+    def set_username(self, username):
+        """
+        Setter for C{username}. If GSS-API Key Exchange is performed, the
+        username is not set by C{ssh_init_sec_context}.
+
+        :param str username: The name of the user who attempts to login
+        """
+        self._username = username
+
+    def ssh_gss_oids(self, mode="client"):
+        """
+        This method returns a single OID, because we only support the
+        Kerberos V5 mechanism.
+
+        :param str mode: Client for client mode and server for server mode
+        :return: A byte sequence containing the number of supported
+                 OIDs, the length of the OID and the actual OID encoded with
+                 DER
+        :note: In server mode we just return the OID length and the DER encoded
+               OID.
+        """
+        from pyasn1.type.univ import ObjectIdentifier
+        from pyasn1.codec.der import encoder
+
+        OIDs = self._make_uint32(1)
+        krb5_OID = encoder.encode(ObjectIdentifier(self._krb5_mech))
+        OID_len = self._make_uint32(len(krb5_OID))
+        if mode == "server":
+            return OID_len + krb5_OID
+        return OIDs + OID_len + krb5_OID
+
+    def ssh_check_mech(self, desired_mech):
+        """
+        Check if the given OID is the Kerberos V5 OID (server mode).
+
+        :param str desired_mech: The desired GSS-API mechanism of the client
+        :return: ``True`` if the given OID is supported, otherwise C{False}
+        """
+        from pyasn1.codec.der import decoder
+
+        mech, __ = decoder.decode(desired_mech)
+        if mech.__str__() != self._krb5_mech:
+            return False
+        return True
+
+    # Internals
+    # -------------------------------------------------------------------------
+    def _make_uint32(self, integer):
+        """
+        Create a 32 bit unsigned integer (The byte sequence of an integer).
+
+        :param int integer: The integer value to convert
+        :return: The byte sequence of an 32 bit integer
+        """
+        return struct.pack("!I", integer)
+
+    def _ssh_build_mic(self, session_id, username, service, auth_method):
+        """
+        Create the SSH2 MIC filed for gssapi-with-mic.
+
+        :param str session_id: The SSH session ID
+        :param str username: The name of the user who attempts to login
+        :param str service: The requested SSH service
+        :param str auth_method: The requested SSH authentication mechanism
+        :return: The MIC as defined in RFC 4462. The contents of the
+                 MIC field are:
+                 string    session_identifier,
+                 byte      SSH_MSG_USERAUTH_REQUEST,
+                 string    user-name,
+                 string    service (ssh-connection),
+                 string    authentication-method
+                           (gssapi-with-mic or gssapi-keyex)
+        """
+        mic = self._make_uint32(len(session_id))
+        mic += session_id
+        mic += struct.pack("B", MSG_USERAUTH_REQUEST)
+        mic += self._make_uint32(len(username))
+        mic += username.encode()
+        mic += self._make_uint32(len(service))
+        mic += service.encode()
+        mic += self._make_uint32(len(auth_method))
+        mic += auth_method.encode()
+        return mic
+
+
+class _SSH_GSSAPI_OLD(_SSH_GSSAuth):
+    """
+    Implementation of the GSS-API MIT Kerberos Authentication for SSH2,
+    using the older (unmaintained) python-gssapi package.
+
+    :see: `.GSSAuth`
+    """
+
+    def __init__(self, auth_method, gss_deleg_creds):
+        """
+        :param str auth_method: The name of the SSH authentication mechanism
+                                (gssapi-with-mic or gss-keyex)
+        :param bool gss_deleg_creds: Delegate client credentials or not
+        """
+        _SSH_GSSAuth.__init__(self, auth_method, gss_deleg_creds)
+
+        if self._gss_deleg_creds:
+            self._gss_flags = (
+                gssapi.C_PROT_READY_FLAG,
+                gssapi.C_INTEG_FLAG,
+                gssapi.C_MUTUAL_FLAG,
+                gssapi.C_DELEG_FLAG,
+            )
+        else:
+            self._gss_flags = (
+                gssapi.C_PROT_READY_FLAG,
+                gssapi.C_INTEG_FLAG,
+                gssapi.C_MUTUAL_FLAG,
+            )
+
+    def ssh_init_sec_context(
+        self, target, desired_mech=None, username=None, recv_token=None
+    ):
+        """
+        Initialize a GSS-API context.
+
+        :param str username: The name of the user who attempts to login
+        :param str target: The hostname of the target to connect to
+        :param str desired_mech: The negotiated GSS-API mechanism
+                                 ("pseudo negotiated" mechanism, because we
+                                 support just the krb5 mechanism :-))
+        :param str recv_token: The GSS-API token received from the Server
+        :raises:
+            `.SSHException` -- Is raised if the desired mechanism of the client
+            is not supported
+        :return: A ``String`` if the GSS-API has returned a token or
+            ``None`` if no token was returned
+        """
+        from pyasn1.codec.der import decoder
+
+        self._username = username
+        self._gss_host = target
+        targ_name = gssapi.Name(
+            "host@" + self._gss_host, gssapi.C_NT_HOSTBASED_SERVICE
+        )
+        ctx = gssapi.Context()
+        ctx.flags = self._gss_flags
+        if desired_mech is None:
+            krb5_mech = gssapi.OID.mech_from_string(self._krb5_mech)
+        else:
+            mech, __ = decoder.decode(desired_mech)
+            if mech.__str__() != self._krb5_mech:
+                raise SSHException("Unsupported mechanism OID.")
+            else:
+                krb5_mech = gssapi.OID.mech_from_string(self._krb5_mech)
+        token = None
+        try:
+            if recv_token is None:
+                self._gss_ctxt = gssapi.InitContext(
+                    peer_name=targ_name,
+                    mech_type=krb5_mech,
+                    req_flags=ctx.flags,
+                )
+                token = self._gss_ctxt.step(token)
+            else:
+                token = self._gss_ctxt.step(recv_token)
+        except gssapi.GSSException:
+            message = "{} Target: {}".format(sys.exc_info()[1], self._gss_host)
+            raise gssapi.GSSException(message)
+        self._gss_ctxt_status = self._gss_ctxt.established
+        return token
+
+    def ssh_get_mic(self, session_id, gss_kex=False):
+        """
+        Create the MIC token for a SSH2 message.
+
+        :param str session_id: The SSH session ID
+        :param bool gss_kex: Generate the MIC for GSS-API Key Exchange or not
+        :return: gssapi-with-mic:
+                 Returns the MIC token from GSS-API for the message we created
+                 with ``_ssh_build_mic``.
+                 gssapi-keyex:
+                 Returns the MIC token from GSS-API with the SSH session ID as
+                 message.
+        """
+        self._session_id = session_id
+        if not gss_kex:
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            mic_token = self._gss_ctxt.get_mic(mic_field)
+        else:
+            # for key exchange with gssapi-keyex
+            mic_token = self._gss_srv_ctxt.get_mic(self._session_id)
+        return mic_token
+
+    def ssh_accept_sec_context(self, hostname, recv_token, username=None):
+        """
+        Accept a GSS-API context (server mode).
+
+        :param str hostname: The servers hostname
+        :param str username: The name of the user who attempts to login
+        :param str recv_token: The GSS-API Token received from the server,
+                               if it's not the initial call.
+        :return: A ``String`` if the GSS-API has returned a token or ``None``
+                if no token was returned
+        """
+        # hostname and username are not required for GSSAPI, but for SSPI
+        self._gss_host = hostname
+        self._username = username
+        if self._gss_srv_ctxt is None:
+            self._gss_srv_ctxt = gssapi.AcceptContext()
+        token = self._gss_srv_ctxt.step(recv_token)
+        self._gss_srv_ctxt_status = self._gss_srv_ctxt.established
+        return token
+
+    def ssh_check_mic(self, mic_token, session_id, username=None):
+        """
+        Verify the MIC token for a SSH2 message.
+
+        :param str mic_token: The MIC token received from the client
+        :param str session_id: The SSH session ID
+        :param str username: The name of the user who attempts to login
+        :return: None if the MIC check was successful
+        :raises: ``gssapi.GSSException`` -- if the MIC check failed
+        """
+        self._session_id = session_id
+        self._username = username
+        if self._username is not None:
+            # server mode
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            self._gss_srv_ctxt.verify_mic(mic_field, mic_token)
+        else:
+            # for key exchange with gssapi-keyex
+            # client mode
+            self._gss_ctxt.verify_mic(self._session_id, mic_token)
+
+    @property
+    def credentials_delegated(self):
+        """
+        Checks if credentials are delegated (server mode).
+
+        :return: ``True`` if credentials are delegated, otherwise ``False``
+        """
+        if self._gss_srv_ctxt.delegated_cred is not None:
+            return True
+        return False
+
+    def save_client_creds(self, client_token):
+        """
+        Save the Client token in a file. This is used by the SSH server
+        to store the client credentials if credentials are delegated
+        (server mode).
+
+        :param str client_token: The GSS-API token received form the client
+        :raises:
+            ``NotImplementedError`` -- Credential delegation is currently not
+            supported in server mode
+        """
+        raise NotImplementedError
+
+
+if __version_info__ < (2, 5):
+    # provide the old name for strict backward compatibility
+    _SSH_GSSAPI = _SSH_GSSAPI_OLD
+
+
+class _SSH_GSSAPI_NEW(_SSH_GSSAuth):
+    """
+    Implementation of the GSS-API MIT Kerberos Authentication for SSH2,
+    using the newer, currently maintained gssapi package.
+
+    :see: `.GSSAuth`
+    """
+
+    def __init__(self, auth_method, gss_deleg_creds):
+        """
+        :param str auth_method: The name of the SSH authentication mechanism
+                                (gssapi-with-mic or gss-keyex)
+        :param bool gss_deleg_creds: Delegate client credentials or not
+        """
+        _SSH_GSSAuth.__init__(self, auth_method, gss_deleg_creds)
+
+        if self._gss_deleg_creds:
+            self._gss_flags = (
+                gssapi.RequirementFlag.protection_ready,
+                gssapi.RequirementFlag.integrity,
+                gssapi.RequirementFlag.mutual_authentication,
+                gssapi.RequirementFlag.delegate_to_peer,
+            )
+        else:
+            self._gss_flags = (
+                gssapi.RequirementFlag.protection_ready,
+                gssapi.RequirementFlag.integrity,
+                gssapi.RequirementFlag.mutual_authentication,
+            )
+
+    def ssh_init_sec_context(
+        self, target, desired_mech=None, username=None, recv_token=None
+    ):
+        """
+        Initialize a GSS-API context.
+
+        :param str username: The name of the user who attempts to login
+        :param str target: The hostname of the target to connect to
+        :param str desired_mech: The negotiated GSS-API mechanism
+                                 ("pseudo negotiated" mechanism, because we
+                                 support just the krb5 mechanism :-))
+        :param str recv_token: The GSS-API token received from the Server
+        :raises: `.SSHException` -- Is raised if the desired mechanism of the
+                 client is not supported
+        :raises: ``gssapi.exceptions.GSSError`` if there is an error signaled
+                                                by the GSS-API implementation
+        :return: A ``String`` if the GSS-API has returned a token or ``None``
+                 if no token was returned
+        """
+        from pyasn1.codec.der import decoder
+
+        self._username = username
+        self._gss_host = target
+        targ_name = gssapi.Name(
+            "host@" + self._gss_host,
+            name_type=gssapi.NameType.hostbased_service,
+        )
+        if desired_mech is not None:
+            mech, __ = decoder.decode(desired_mech)
+            if mech.__str__() != self._krb5_mech:
+                raise SSHException("Unsupported mechanism OID.")
+        krb5_mech = gssapi.MechType.kerberos
+        token = None
+        if recv_token is None:
+            self._gss_ctxt = gssapi.SecurityContext(
+                name=targ_name,
+                flags=self._gss_flags,
+                mech=krb5_mech,
+                usage="initiate",
+            )
+            token = self._gss_ctxt.step(token)
+        else:
+            token = self._gss_ctxt.step(recv_token)
+        self._gss_ctxt_status = self._gss_ctxt.complete
+        return token
+
+    def ssh_get_mic(self, session_id, gss_kex=False):
+        """
+        Create the MIC token for a SSH2 message.
+
+        :param str session_id: The SSH session ID
+        :param bool gss_kex: Generate the MIC for GSS-API Key Exchange or not
+        :return: gssapi-with-mic:
+                 Returns the MIC token from GSS-API for the message we created
+                 with ``_ssh_build_mic``.
+                 gssapi-keyex:
+                 Returns the MIC token from GSS-API with the SSH session ID as
+                 message.
+        :rtype: str
+        """
+        self._session_id = session_id
+        if not gss_kex:
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            mic_token = self._gss_ctxt.get_signature(mic_field)
+        else:
+            # for key exchange with gssapi-keyex
+            mic_token = self._gss_srv_ctxt.get_signature(self._session_id)
+        return mic_token
+
+    def ssh_accept_sec_context(self, hostname, recv_token, username=None):
+        """
+        Accept a GSS-API context (server mode).
+
+        :param str hostname: The servers hostname
+        :param str username: The name of the user who attempts to login
+        :param str recv_token: The GSS-API Token received from the server,
+                               if it's not the initial call.
+        :return: A ``String`` if the GSS-API has returned a token or ``None``
+                if no token was returned
+        """
+        # hostname and username are not required for GSSAPI, but for SSPI
+        self._gss_host = hostname
+        self._username = username
+        if self._gss_srv_ctxt is None:
+            self._gss_srv_ctxt = gssapi.SecurityContext(usage="accept")
+        token = self._gss_srv_ctxt.step(recv_token)
+        self._gss_srv_ctxt_status = self._gss_srv_ctxt.complete
+        return token
+
+    def ssh_check_mic(self, mic_token, session_id, username=None):
+        """
+        Verify the MIC token for a SSH2 message.
+
+        :param str mic_token: The MIC token received from the client
+        :param str session_id: The SSH session ID
+        :param str username: The name of the user who attempts to login
+        :return: None if the MIC check was successful
+        :raises: ``gssapi.exceptions.GSSError`` -- if the MIC check failed
+        """
+        self._session_id = session_id
+        self._username = username
+        if self._username is not None:
+            # server mode
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            self._gss_srv_ctxt.verify_signature(mic_field, mic_token)
+        else:
+            # for key exchange with gssapi-keyex
+            # client mode
+            self._gss_ctxt.verify_signature(self._session_id, mic_token)
+
+    @property
+    def credentials_delegated(self):
+        """
+        Checks if credentials are delegated (server mode).
+
+        :return: ``True`` if credentials are delegated, otherwise ``False``
+        :rtype: bool
+        """
+        if self._gss_srv_ctxt.delegated_creds is not None:
+            return True
+        return False
+
+    def save_client_creds(self, client_token):
+        """
+        Save the Client token in a file. This is used by the SSH server
+        to store the client credentials if credentials are delegated
+        (server mode).
+
+        :param str client_token: The GSS-API token received form the client
+        :raises: ``NotImplementedError`` -- Credential delegation is currently
+                 not supported in server mode
+        """
+        raise NotImplementedError
+
+
+class _SSH_SSPI(_SSH_GSSAuth):
+    """
+    Implementation of the Microsoft SSPI Kerberos Authentication for SSH2.
+
+    :see: `.GSSAuth`
+    """
+
+    def __init__(self, auth_method, gss_deleg_creds):
+        """
+        :param str auth_method: The name of the SSH authentication mechanism
+                                (gssapi-with-mic or gss-keyex)
+        :param bool gss_deleg_creds: Delegate client credentials or not
+        """
+        _SSH_GSSAuth.__init__(self, auth_method, gss_deleg_creds)
+
+        if self._gss_deleg_creds:
+            self._gss_flags = (
+                sspicon.ISC_REQ_INTEGRITY
+                | sspicon.ISC_REQ_MUTUAL_AUTH
+                | sspicon.ISC_REQ_DELEGATE
+            )
+        else:
+            self._gss_flags = (
+                sspicon.ISC_REQ_INTEGRITY | sspicon.ISC_REQ_MUTUAL_AUTH
+            )
+
+    def ssh_init_sec_context(
+        self, target, desired_mech=None, username=None, recv_token=None
+    ):
+        """
+        Initialize a SSPI context.
+
+        :param str username: The name of the user who attempts to login
+        :param str target: The FQDN of the target to connect to
+        :param str desired_mech: The negotiated SSPI mechanism
+                                 ("pseudo negotiated" mechanism, because we
+                                 support just the krb5 mechanism :-))
+        :param recv_token: The SSPI token received from the Server
+        :raises:
+            `.SSHException` -- Is raised if the desired mechanism of the client
+            is not supported
+        :return: A ``String`` if the SSPI has returned a token or ``None`` if
+                 no token was returned
+        """
+        from pyasn1.codec.der import decoder
+
+        self._username = username
+        self._gss_host = target
+        error = 0
+        targ_name = "host/" + self._gss_host
+        if desired_mech is not None:
+            mech, __ = decoder.decode(desired_mech)
+            if mech.__str__() != self._krb5_mech:
+                raise SSHException("Unsupported mechanism OID.")
+        try:
+            if recv_token is None:
+                self._gss_ctxt = sspi.ClientAuth(
+                    "Kerberos", scflags=self._gss_flags, targetspn=targ_name
+                )
+            error, token = self._gss_ctxt.authorize(recv_token)
+            token = token[0].Buffer
+        except pywintypes.error as e:
+            e.strerror += ", Target: {}".format(self._gss_host)
+            raise
+
+        if error == 0:
+            """
+            if the status is GSS_COMPLETE (error = 0) the context is fully
+            established an we can set _gss_ctxt_status to True.
+            """
+            self._gss_ctxt_status = True
+            token = None
+            """
+            You won't get another token if the context is fully established,
+            so i set token to None instead of ""
+            """
+        return token
+
+    def ssh_get_mic(self, session_id, gss_kex=False):
+        """
+        Create the MIC token for a SSH2 message.
+
+        :param str session_id: The SSH session ID
+        :param bool gss_kex: Generate the MIC for Key Exchange with SSPI or not
+        :return: gssapi-with-mic:
+                 Returns the MIC token from SSPI for the message we created
+                 with ``_ssh_build_mic``.
+                 gssapi-keyex:
+                 Returns the MIC token from SSPI with the SSH session ID as
+                 message.
+        """
+        self._session_id = session_id
+        if not gss_kex:
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            mic_token = self._gss_ctxt.sign(mic_field)
+        else:
+            # for key exchange with gssapi-keyex
+            mic_token = self._gss_srv_ctxt.sign(self._session_id)
+        return mic_token
+
+    def ssh_accept_sec_context(self, hostname, username, recv_token):
+        """
+        Accept a SSPI context (server mode).
+
+        :param str hostname: The servers FQDN
+        :param str username: The name of the user who attempts to login
+        :param str recv_token: The SSPI Token received from the server,
+                               if it's not the initial call.
+        :return: A ``String`` if the SSPI has returned a token or ``None`` if
+                 no token was returned
+        """
+        self._gss_host = hostname
+        self._username = username
+        targ_name = "host/" + self._gss_host
+        self._gss_srv_ctxt = sspi.ServerAuth("Kerberos", spn=targ_name)
+        error, token = self._gss_srv_ctxt.authorize(recv_token)
+        token = token[0].Buffer
+        if error == 0:
+            self._gss_srv_ctxt_status = True
+            token = None
+        return token
+
+    def ssh_check_mic(self, mic_token, session_id, username=None):
+        """
+        Verify the MIC token for a SSH2 message.
+
+        :param str mic_token: The MIC token received from the client
+        :param str session_id: The SSH session ID
+        :param str username: The name of the user who attempts to login
+        :return: None if the MIC check was successful
+        :raises: ``sspi.error`` -- if the MIC check failed
+        """
+        self._session_id = session_id
+        self._username = username
+        if username is not None:
+            # server mode
+            mic_field = self._ssh_build_mic(
+                self._session_id,
+                self._username,
+                self._service,
+                self._auth_method,
+            )
+            # Verifies data and its signature.  If verification fails, an
+            # sspi.error will be raised.
+            self._gss_srv_ctxt.verify(mic_field, mic_token)
+        else:
+            # for key exchange with gssapi-keyex
+            # client mode
+            # Verifies data and its signature.  If verification fails, an
+            # sspi.error will be raised.
+            self._gss_ctxt.verify(self._session_id, mic_token)
+
+    @property
+    def credentials_delegated(self):
+        """
+        Checks if credentials are delegated (server mode).
+
+        :return: ``True`` if credentials are delegated, otherwise ``False``
+        """
+        return self._gss_flags & sspicon.ISC_REQ_DELEGATE and (
+            self._gss_srv_ctxt_status or self._gss_flags
+        )
+
+    def save_client_creds(self, client_token):
+        """
+        Save the Client token in a file. This is used by the SSH server
+        to store the client credentails if credentials are delegated
+        (server mode).
+
+        :param str client_token: The SSPI token received form the client
+        :raises:
+            ``NotImplementedError`` -- Credential delegation is currently not
+            supported in server mode
+        """
+        raise NotImplementedError
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/transport.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/transport.py
new file mode 100644
index 0000000000000000000000000000000000000000..8785d6bb284e3178200e0e343ca1a5bf85c3a4e7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/transport.py
@@ -0,0 +1,3302 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Core protocol implementation
+"""
+
+import os
+import socket
+import sys
+import threading
+import time
+import weakref
+from hashlib import md5, sha1, sha256, sha512
+
+from cryptography.hazmat.backends import default_backend
+from cryptography.hazmat.primitives.ciphers import algorithms, Cipher, modes
+
+import paramiko
+from paramiko import util
+from paramiko.auth_handler import AuthHandler, AuthOnlyHandler
+from paramiko.ssh_gss import GSSAuth
+from paramiko.channel import Channel
+from paramiko.common import (
+    xffffffff,
+    cMSG_CHANNEL_OPEN,
+    cMSG_IGNORE,
+    cMSG_GLOBAL_REQUEST,
+    DEBUG,
+    MSG_KEXINIT,
+    MSG_IGNORE,
+    MSG_DISCONNECT,
+    MSG_DEBUG,
+    ERROR,
+    WARNING,
+    cMSG_UNIMPLEMENTED,
+    INFO,
+    cMSG_KEXINIT,
+    cMSG_NEWKEYS,
+    MSG_NEWKEYS,
+    cMSG_REQUEST_SUCCESS,
+    cMSG_REQUEST_FAILURE,
+    CONNECTION_FAILED_CODE,
+    OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED,
+    OPEN_SUCCEEDED,
+    cMSG_CHANNEL_OPEN_FAILURE,
+    cMSG_CHANNEL_OPEN_SUCCESS,
+    MSG_GLOBAL_REQUEST,
+    MSG_REQUEST_SUCCESS,
+    MSG_REQUEST_FAILURE,
+    cMSG_SERVICE_REQUEST,
+    MSG_SERVICE_ACCEPT,
+    MSG_CHANNEL_OPEN_SUCCESS,
+    MSG_CHANNEL_OPEN_FAILURE,
+    MSG_CHANNEL_OPEN,
+    MSG_CHANNEL_SUCCESS,
+    MSG_CHANNEL_FAILURE,
+    MSG_CHANNEL_DATA,
+    MSG_CHANNEL_EXTENDED_DATA,
+    MSG_CHANNEL_WINDOW_ADJUST,
+    MSG_CHANNEL_REQUEST,
+    MSG_CHANNEL_EOF,
+    MSG_CHANNEL_CLOSE,
+    MIN_WINDOW_SIZE,
+    MIN_PACKET_SIZE,
+    MAX_WINDOW_SIZE,
+    DEFAULT_WINDOW_SIZE,
+    DEFAULT_MAX_PACKET_SIZE,
+    HIGHEST_USERAUTH_MESSAGE_ID,
+    MSG_UNIMPLEMENTED,
+    MSG_NAMES,
+    MSG_EXT_INFO,
+    cMSG_EXT_INFO,
+    byte_ord,
+)
+from paramiko.compress import ZlibCompressor, ZlibDecompressor
+from paramiko.dsskey import DSSKey
+from paramiko.ed25519key import Ed25519Key
+from paramiko.kex_curve25519 import KexCurve25519
+from paramiko.kex_gex import KexGex, KexGexSHA256
+from paramiko.kex_group1 import KexGroup1
+from paramiko.kex_group14 import KexGroup14, KexGroup14SHA256
+from paramiko.kex_group16 import KexGroup16SHA512
+from paramiko.kex_ecdh_nist import KexNistp256, KexNistp384, KexNistp521
+from paramiko.kex_gss import KexGSSGex, KexGSSGroup1, KexGSSGroup14
+from paramiko.message import Message
+from paramiko.packet import Packetizer, NeedRekeyException
+from paramiko.primes import ModulusPack
+from paramiko.rsakey import RSAKey
+from paramiko.ecdsakey import ECDSAKey
+from paramiko.server import ServerInterface
+from paramiko.sftp_client import SFTPClient
+from paramiko.ssh_exception import (
+    SSHException,
+    BadAuthenticationType,
+    ChannelException,
+    IncompatiblePeer,
+    ProxyCommandFailure,
+)
+from paramiko.util import (
+    ClosingContextManager,
+    clamp_value,
+    b,
+)
+
+
+# for thread cleanup
+_active_threads = []
+
+
+def _join_lingering_threads():
+    for thr in _active_threads:
+        thr.stop_thread()
+
+
+import atexit
+
+atexit.register(_join_lingering_threads)
+
+
+class Transport(threading.Thread, ClosingContextManager):
+    """
+    An SSH Transport attaches to a stream (usually a socket), negotiates an
+    encrypted session, authenticates, and then creates stream tunnels, called
+    `channels <.Channel>`, across the session.  Multiple channels can be
+    multiplexed across a single session (and often are, in the case of port
+    forwardings).
+
+    Instances of this class may be used as context managers.
+    """
+
+    _ENCRYPT = object()
+    _DECRYPT = object()
+
+    _PROTO_ID = "2.0"
+    _CLIENT_ID = "paramiko_{}".format(paramiko.__version__)
+
+    # These tuples of algorithm identifiers are in preference order; do not
+    # reorder without reason!
+    # NOTE: if you need to modify these, we suggest leveraging the
+    # `disabled_algorithms` constructor argument (also available in SSHClient)
+    # instead of monkeypatching or subclassing.
+    _preferred_ciphers = (
+        "aes128-ctr",
+        "aes192-ctr",
+        "aes256-ctr",
+        "aes128-cbc",
+        "aes192-cbc",
+        "aes256-cbc",
+        "3des-cbc",
+    )
+    _preferred_macs = (
+        "hmac-sha2-256",
+        "hmac-sha2-512",
+        "hmac-sha2-256-etm@openssh.com",
+        "hmac-sha2-512-etm@openssh.com",
+        "hmac-sha1",
+        "hmac-md5",
+        "hmac-sha1-96",
+        "hmac-md5-96",
+    )
+    # ~= HostKeyAlgorithms in OpenSSH land
+    _preferred_keys = (
+        "ssh-ed25519",
+        "ecdsa-sha2-nistp256",
+        "ecdsa-sha2-nistp384",
+        "ecdsa-sha2-nistp521",
+        "rsa-sha2-512",
+        "rsa-sha2-256",
+        "ssh-rsa",
+        "ssh-dss",
+    )
+    # ~= PubKeyAcceptedAlgorithms
+    _preferred_pubkeys = (
+        "ssh-ed25519",
+        "ecdsa-sha2-nistp256",
+        "ecdsa-sha2-nistp384",
+        "ecdsa-sha2-nistp521",
+        "rsa-sha2-512",
+        "rsa-sha2-256",
+        "ssh-rsa",
+        "ssh-dss",
+    )
+    _preferred_kex = (
+        "ecdh-sha2-nistp256",
+        "ecdh-sha2-nistp384",
+        "ecdh-sha2-nistp521",
+        "diffie-hellman-group16-sha512",
+        "diffie-hellman-group-exchange-sha256",
+        "diffie-hellman-group14-sha256",
+        "diffie-hellman-group-exchange-sha1",
+        "diffie-hellman-group14-sha1",
+        "diffie-hellman-group1-sha1",
+    )
+    if KexCurve25519.is_available():
+        _preferred_kex = ("curve25519-sha256@libssh.org",) + _preferred_kex
+    _preferred_gsskex = (
+        "gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==",
+        "gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==",
+        "gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==",
+    )
+    _preferred_compression = ("none",)
+
+    _cipher_info = {
+        "aes128-ctr": {
+            "class": algorithms.AES,
+            "mode": modes.CTR,
+            "block-size": 16,
+            "key-size": 16,
+        },
+        "aes192-ctr": {
+            "class": algorithms.AES,
+            "mode": modes.CTR,
+            "block-size": 16,
+            "key-size": 24,
+        },
+        "aes256-ctr": {
+            "class": algorithms.AES,
+            "mode": modes.CTR,
+            "block-size": 16,
+            "key-size": 32,
+        },
+        "aes128-cbc": {
+            "class": algorithms.AES,
+            "mode": modes.CBC,
+            "block-size": 16,
+            "key-size": 16,
+        },
+        "aes192-cbc": {
+            "class": algorithms.AES,
+            "mode": modes.CBC,
+            "block-size": 16,
+            "key-size": 24,
+        },
+        "aes256-cbc": {
+            "class": algorithms.AES,
+            "mode": modes.CBC,
+            "block-size": 16,
+            "key-size": 32,
+        },
+        "3des-cbc": {
+            "class": algorithms.TripleDES,
+            "mode": modes.CBC,
+            "block-size": 8,
+            "key-size": 24,
+        },
+    }
+
+    _mac_info = {
+        "hmac-sha1": {"class": sha1, "size": 20},
+        "hmac-sha1-96": {"class": sha1, "size": 12},
+        "hmac-sha2-256": {"class": sha256, "size": 32},
+        "hmac-sha2-256-etm@openssh.com": {"class": sha256, "size": 32},
+        "hmac-sha2-512": {"class": sha512, "size": 64},
+        "hmac-sha2-512-etm@openssh.com": {"class": sha512, "size": 64},
+        "hmac-md5": {"class": md5, "size": 16},
+        "hmac-md5-96": {"class": md5, "size": 12},
+    }
+
+    _key_info = {
+        # TODO: at some point we will want to drop this as it's no longer
+        # considered secure due to using SHA-1 for signatures. OpenSSH 8.8 no
+        # longer supports it. Question becomes at what point do we want to
+        # prevent users with older setups from using this?
+        "ssh-rsa": RSAKey,
+        "ssh-rsa-cert-v01@openssh.com": RSAKey,
+        "rsa-sha2-256": RSAKey,
+        "rsa-sha2-256-cert-v01@openssh.com": RSAKey,
+        "rsa-sha2-512": RSAKey,
+        "rsa-sha2-512-cert-v01@openssh.com": RSAKey,
+        "ssh-dss": DSSKey,
+        "ssh-dss-cert-v01@openssh.com": DSSKey,
+        "ecdsa-sha2-nistp256": ECDSAKey,
+        "ecdsa-sha2-nistp256-cert-v01@openssh.com": ECDSAKey,
+        "ecdsa-sha2-nistp384": ECDSAKey,
+        "ecdsa-sha2-nistp384-cert-v01@openssh.com": ECDSAKey,
+        "ecdsa-sha2-nistp521": ECDSAKey,
+        "ecdsa-sha2-nistp521-cert-v01@openssh.com": ECDSAKey,
+        "ssh-ed25519": Ed25519Key,
+        "ssh-ed25519-cert-v01@openssh.com": Ed25519Key,
+    }
+
+    _kex_info = {
+        "diffie-hellman-group1-sha1": KexGroup1,
+        "diffie-hellman-group14-sha1": KexGroup14,
+        "diffie-hellman-group-exchange-sha1": KexGex,
+        "diffie-hellman-group-exchange-sha256": KexGexSHA256,
+        "diffie-hellman-group14-sha256": KexGroup14SHA256,
+        "diffie-hellman-group16-sha512": KexGroup16SHA512,
+        "gss-group1-sha1-toWM5Slw5Ew8Mqkay+al2g==": KexGSSGroup1,
+        "gss-group14-sha1-toWM5Slw5Ew8Mqkay+al2g==": KexGSSGroup14,
+        "gss-gex-sha1-toWM5Slw5Ew8Mqkay+al2g==": KexGSSGex,
+        "ecdh-sha2-nistp256": KexNistp256,
+        "ecdh-sha2-nistp384": KexNistp384,
+        "ecdh-sha2-nistp521": KexNistp521,
+    }
+    if KexCurve25519.is_available():
+        _kex_info["curve25519-sha256@libssh.org"] = KexCurve25519
+
+    _compression_info = {
+        # zlib@openssh.com is just zlib, but only turned on after a successful
+        # authentication.  openssh servers may only offer this type because
+        # they've had troubles with security holes in zlib in the past.
+        "zlib@openssh.com": (ZlibCompressor, ZlibDecompressor),
+        "zlib": (ZlibCompressor, ZlibDecompressor),
+        "none": (None, None),
+    }
+
+    _modulus_pack = None
+    _active_check_timeout = 0.1
+
+    def __init__(
+        self,
+        sock,
+        default_window_size=DEFAULT_WINDOW_SIZE,
+        default_max_packet_size=DEFAULT_MAX_PACKET_SIZE,
+        gss_kex=False,
+        gss_deleg_creds=True,
+        disabled_algorithms=None,
+        server_sig_algs=True,
+    ):
+        """
+        Create a new SSH session over an existing socket, or socket-like
+        object.  This only creates the `.Transport` object; it doesn't begin
+        the SSH session yet.  Use `connect` or `start_client` to begin a client
+        session, or `start_server` to begin a server session.
+
+        If the object is not actually a socket, it must have the following
+        methods:
+
+        - ``send(bytes)``: Writes from 1 to ``len(bytes)`` bytes, and returns
+          an int representing the number of bytes written.  Returns
+          0 or raises ``EOFError`` if the stream has been closed.
+        - ``recv(int)``: Reads from 1 to ``int`` bytes and returns them as a
+          string.  Returns 0 or raises ``EOFError`` if the stream has been
+          closed.
+        - ``close()``: Closes the socket.
+        - ``settimeout(n)``: Sets a (float) timeout on I/O operations.
+
+        For ease of use, you may also pass in an address (as a tuple) or a host
+        string as the ``sock`` argument.  (A host string is a hostname with an
+        optional port (separated by ``":"``) which will be converted into a
+        tuple of ``(hostname, port)``.)  A socket will be connected to this
+        address and used for communication.  Exceptions from the ``socket``
+        call may be thrown in this case.
+
+        .. note::
+            Modifying the the window and packet sizes might have adverse
+            effects on your channels created from this transport. The default
+            values are the same as in the OpenSSH code base and have been
+            battle tested.
+
+        :param socket sock:
+            a socket or socket-like object to create the session over.
+        :param int default_window_size:
+            sets the default window size on the transport. (defaults to
+            2097152)
+        :param int default_max_packet_size:
+            sets the default max packet size on the transport. (defaults to
+            32768)
+        :param bool gss_kex:
+            Whether to enable GSSAPI key exchange when GSSAPI is in play.
+            Default: ``False``.
+        :param bool gss_deleg_creds:
+            Whether to enable GSSAPI credential delegation when GSSAPI is in
+            play. Default: ``True``.
+        :param dict disabled_algorithms:
+            If given, must be a dictionary mapping algorithm type to an
+            iterable of algorithm identifiers, which will be disabled for the
+            lifetime of the transport.
+
+            Keys should match the last word in the class' builtin algorithm
+            tuple attributes, such as ``"ciphers"`` to disable names within
+            ``_preferred_ciphers``; or ``"kex"`` to disable something defined
+            inside ``_preferred_kex``. Values should exactly match members of
+            the matching attribute.
+
+            For example, if you need to disable
+            ``diffie-hellman-group16-sha512`` key exchange (perhaps because
+            your code talks to a server which implements it differently from
+            Paramiko), specify ``disabled_algorithms={"kex":
+            ["diffie-hellman-group16-sha512"]}``.
+        :param bool server_sig_algs:
+            Whether to send an extra message to compatible clients, in server
+            mode, with a list of supported pubkey algorithms. Default:
+            ``True``.
+
+        .. versionchanged:: 1.15
+            Added the ``default_window_size`` and ``default_max_packet_size``
+            arguments.
+        .. versionchanged:: 1.15
+            Added the ``gss_kex`` and ``gss_deleg_creds`` kwargs.
+        .. versionchanged:: 2.6
+            Added the ``disabled_algorithms`` kwarg.
+        .. versionchanged:: 2.9
+            Added the ``server_sig_algs`` kwarg.
+        """
+        self.active = False
+        self.hostname = None
+        self.server_extensions = {}
+
+        # TODO: these two overrides on sock's type should go away sometime, too
+        # many ways to do it!
+        if isinstance(sock, str):
+            # convert "host:port" into (host, port)
+            hl = sock.split(":", 1)
+            self.hostname = hl[0]
+            if len(hl) == 1:
+                sock = (hl[0], 22)
+            else:
+                sock = (hl[0], int(hl[1]))
+        if type(sock) is tuple:
+            # connect to the given (host, port)
+            hostname, port = sock
+            self.hostname = hostname
+            reason = "No suitable address family"
+            addrinfos = socket.getaddrinfo(
+                hostname, port, socket.AF_UNSPEC, socket.SOCK_STREAM
+            )
+            for family, socktype, proto, canonname, sockaddr in addrinfos:
+                if socktype == socket.SOCK_STREAM:
+                    af = family
+                    # addr = sockaddr
+                    sock = socket.socket(af, socket.SOCK_STREAM)
+                    try:
+                        sock.connect((hostname, port))
+                    except socket.error as e:
+                        reason = str(e)
+                    else:
+                        break
+            else:
+                raise SSHException(
+                    "Unable to connect to {}: {}".format(hostname, reason)
+                )
+        # okay, normal socket-ish flow here...
+        threading.Thread.__init__(self)
+        self.daemon = True
+        self.sock = sock
+        # we set the timeout so we can check self.active periodically to
+        # see if we should bail. socket.timeout exception is never propagated.
+        self.sock.settimeout(self._active_check_timeout)
+
+        # negotiated crypto parameters
+        self.packetizer = Packetizer(sock)
+        self.local_version = "SSH-" + self._PROTO_ID + "-" + self._CLIENT_ID
+        self.remote_version = ""
+        self.local_cipher = self.remote_cipher = ""
+        self.local_kex_init = self.remote_kex_init = None
+        self.local_mac = self.remote_mac = None
+        self.local_compression = self.remote_compression = None
+        self.session_id = None
+        self.host_key_type = None
+        self.host_key = None
+
+        # GSS-API / SSPI Key Exchange
+        self.use_gss_kex = gss_kex
+        # This will be set to True if GSS-API Key Exchange was performed
+        self.gss_kex_used = False
+        self.kexgss_ctxt = None
+        self.gss_host = None
+        if self.use_gss_kex:
+            self.kexgss_ctxt = GSSAuth("gssapi-keyex", gss_deleg_creds)
+            self._preferred_kex = self._preferred_gsskex + self._preferred_kex
+
+        # state used during negotiation
+        self.kex_engine = None
+        self.H = None
+        self.K = None
+
+        self.initial_kex_done = False
+        self.in_kex = False
+        self.authenticated = False
+        self._expected_packet = tuple()
+        # synchronization (always higher level than write_lock)
+        self.lock = threading.Lock()
+
+        # tracking open channels
+        self._channels = ChannelMap()
+        self.channel_events = {}  # (id -> Event)
+        self.channels_seen = {}  # (id -> True)
+        self._channel_counter = 0
+        self.default_max_packet_size = default_max_packet_size
+        self.default_window_size = default_window_size
+        self._forward_agent_handler = None
+        self._x11_handler = None
+        self._tcp_handler = None
+
+        self.saved_exception = None
+        self.clear_to_send = threading.Event()
+        self.clear_to_send_lock = threading.Lock()
+        self.clear_to_send_timeout = 30.0
+        self.log_name = "paramiko.transport"
+        self.logger = util.get_logger(self.log_name)
+        self.packetizer.set_log(self.logger)
+        self.auth_handler = None
+        # response Message from an arbitrary global request
+        self.global_response = None
+        # user-defined event callbacks
+        self.completion_event = None
+        # how long (seconds) to wait for the SSH banner
+        self.banner_timeout = 15
+        # how long (seconds) to wait for the handshake to finish after SSH
+        # banner sent.
+        self.handshake_timeout = 15
+        # how long (seconds) to wait for the auth response.
+        self.auth_timeout = 30
+        # how long (seconds) to wait for opening a channel
+        self.channel_timeout = 60 * 60
+        self.disabled_algorithms = disabled_algorithms or {}
+        self.server_sig_algs = server_sig_algs
+
+        # server mode:
+        self.server_mode = False
+        self.server_object = None
+        self.server_key_dict = {}
+        self.server_accepts = []
+        self.server_accept_cv = threading.Condition(self.lock)
+        self.subsystem_table = {}
+
+        # Handler table, now set at init time for easier per-instance
+        # manipulation and subclass twiddling.
+        self._handler_table = {
+            MSG_EXT_INFO: self._parse_ext_info,
+            MSG_NEWKEYS: self._parse_newkeys,
+            MSG_GLOBAL_REQUEST: self._parse_global_request,
+            MSG_REQUEST_SUCCESS: self._parse_request_success,
+            MSG_REQUEST_FAILURE: self._parse_request_failure,
+            MSG_CHANNEL_OPEN_SUCCESS: self._parse_channel_open_success,
+            MSG_CHANNEL_OPEN_FAILURE: self._parse_channel_open_failure,
+            MSG_CHANNEL_OPEN: self._parse_channel_open,
+            MSG_KEXINIT: self._negotiate_keys,
+        }
+
+    def _filter_algorithm(self, type_):
+        default = getattr(self, "_preferred_{}".format(type_))
+        return tuple(
+            x
+            for x in default
+            if x not in self.disabled_algorithms.get(type_, [])
+        )
+
+    @property
+    def preferred_ciphers(self):
+        return self._filter_algorithm("ciphers")
+
+    @property
+    def preferred_macs(self):
+        return self._filter_algorithm("macs")
+
+    @property
+    def preferred_keys(self):
+        # Interleave cert variants here; resistant to various background
+        # overwriting of _preferred_keys, and necessary as hostkeys can't use
+        # the logic pubkey auth does re: injecting/checking for certs at
+        # runtime
+        filtered = self._filter_algorithm("keys")
+        return tuple(
+            filtered
+            + tuple("{}-cert-v01@openssh.com".format(x) for x in filtered)
+        )
+
+    @property
+    def preferred_pubkeys(self):
+        return self._filter_algorithm("pubkeys")
+
+    @property
+    def preferred_kex(self):
+        return self._filter_algorithm("kex")
+
+    @property
+    def preferred_compression(self):
+        return self._filter_algorithm("compression")
+
+    def __repr__(self):
+        """
+        Returns a string representation of this object, for debugging.
+        """
+        id_ = hex(id(self) & xffffffff)
+        out = "<paramiko.Transport at {}".format(id_)
+        if not self.active:
+            out += " (unconnected)"
+        else:
+            if self.local_cipher != "":
+                out += " (cipher {}, {:d} bits)".format(
+                    self.local_cipher,
+                    self._cipher_info[self.local_cipher]["key-size"] * 8,
+                )
+            if self.is_authenticated():
+                out += " (active; {} open channel(s))".format(
+                    len(self._channels)
+                )
+            elif self.initial_kex_done:
+                out += " (connected; awaiting auth)"
+            else:
+                out += " (connecting)"
+        out += ">"
+        return out
+
+    def atfork(self):
+        """
+        Terminate this Transport without closing the session.  On posix
+        systems, if a Transport is open during process forking, both parent
+        and child will share the underlying socket, but only one process can
+        use the connection (without corrupting the session).  Use this method
+        to clean up a Transport object without disrupting the other process.
+
+        .. versionadded:: 1.5.3
+        """
+        self.sock.close()
+        self.close()
+
+    def get_security_options(self):
+        """
+        Return a `.SecurityOptions` object which can be used to tweak the
+        encryption algorithms this transport will permit (for encryption,
+        digest/hash operations, public keys, and key exchanges) and the order
+        of preference for them.
+        """
+        return SecurityOptions(self)
+
+    def set_gss_host(self, gss_host, trust_dns=True, gssapi_requested=True):
+        """
+        Normalize/canonicalize ``self.gss_host`` depending on various factors.
+
+        :param str gss_host:
+            The explicitly requested GSS-oriented hostname to connect to (i.e.
+            what the host's name is in the Kerberos database.) Defaults to
+            ``self.hostname`` (which will be the 'real' target hostname and/or
+            host portion of given socket object.)
+        :param bool trust_dns:
+            Indicates whether or not DNS is trusted; if true, DNS will be used
+            to canonicalize the GSS hostname (which again will either be
+            ``gss_host`` or the transport's default hostname.)
+            (Defaults to True due to backwards compatibility.)
+        :param bool gssapi_requested:
+            Whether GSSAPI key exchange or authentication was even requested.
+            If not, this is a no-op and nothing happens
+            (and ``self.gss_host`` is not set.)
+            (Defaults to True due to backwards compatibility.)
+        :returns: ``None``.
+        """
+        # No GSSAPI in play == nothing to do
+        if not gssapi_requested:
+            return
+        # Obtain the correct host first - did user request a GSS-specific name
+        # to use that is distinct from the actual SSH target hostname?
+        if gss_host is None:
+            gss_host = self.hostname
+        # Finally, canonicalize via DNS if DNS is trusted.
+        if trust_dns and gss_host is not None:
+            gss_host = socket.getfqdn(gss_host)
+        # And set attribute for reference later.
+        self.gss_host = gss_host
+
+    def start_client(self, event=None, timeout=None):
+        """
+        Negotiate a new SSH2 session as a client.  This is the first step after
+        creating a new `.Transport`.  A separate thread is created for protocol
+        negotiation.
+
+        If an event is passed in, this method returns immediately.  When
+        negotiation is done (successful or not), the given ``Event`` will
+        be triggered.  On failure, `is_active` will return ``False``.
+
+        (Since 1.4) If ``event`` is ``None``, this method will not return until
+        negotiation is done.  On success, the method returns normally.
+        Otherwise an SSHException is raised.
+
+        After a successful negotiation, you will usually want to authenticate,
+        calling `auth_password <Transport.auth_password>` or
+        `auth_publickey <Transport.auth_publickey>`.
+
+        .. note:: `connect` is a simpler method for connecting as a client.
+
+        .. note::
+            After calling this method (or `start_server` or `connect`), you
+            should no longer directly read from or write to the original socket
+            object.
+
+        :param .threading.Event event:
+            an event to trigger when negotiation is complete (optional)
+
+        :param float timeout:
+            a timeout, in seconds, for SSH2 session negotiation (optional)
+
+        :raises:
+            `.SSHException` -- if negotiation fails (and no ``event`` was
+            passed in)
+        """
+        self.active = True
+        if event is not None:
+            # async, return immediately and let the app poll for completion
+            self.completion_event = event
+            self.start()
+            return
+
+        # synchronous, wait for a result
+        self.completion_event = event = threading.Event()
+        self.start()
+        max_time = time.time() + timeout if timeout is not None else None
+        while True:
+            event.wait(0.1)
+            if not self.active:
+                e = self.get_exception()
+                if e is not None:
+                    raise e
+                raise SSHException("Negotiation failed.")
+            if event.is_set() or (
+                timeout is not None and time.time() >= max_time
+            ):
+                break
+
+    def start_server(self, event=None, server=None):
+        """
+        Negotiate a new SSH2 session as a server.  This is the first step after
+        creating a new `.Transport` and setting up your server host key(s).  A
+        separate thread is created for protocol negotiation.
+
+        If an event is passed in, this method returns immediately.  When
+        negotiation is done (successful or not), the given ``Event`` will
+        be triggered.  On failure, `is_active` will return ``False``.
+
+        (Since 1.4) If ``event`` is ``None``, this method will not return until
+        negotiation is done.  On success, the method returns normally.
+        Otherwise an SSHException is raised.
+
+        After a successful negotiation, the client will need to authenticate.
+        Override the methods `get_allowed_auths
+        <.ServerInterface.get_allowed_auths>`, `check_auth_none
+        <.ServerInterface.check_auth_none>`, `check_auth_password
+        <.ServerInterface.check_auth_password>`, and `check_auth_publickey
+        <.ServerInterface.check_auth_publickey>` in the given ``server`` object
+        to control the authentication process.
+
+        After a successful authentication, the client should request to open a
+        channel.  Override `check_channel_request
+        <.ServerInterface.check_channel_request>` in the given ``server``
+        object to allow channels to be opened.
+
+        .. note::
+            After calling this method (or `start_client` or `connect`), you
+            should no longer directly read from or write to the original socket
+            object.
+
+        :param .threading.Event event:
+            an event to trigger when negotiation is complete.
+        :param .ServerInterface server:
+            an object used to perform authentication and create `channels
+            <.Channel>`
+
+        :raises:
+            `.SSHException` -- if negotiation fails (and no ``event`` was
+            passed in)
+        """
+        if server is None:
+            server = ServerInterface()
+        self.server_mode = True
+        self.server_object = server
+        self.active = True
+        if event is not None:
+            # async, return immediately and let the app poll for completion
+            self.completion_event = event
+            self.start()
+            return
+
+        # synchronous, wait for a result
+        self.completion_event = event = threading.Event()
+        self.start()
+        while True:
+            event.wait(0.1)
+            if not self.active:
+                e = self.get_exception()
+                if e is not None:
+                    raise e
+                raise SSHException("Negotiation failed.")
+            if event.is_set():
+                break
+
+    def add_server_key(self, key):
+        """
+        Add a host key to the list of keys used for server mode.  When behaving
+        as a server, the host key is used to sign certain packets during the
+        SSH2 negotiation, so that the client can trust that we are who we say
+        we are.  Because this is used for signing, the key must contain private
+        key info, not just the public half.  Only one key of each type (RSA or
+        DSS) is kept.
+
+        :param .PKey key:
+            the host key to add, usually an `.RSAKey` or `.DSSKey`.
+        """
+        self.server_key_dict[key.get_name()] = key
+        # Handle SHA-2 extensions for RSA by ensuring that lookups into
+        # self.server_key_dict will yield this key for any of the algorithm
+        # names.
+        if isinstance(key, RSAKey):
+            self.server_key_dict["rsa-sha2-256"] = key
+            self.server_key_dict["rsa-sha2-512"] = key
+
+    def get_server_key(self):
+        """
+        Return the active host key, in server mode.  After negotiating with the
+        client, this method will return the negotiated host key.  If only one
+        type of host key was set with `add_server_key`, that's the only key
+        that will ever be returned.  But in cases where you have set more than
+        one type of host key (for example, an RSA key and a DSS key), the key
+        type will be negotiated by the client, and this method will return the
+        key of the type agreed on.  If the host key has not been negotiated
+        yet, ``None`` is returned.  In client mode, the behavior is undefined.
+
+        :return:
+            host key (`.PKey`) of the type negotiated by the client, or
+            ``None``.
+        """
+        try:
+            return self.server_key_dict[self.host_key_type]
+        except KeyError:
+            pass
+        return None
+
+    @staticmethod
+    def load_server_moduli(filename=None):
+        """
+        (optional)
+        Load a file of prime moduli for use in doing group-exchange key
+        negotiation in server mode.  It's a rather obscure option and can be
+        safely ignored.
+
+        In server mode, the remote client may request "group-exchange" key
+        negotiation, which asks the server to send a random prime number that
+        fits certain criteria.  These primes are pretty difficult to compute,
+        so they can't be generated on demand.  But many systems contain a file
+        of suitable primes (usually named something like ``/etc/ssh/moduli``).
+        If you call `load_server_moduli` and it returns ``True``, then this
+        file of primes has been loaded and we will support "group-exchange" in
+        server mode.  Otherwise server mode will just claim that it doesn't
+        support that method of key negotiation.
+
+        :param str filename:
+            optional path to the moduli file, if you happen to know that it's
+            not in a standard location.
+        :return:
+            True if a moduli file was successfully loaded; False otherwise.
+
+        .. note:: This has no effect when used in client mode.
+        """
+        Transport._modulus_pack = ModulusPack()
+        # places to look for the openssh "moduli" file
+        file_list = ["/etc/ssh/moduli", "/usr/local/etc/moduli"]
+        if filename is not None:
+            file_list.insert(0, filename)
+        for fn in file_list:
+            try:
+                Transport._modulus_pack.read_file(fn)
+                return True
+            except IOError:
+                pass
+        # none succeeded
+        Transport._modulus_pack = None
+        return False
+
+    def close(self):
+        """
+        Close this session, and any open channels that are tied to it.
+        """
+        if not self.active:
+            return
+        self.stop_thread()
+        for chan in list(self._channels.values()):
+            chan._unlink()
+        self.sock.close()
+
+    def get_remote_server_key(self):
+        """
+        Return the host key of the server (in client mode).
+
+        .. note::
+            Previously this call returned a tuple of ``(key type, key
+            string)``. You can get the same effect by calling `.PKey.get_name`
+            for the key type, and ``str(key)`` for the key string.
+
+        :raises: `.SSHException` -- if no session is currently active.
+
+        :return: public key (`.PKey`) of the remote server
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            raise SSHException("No existing session")
+        return self.host_key
+
+    def is_active(self):
+        """
+        Return true if this session is active (open).
+
+        :return:
+            True if the session is still active (open); False if the session is
+            closed
+        """
+        return self.active
+
+    def open_session(
+        self, window_size=None, max_packet_size=None, timeout=None
+    ):
+        """
+        Request a new channel to the server, of type ``"session"``.  This is
+        just an alias for calling `open_channel` with an argument of
+        ``"session"``.
+
+        .. note:: Modifying the the window and packet sizes might have adverse
+            effects on the session created. The default values are the same
+            as in the OpenSSH code base and have been battle tested.
+
+        :param int window_size:
+            optional window size for this session.
+        :param int max_packet_size:
+            optional max packet size for this session.
+
+        :return: a new `.Channel`
+
+        :raises:
+            `.SSHException` -- if the request is rejected or the session ends
+            prematurely
+
+        .. versionchanged:: 1.13.4/1.14.3/1.15.3
+            Added the ``timeout`` argument.
+        .. versionchanged:: 1.15
+            Added the ``window_size`` and ``max_packet_size`` arguments.
+        """
+        return self.open_channel(
+            "session",
+            window_size=window_size,
+            max_packet_size=max_packet_size,
+            timeout=timeout,
+        )
+
+    def open_x11_channel(self, src_addr=None):
+        """
+        Request a new channel to the client, of type ``"x11"``.  This
+        is just an alias for ``open_channel('x11', src_addr=src_addr)``.
+
+        :param tuple src_addr:
+            the source address (``(str, int)``) of the x11 server (port is the
+            x11 port, ie. 6010)
+        :return: a new `.Channel`
+
+        :raises:
+            `.SSHException` -- if the request is rejected or the session ends
+            prematurely
+        """
+        return self.open_channel("x11", src_addr=src_addr)
+
+    def open_forward_agent_channel(self):
+        """
+        Request a new channel to the client, of type
+        ``"auth-agent@openssh.com"``.
+
+        This is just an alias for ``open_channel('auth-agent@openssh.com')``.
+
+        :return: a new `.Channel`
+
+        :raises: `.SSHException` --
+            if the request is rejected or the session ends prematurely
+        """
+        return self.open_channel("auth-agent@openssh.com")
+
+    def open_forwarded_tcpip_channel(self, src_addr, dest_addr):
+        """
+        Request a new channel back to the client, of type ``forwarded-tcpip``.
+
+        This is used after a client has requested port forwarding, for sending
+        incoming connections back to the client.
+
+        :param src_addr: originator's address
+        :param dest_addr: local (server) connected address
+        """
+        return self.open_channel("forwarded-tcpip", dest_addr, src_addr)
+
+    def open_channel(
+        self,
+        kind,
+        dest_addr=None,
+        src_addr=None,
+        window_size=None,
+        max_packet_size=None,
+        timeout=None,
+    ):
+        """
+        Request a new channel to the server. `Channels <.Channel>` are
+        socket-like objects used for the actual transfer of data across the
+        session. You may only request a channel after negotiating encryption
+        (using `connect` or `start_client`) and authenticating.
+
+        .. note:: Modifying the the window and packet sizes might have adverse
+            effects on the channel created. The default values are the same
+            as in the OpenSSH code base and have been battle tested.
+
+        :param str kind:
+            the kind of channel requested (usually ``"session"``,
+            ``"forwarded-tcpip"``, ``"direct-tcpip"``, or ``"x11"``)
+        :param tuple dest_addr:
+            the destination address (address + port tuple) of this port
+            forwarding, if ``kind`` is ``"forwarded-tcpip"`` or
+            ``"direct-tcpip"`` (ignored for other channel types)
+        :param src_addr: the source address of this port forwarding, if
+            ``kind`` is ``"forwarded-tcpip"``, ``"direct-tcpip"``, or ``"x11"``
+        :param int window_size:
+            optional window size for this session.
+        :param int max_packet_size:
+            optional max packet size for this session.
+        :param float timeout:
+            optional timeout opening a channel, default 3600s (1h)
+
+        :return: a new `.Channel` on success
+
+        :raises:
+            `.SSHException` -- if the request is rejected, the session ends
+            prematurely or there is a timeout opening a channel
+
+        .. versionchanged:: 1.15
+            Added the ``window_size`` and ``max_packet_size`` arguments.
+        """
+        if not self.active:
+            raise SSHException("SSH session not active")
+        timeout = self.channel_timeout if timeout is None else timeout
+        self.lock.acquire()
+        try:
+            window_size = self._sanitize_window_size(window_size)
+            max_packet_size = self._sanitize_packet_size(max_packet_size)
+            chanid = self._next_channel()
+            m = Message()
+            m.add_byte(cMSG_CHANNEL_OPEN)
+            m.add_string(kind)
+            m.add_int(chanid)
+            m.add_int(window_size)
+            m.add_int(max_packet_size)
+            if (kind == "forwarded-tcpip") or (kind == "direct-tcpip"):
+                m.add_string(dest_addr[0])
+                m.add_int(dest_addr[1])
+                m.add_string(src_addr[0])
+                m.add_int(src_addr[1])
+            elif kind == "x11":
+                m.add_string(src_addr[0])
+                m.add_int(src_addr[1])
+            chan = Channel(chanid)
+            self._channels.put(chanid, chan)
+            self.channel_events[chanid] = event = threading.Event()
+            self.channels_seen[chanid] = True
+            chan._set_transport(self)
+            chan._set_window(window_size, max_packet_size)
+        finally:
+            self.lock.release()
+        self._send_user_message(m)
+        start_ts = time.time()
+        while True:
+            event.wait(0.1)
+            if not self.active:
+                e = self.get_exception()
+                if e is None:
+                    e = SSHException("Unable to open channel.")
+                raise e
+            if event.is_set():
+                break
+            elif start_ts + timeout < time.time():
+                raise SSHException("Timeout opening channel.")
+        chan = self._channels.get(chanid)
+        if chan is not None:
+            return chan
+        e = self.get_exception()
+        if e is None:
+            e = SSHException("Unable to open channel.")
+        raise e
+
+    def request_port_forward(self, address, port, handler=None):
+        """
+        Ask the server to forward TCP connections from a listening port on
+        the server, across this SSH session.
+
+        If a handler is given, that handler is called from a different thread
+        whenever a forwarded connection arrives.  The handler parameters are::
+
+            handler(
+                channel,
+                (origin_addr, origin_port),
+                (server_addr, server_port),
+            )
+
+        where ``server_addr`` and ``server_port`` are the address and port that
+        the server was listening on.
+
+        If no handler is set, the default behavior is to send new incoming
+        forwarded connections into the accept queue, to be picked up via
+        `accept`.
+
+        :param str address: the address to bind when forwarding
+        :param int port:
+            the port to forward, or 0 to ask the server to allocate any port
+        :param callable handler:
+            optional handler for incoming forwarded connections, of the form
+            ``func(Channel, (str, int), (str, int))``.
+
+        :return: the port number (`int`) allocated by the server
+
+        :raises:
+            `.SSHException` -- if the server refused the TCP forward request
+        """
+        if not self.active:
+            raise SSHException("SSH session not active")
+        port = int(port)
+        response = self.global_request(
+            "tcpip-forward", (address, port), wait=True
+        )
+        if response is None:
+            raise SSHException("TCP forwarding request denied")
+        if port == 0:
+            port = response.get_int()
+        if handler is None:
+
+            def default_handler(channel, src_addr, dest_addr_port):
+                # src_addr, src_port = src_addr_port
+                # dest_addr, dest_port = dest_addr_port
+                self._queue_incoming_channel(channel)
+
+            handler = default_handler
+        self._tcp_handler = handler
+        return port
+
+    def cancel_port_forward(self, address, port):
+        """
+        Ask the server to cancel a previous port-forwarding request.  No more
+        connections to the given address & port will be forwarded across this
+        ssh connection.
+
+        :param str address: the address to stop forwarding
+        :param int port: the port to stop forwarding
+        """
+        if not self.active:
+            return
+        self._tcp_handler = None
+        self.global_request("cancel-tcpip-forward", (address, port), wait=True)
+
+    def open_sftp_client(self):
+        """
+        Create an SFTP client channel from an open transport.  On success, an
+        SFTP session will be opened with the remote host, and a new
+        `.SFTPClient` object will be returned.
+
+        :return:
+            a new `.SFTPClient` referring to an sftp session (channel) across
+            this transport
+        """
+        return SFTPClient.from_transport(self)
+
+    def send_ignore(self, byte_count=None):
+        """
+        Send a junk packet across the encrypted link.  This is sometimes used
+        to add "noise" to a connection to confuse would-be attackers.  It can
+        also be used as a keep-alive for long lived connections traversing
+        firewalls.
+
+        :param int byte_count:
+            the number of random bytes to send in the payload of the ignored
+            packet -- defaults to a random number from 10 to 41.
+        """
+        m = Message()
+        m.add_byte(cMSG_IGNORE)
+        if byte_count is None:
+            byte_count = (byte_ord(os.urandom(1)) % 32) + 10
+        m.add_bytes(os.urandom(byte_count))
+        self._send_user_message(m)
+
+    def renegotiate_keys(self):
+        """
+        Force this session to switch to new keys.  Normally this is done
+        automatically after the session hits a certain number of packets or
+        bytes sent or received, but this method gives you the option of forcing
+        new keys whenever you want.  Negotiating new keys causes a pause in
+        traffic both ways as the two sides swap keys and do computations.  This
+        method returns when the session has switched to new keys.
+
+        :raises:
+            `.SSHException` -- if the key renegotiation failed (which causes
+            the session to end)
+        """
+        self.completion_event = threading.Event()
+        self._send_kex_init()
+        while True:
+            self.completion_event.wait(0.1)
+            if not self.active:
+                e = self.get_exception()
+                if e is not None:
+                    raise e
+                raise SSHException("Negotiation failed.")
+            if self.completion_event.is_set():
+                break
+        return
+
+    def set_keepalive(self, interval):
+        """
+        Turn on/off keepalive packets (default is off).  If this is set, after
+        ``interval`` seconds without sending any data over the connection, a
+        "keepalive" packet will be sent (and ignored by the remote host).  This
+        can be useful to keep connections alive over a NAT, for example.
+
+        :param int interval:
+            seconds to wait before sending a keepalive packet (or
+            0 to disable keepalives).
+        """
+
+        def _request(x=weakref.proxy(self)):
+            return x.global_request("keepalive@lag.net", wait=False)
+
+        self.packetizer.set_keepalive(interval, _request)
+
+    def global_request(self, kind, data=None, wait=True):
+        """
+        Make a global request to the remote host.  These are normally
+        extensions to the SSH2 protocol.
+
+        :param str kind: name of the request.
+        :param tuple data:
+            an optional tuple containing additional data to attach to the
+            request.
+        :param bool wait:
+            ``True`` if this method should not return until a response is
+            received; ``False`` otherwise.
+        :return:
+            a `.Message` containing possible additional data if the request was
+            successful (or an empty `.Message` if ``wait`` was ``False``);
+            ``None`` if the request was denied.
+        """
+        if wait:
+            self.completion_event = threading.Event()
+        m = Message()
+        m.add_byte(cMSG_GLOBAL_REQUEST)
+        m.add_string(kind)
+        m.add_boolean(wait)
+        if data is not None:
+            m.add(*data)
+        self._log(DEBUG, 'Sending global request "{}"'.format(kind))
+        self._send_user_message(m)
+        if not wait:
+            return None
+        while True:
+            self.completion_event.wait(0.1)
+            if not self.active:
+                return None
+            if self.completion_event.is_set():
+                break
+        return self.global_response
+
+    def accept(self, timeout=None):
+        """
+        Return the next channel opened by the client over this transport, in
+        server mode.  If no channel is opened before the given timeout,
+        ``None`` is returned.
+
+        :param int timeout:
+            seconds to wait for a channel, or ``None`` to wait forever
+        :return: a new `.Channel` opened by the client
+        """
+        self.lock.acquire()
+        try:
+            if len(self.server_accepts) > 0:
+                chan = self.server_accepts.pop(0)
+            else:
+                self.server_accept_cv.wait(timeout)
+                if len(self.server_accepts) > 0:
+                    chan = self.server_accepts.pop(0)
+                else:
+                    # timeout
+                    chan = None
+        finally:
+            self.lock.release()
+        return chan
+
+    def connect(
+        self,
+        hostkey=None,
+        username="",
+        password=None,
+        pkey=None,
+        gss_host=None,
+        gss_auth=False,
+        gss_kex=False,
+        gss_deleg_creds=True,
+        gss_trust_dns=True,
+    ):
+        """
+        Negotiate an SSH2 session, and optionally verify the server's host key
+        and authenticate using a password or private key.  This is a shortcut
+        for `start_client`, `get_remote_server_key`, and
+        `Transport.auth_password` or `Transport.auth_publickey`.  Use those
+        methods if you want more control.
+
+        You can use this method immediately after creating a Transport to
+        negotiate encryption with a server.  If it fails, an exception will be
+        thrown.  On success, the method will return cleanly, and an encrypted
+        session exists.  You may immediately call `open_channel` or
+        `open_session` to get a `.Channel` object, which is used for data
+        transfer.
+
+        .. note::
+            If you fail to supply a password or private key, this method may
+            succeed, but a subsequent `open_channel` or `open_session` call may
+            fail because you haven't authenticated yet.
+
+        :param .PKey hostkey:
+            the host key expected from the server, or ``None`` if you don't
+            want to do host key verification.
+        :param str username: the username to authenticate as.
+        :param str password:
+            a password to use for authentication, if you want to use password
+            authentication; otherwise ``None``.
+        :param .PKey pkey:
+            a private key to use for authentication, if you want to use private
+            key authentication; otherwise ``None``.
+        :param str gss_host:
+            The target's name in the kerberos database. Default: hostname
+        :param bool gss_auth:
+            ``True`` if you want to use GSS-API authentication.
+        :param bool gss_kex:
+            Perform GSS-API Key Exchange and user authentication.
+        :param bool gss_deleg_creds:
+            Whether to delegate GSS-API client credentials.
+        :param gss_trust_dns:
+            Indicates whether or not the DNS is trusted to securely
+            canonicalize the name of the host being connected to (default
+            ``True``).
+
+        :raises: `.SSHException` -- if the SSH2 negotiation fails, the host key
+            supplied by the server is incorrect, or authentication fails.
+
+        .. versionchanged:: 2.3
+            Added the ``gss_trust_dns`` argument.
+        """
+        if hostkey is not None:
+            # TODO: a more robust implementation would be to ask each key class
+            # for its nameS plural, and just use that.
+            # TODO: that could be used in a bunch of other spots too
+            if isinstance(hostkey, RSAKey):
+                self._preferred_keys = [
+                    "rsa-sha2-512",
+                    "rsa-sha2-256",
+                    "ssh-rsa",
+                ]
+            else:
+                self._preferred_keys = [hostkey.get_name()]
+
+        self.set_gss_host(
+            gss_host=gss_host,
+            trust_dns=gss_trust_dns,
+            gssapi_requested=gss_kex or gss_auth,
+        )
+
+        self.start_client()
+
+        # check host key if we were given one
+        # If GSS-API Key Exchange was performed, we are not required to check
+        # the host key.
+        if (hostkey is not None) and not gss_kex:
+            key = self.get_remote_server_key()
+            if (
+                key.get_name() != hostkey.get_name()
+                or key.asbytes() != hostkey.asbytes()
+            ):
+                self._log(DEBUG, "Bad host key from server")
+                self._log(
+                    DEBUG,
+                    "Expected: {}: {}".format(
+                        hostkey.get_name(), repr(hostkey.asbytes())
+                    ),
+                )
+                self._log(
+                    DEBUG,
+                    "Got     : {}: {}".format(
+                        key.get_name(), repr(key.asbytes())
+                    ),
+                )
+                raise SSHException("Bad host key from server")
+            self._log(
+                DEBUG, "Host key verified ({})".format(hostkey.get_name())
+            )
+
+        if (pkey is not None) or (password is not None) or gss_auth or gss_kex:
+            if gss_auth:
+                self._log(
+                    DEBUG, "Attempting GSS-API auth... (gssapi-with-mic)"
+                )  # noqa
+                self.auth_gssapi_with_mic(
+                    username, self.gss_host, gss_deleg_creds
+                )
+            elif gss_kex:
+                self._log(DEBUG, "Attempting GSS-API auth... (gssapi-keyex)")
+                self.auth_gssapi_keyex(username)
+            elif pkey is not None:
+                self._log(DEBUG, "Attempting public-key auth...")
+                self.auth_publickey(username, pkey)
+            else:
+                self._log(DEBUG, "Attempting password auth...")
+                self.auth_password(username, password)
+
+        return
+
+    def get_exception(self):
+        """
+        Return any exception that happened during the last server request.
+        This can be used to fetch more specific error information after using
+        calls like `start_client`.  The exception (if any) is cleared after
+        this call.
+
+        :return:
+            an exception, or ``None`` if there is no stored exception.
+
+        .. versionadded:: 1.1
+        """
+        self.lock.acquire()
+        try:
+            e = self.saved_exception
+            self.saved_exception = None
+            return e
+        finally:
+            self.lock.release()
+
+    def set_subsystem_handler(self, name, handler, *args, **kwargs):
+        """
+        Set the handler class for a subsystem in server mode.  If a request
+        for this subsystem is made on an open ssh channel later, this handler
+        will be constructed and called -- see `.SubsystemHandler` for more
+        detailed documentation.
+
+        Any extra parameters (including keyword arguments) are saved and
+        passed to the `.SubsystemHandler` constructor later.
+
+        :param str name: name of the subsystem.
+        :param handler:
+            subclass of `.SubsystemHandler` that handles this subsystem.
+        """
+        try:
+            self.lock.acquire()
+            self.subsystem_table[name] = (handler, args, kwargs)
+        finally:
+            self.lock.release()
+
+    def is_authenticated(self):
+        """
+        Return true if this session is active and authenticated.
+
+        :return:
+            True if the session is still open and has been authenticated
+            successfully; False if authentication failed and/or the session is
+            closed.
+        """
+        return (
+            self.active
+            and self.auth_handler is not None
+            and self.auth_handler.is_authenticated()
+        )
+
+    def get_username(self):
+        """
+        Return the username this connection is authenticated for.  If the
+        session is not authenticated (or authentication failed), this method
+        returns ``None``.
+
+        :return: username that was authenticated (a `str`), or ``None``.
+        """
+        if not self.active or (self.auth_handler is None):
+            return None
+        return self.auth_handler.get_username()
+
+    def get_banner(self):
+        """
+        Return the banner supplied by the server upon connect. If no banner is
+        supplied, this method returns ``None``.
+
+        :returns: server supplied banner (`str`), or ``None``.
+
+        .. versionadded:: 1.13
+        """
+        if not self.active or (self.auth_handler is None):
+            return None
+        return self.auth_handler.banner
+
+    def auth_none(self, username):
+        """
+        Try to authenticate to the server using no authentication at all.
+        This will almost always fail.  It may be useful for determining the
+        list of authentication types supported by the server, by catching the
+        `.BadAuthenticationType` exception raised.
+
+        :param str username: the username to authenticate as
+        :return:
+            list of auth types permissible for the next stage of
+            authentication (normally empty)
+
+        :raises:
+            `.BadAuthenticationType` -- if "none" authentication isn't allowed
+            by the server for this user
+        :raises:
+            `.SSHException` -- if the authentication failed due to a network
+            error
+
+        .. versionadded:: 1.5
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            raise SSHException("No existing session")
+        my_event = threading.Event()
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_none(username, my_event)
+        return self.auth_handler.wait_for_response(my_event)
+
+    def auth_password(self, username, password, event=None, fallback=True):
+        """
+        Authenticate to the server using a password.  The username and password
+        are sent over an encrypted link.
+
+        If an ``event`` is passed in, this method will return immediately, and
+        the event will be triggered once authentication succeeds or fails.  On
+        success, `is_authenticated` will return ``True``.  On failure, you may
+        use `get_exception` to get more detailed error information.
+
+        Since 1.1, if no event is passed, this method will block until the
+        authentication succeeds or fails.  On failure, an exception is raised.
+        Otherwise, the method simply returns.
+
+        Since 1.5, if no event is passed and ``fallback`` is ``True`` (the
+        default), if the server doesn't support plain password authentication
+        but does support so-called "keyboard-interactive" mode, an attempt
+        will be made to authenticate using this interactive mode.  If it fails,
+        the normal exception will be thrown as if the attempt had never been
+        made.  This is useful for some recent Gentoo and Debian distributions,
+        which turn off plain password authentication in a misguided belief
+        that interactive authentication is "more secure".  (It's not.)
+
+        If the server requires multi-step authentication (which is very rare),
+        this method will return a list of auth types permissible for the next
+        step.  Otherwise, in the normal case, an empty list is returned.
+
+        :param str username: the username to authenticate as
+        :param basestring password: the password to authenticate with
+        :param .threading.Event event:
+            an event to trigger when the authentication attempt is complete
+            (whether it was successful or not)
+        :param bool fallback:
+            ``True`` if an attempt at an automated "interactive" password auth
+            should be made if the server doesn't support normal password auth
+        :return:
+            list of auth types permissible for the next stage of
+            authentication (normally empty)
+
+        :raises:
+            `.BadAuthenticationType` -- if password authentication isn't
+            allowed by the server for this user (and no event was passed in)
+        :raises:
+            `.AuthenticationException` -- if the authentication failed (and no
+            event was passed in)
+        :raises: `.SSHException` -- if there was a network error
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            # we should never try to send the password unless we're on a secure
+            # link
+            raise SSHException("No existing session")
+        if event is None:
+            my_event = threading.Event()
+        else:
+            my_event = event
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_password(username, password, my_event)
+        if event is not None:
+            # caller wants to wait for event themselves
+            return []
+        try:
+            return self.auth_handler.wait_for_response(my_event)
+        except BadAuthenticationType as e:
+            # if password auth isn't allowed, but keyboard-interactive *is*,
+            # try to fudge it
+            if not fallback or ("keyboard-interactive" not in e.allowed_types):
+                raise
+            try:
+
+                def handler(title, instructions, fields):
+                    if len(fields) > 1:
+                        raise SSHException("Fallback authentication failed.")
+                    if len(fields) == 0:
+                        # for some reason, at least on os x, a 2nd request will
+                        # be made with zero fields requested.  maybe it's just
+                        # to try to fake out automated scripting of the exact
+                        # type we're doing here.  *shrug* :)
+                        return []
+                    return [password]
+
+                return self.auth_interactive(username, handler)
+            except SSHException:
+                # attempt failed; just raise the original exception
+                raise e
+
+    def auth_publickey(self, username, key, event=None):
+        """
+        Authenticate to the server using a private key.  The key is used to
+        sign data from the server, so it must include the private part.
+
+        If an ``event`` is passed in, this method will return immediately, and
+        the event will be triggered once authentication succeeds or fails.  On
+        success, `is_authenticated` will return ``True``.  On failure, you may
+        use `get_exception` to get more detailed error information.
+
+        Since 1.1, if no event is passed, this method will block until the
+        authentication succeeds or fails.  On failure, an exception is raised.
+        Otherwise, the method simply returns.
+
+        If the server requires multi-step authentication (which is very rare),
+        this method will return a list of auth types permissible for the next
+        step.  Otherwise, in the normal case, an empty list is returned.
+
+        :param str username: the username to authenticate as
+        :param .PKey key: the private key to authenticate with
+        :param .threading.Event event:
+            an event to trigger when the authentication attempt is complete
+            (whether it was successful or not)
+        :return:
+            list of auth types permissible for the next stage of
+            authentication (normally empty)
+
+        :raises:
+            `.BadAuthenticationType` -- if public-key authentication isn't
+            allowed by the server for this user (and no event was passed in)
+        :raises:
+            `.AuthenticationException` -- if the authentication failed (and no
+            event was passed in)
+        :raises: `.SSHException` -- if there was a network error
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            # we should never try to authenticate unless we're on a secure link
+            raise SSHException("No existing session")
+        if event is None:
+            my_event = threading.Event()
+        else:
+            my_event = event
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_publickey(username, key, my_event)
+        if event is not None:
+            # caller wants to wait for event themselves
+            return []
+        return self.auth_handler.wait_for_response(my_event)
+
+    def auth_interactive(self, username, handler, submethods=""):
+        """
+        Authenticate to the server interactively.  A handler is used to answer
+        arbitrary questions from the server.  On many servers, this is just a
+        dumb wrapper around PAM.
+
+        This method will block until the authentication succeeds or fails,
+        periodically calling the handler asynchronously to get answers to
+        authentication questions.  The handler may be called more than once
+        if the server continues to ask questions.
+
+        The handler is expected to be a callable that will handle calls of the
+        form: ``handler(title, instructions, prompt_list)``.  The ``title`` is
+        meant to be a dialog-window title, and the ``instructions`` are user
+        instructions (both are strings).  ``prompt_list`` will be a list of
+        prompts, each prompt being a tuple of ``(str, bool)``.  The string is
+        the prompt and the boolean indicates whether the user text should be
+        echoed.
+
+        A sample call would thus be:
+        ``handler('title', 'instructions', [('Password:', False)])``.
+
+        The handler should return a list or tuple of answers to the server's
+        questions.
+
+        If the server requires multi-step authentication (which is very rare),
+        this method will return a list of auth types permissible for the next
+        step.  Otherwise, in the normal case, an empty list is returned.
+
+        :param str username: the username to authenticate as
+        :param callable handler: a handler for responding to server questions
+        :param str submethods: a string list of desired submethods (optional)
+        :return:
+            list of auth types permissible for the next stage of
+            authentication (normally empty).
+
+        :raises: `.BadAuthenticationType` -- if public-key authentication isn't
+            allowed by the server for this user
+        :raises: `.AuthenticationException` -- if the authentication failed
+        :raises: `.SSHException` -- if there was a network error
+
+        .. versionadded:: 1.5
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            # we should never try to authenticate unless we're on a secure link
+            raise SSHException("No existing session")
+        my_event = threading.Event()
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_interactive(
+            username, handler, my_event, submethods
+        )
+        return self.auth_handler.wait_for_response(my_event)
+
+    def auth_interactive_dumb(self, username, handler=None, submethods=""):
+        """
+        Authenticate to the server interactively but dumber.
+        Just print the prompt and / or instructions to stdout and send back
+        the response. This is good for situations where partial auth is
+        achieved by key and then the user has to enter a 2fac token.
+        """
+
+        if not handler:
+
+            def handler(title, instructions, prompt_list):
+                answers = []
+                if title:
+                    print(title.strip())
+                if instructions:
+                    print(instructions.strip())
+                for prompt, show_input in prompt_list:
+                    print(prompt.strip(), end=" ")
+                    answers.append(input())
+                return answers
+
+        return self.auth_interactive(username, handler, submethods)
+
+    def auth_gssapi_with_mic(self, username, gss_host, gss_deleg_creds):
+        """
+        Authenticate to the Server using GSS-API / SSPI.
+
+        :param str username: The username to authenticate as
+        :param str gss_host: The target host
+        :param bool gss_deleg_creds: Delegate credentials or not
+        :return: list of auth types permissible for the next stage of
+                 authentication (normally empty)
+        :raises: `.BadAuthenticationType` -- if gssapi-with-mic isn't
+            allowed by the server (and no event was passed in)
+        :raises:
+            `.AuthenticationException` -- if the authentication failed (and no
+            event was passed in)
+        :raises: `.SSHException` -- if there was a network error
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            # we should never try to authenticate unless we're on a secure link
+            raise SSHException("No existing session")
+        my_event = threading.Event()
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_gssapi_with_mic(
+            username, gss_host, gss_deleg_creds, my_event
+        )
+        return self.auth_handler.wait_for_response(my_event)
+
+    def auth_gssapi_keyex(self, username):
+        """
+        Authenticate to the server with GSS-API/SSPI if GSS-API kex is in use.
+
+        :param str username: The username to authenticate as.
+        :returns:
+            a list of auth types permissible for the next stage of
+            authentication (normally empty)
+        :raises: `.BadAuthenticationType` --
+            if GSS-API Key Exchange was not performed (and no event was passed
+            in)
+        :raises: `.AuthenticationException` --
+            if the authentication failed (and no event was passed in)
+        :raises: `.SSHException` -- if there was a network error
+        """
+        if (not self.active) or (not self.initial_kex_done):
+            # we should never try to authenticate unless we're on a secure link
+            raise SSHException("No existing session")
+        my_event = threading.Event()
+        self.auth_handler = AuthHandler(self)
+        self.auth_handler.auth_gssapi_keyex(username, my_event)
+        return self.auth_handler.wait_for_response(my_event)
+
+    def set_log_channel(self, name):
+        """
+        Set the channel for this transport's logging.  The default is
+        ``"paramiko.transport"`` but it can be set to anything you want. (See
+        the `.logging` module for more info.)  SSH Channels will log to a
+        sub-channel of the one specified.
+
+        :param str name: new channel name for logging
+
+        .. versionadded:: 1.1
+        """
+        self.log_name = name
+        self.logger = util.get_logger(name)
+        self.packetizer.set_log(self.logger)
+
+    def get_log_channel(self):
+        """
+        Return the channel name used for this transport's logging.
+
+        :return: channel name as a `str`
+
+        .. versionadded:: 1.2
+        """
+        return self.log_name
+
+    def set_hexdump(self, hexdump):
+        """
+        Turn on/off logging a hex dump of protocol traffic at DEBUG level in
+        the logs.  Normally you would want this off (which is the default),
+        but if you are debugging something, it may be useful.
+
+        :param bool hexdump:
+            ``True`` to log protocol traffix (in hex) to the log; ``False``
+            otherwise.
+        """
+        self.packetizer.set_hexdump(hexdump)
+
+    def get_hexdump(self):
+        """
+        Return ``True`` if the transport is currently logging hex dumps of
+        protocol traffic.
+
+        :return: ``True`` if hex dumps are being logged, else ``False``.
+
+        .. versionadded:: 1.4
+        """
+        return self.packetizer.get_hexdump()
+
+    def use_compression(self, compress=True):
+        """
+        Turn on/off compression.  This will only have an affect before starting
+        the transport (ie before calling `connect`, etc).  By default,
+        compression is off since it negatively affects interactive sessions.
+
+        :param bool compress:
+            ``True`` to ask the remote client/server to compress traffic;
+            ``False`` to refuse compression
+
+        .. versionadded:: 1.5.2
+        """
+        if compress:
+            self._preferred_compression = ("zlib@openssh.com", "zlib", "none")
+        else:
+            self._preferred_compression = ("none",)
+
+    def getpeername(self):
+        """
+        Return the address of the remote side of this Transport, if possible.
+
+        This is effectively a wrapper around ``getpeername`` on the underlying
+        socket.  If the socket-like object has no ``getpeername`` method, then
+        ``("unknown", 0)`` is returned.
+
+        :return:
+            the address of the remote host, if known, as a ``(str, int)``
+            tuple.
+        """
+        gp = getattr(self.sock, "getpeername", None)
+        if gp is None:
+            return "unknown", 0
+        return gp()
+
+    def stop_thread(self):
+        self.active = False
+        self.packetizer.close()
+        # Keep trying to join() our main thread, quickly, until:
+        # * We join()ed successfully (self.is_alive() == False)
+        # * Or it looks like we've hit issue #520 (socket.recv hitting some
+        # race condition preventing it from timing out correctly), wherein
+        # our socket and packetizer are both closed (but where we'd
+        # otherwise be sitting forever on that recv()).
+        while (
+            self.is_alive()
+            and self is not threading.current_thread()
+            and not self.sock._closed
+            and not self.packetizer.closed
+        ):
+            self.join(0.1)
+
+    # internals...
+
+    # TODO 4.0: make a public alias for this because multiple other classes
+    # already explicitly rely on it...or just rewrite logging :D
+    def _log(self, level, msg, *args):
+        if issubclass(type(msg), list):
+            for m in msg:
+                self.logger.log(level, m)
+        else:
+            self.logger.log(level, msg, *args)
+
+    def _get_modulus_pack(self):
+        """used by KexGex to find primes for group exchange"""
+        return self._modulus_pack
+
+    def _next_channel(self):
+        """you are holding the lock"""
+        chanid = self._channel_counter
+        while self._channels.get(chanid) is not None:
+            self._channel_counter = (self._channel_counter + 1) & 0xFFFFFF
+            chanid = self._channel_counter
+        self._channel_counter = (self._channel_counter + 1) & 0xFFFFFF
+        return chanid
+
+    def _unlink_channel(self, chanid):
+        """used by a Channel to remove itself from the active channel list"""
+        self._channels.delete(chanid)
+
+    def _send_message(self, data):
+        self.packetizer.send_message(data)
+
+    def _send_user_message(self, data):
+        """
+        send a message, but block if we're in key negotiation.  this is used
+        for user-initiated requests.
+        """
+        start = time.time()
+        while True:
+            self.clear_to_send.wait(0.1)
+            if not self.active:
+                self._log(
+                    DEBUG, "Dropping user packet because connection is dead."
+                )  # noqa
+                return
+            self.clear_to_send_lock.acquire()
+            if self.clear_to_send.is_set():
+                break
+            self.clear_to_send_lock.release()
+            if time.time() > start + self.clear_to_send_timeout:
+                raise SSHException(
+                    "Key-exchange timed out waiting for key negotiation"
+                )  # noqa
+        try:
+            self._send_message(data)
+        finally:
+            self.clear_to_send_lock.release()
+
+    def _set_K_H(self, k, h):
+        """
+        Used by a kex obj to set the K (root key) and H (exchange hash).
+        """
+        self.K = k
+        self.H = h
+        if self.session_id is None:
+            self.session_id = h
+
+    def _expect_packet(self, *ptypes):
+        """
+        Used by a kex obj to register the next packet type it expects to see.
+        """
+        self._expected_packet = tuple(ptypes)
+
+    def _verify_key(self, host_key, sig):
+        key = self._key_info[self.host_key_type](Message(host_key))
+        if key is None:
+            raise SSHException("Unknown host key type")
+        if not key.verify_ssh_sig(self.H, Message(sig)):
+            raise SSHException(
+                "Signature verification ({}) failed.".format(
+                    self.host_key_type
+                )
+            )  # noqa
+        self.host_key = key
+
+    def _compute_key(self, id, nbytes):
+        """id is 'A' - 'F' for the various keys used by ssh"""
+        m = Message()
+        m.add_mpint(self.K)
+        m.add_bytes(self.H)
+        m.add_byte(b(id))
+        m.add_bytes(self.session_id)
+        # Fallback to SHA1 for kex engines that fail to specify a hex
+        # algorithm, or for e.g. transport tests that don't run kexinit.
+        hash_algo = getattr(self.kex_engine, "hash_algo", None)
+        hash_select_msg = "kex engine {} specified hash_algo {!r}".format(
+            self.kex_engine.__class__.__name__, hash_algo
+        )
+        if hash_algo is None:
+            hash_algo = sha1
+            hash_select_msg += ", falling back to sha1"
+        if not hasattr(self, "_logged_hash_selection"):
+            self._log(DEBUG, hash_select_msg)
+            setattr(self, "_logged_hash_selection", True)
+        out = sofar = hash_algo(m.asbytes()).digest()
+        while len(out) < nbytes:
+            m = Message()
+            m.add_mpint(self.K)
+            m.add_bytes(self.H)
+            m.add_bytes(sofar)
+            digest = hash_algo(m.asbytes()).digest()
+            out += digest
+            sofar += digest
+        return out[:nbytes]
+
+    def _get_cipher(self, name, key, iv, operation):
+        if name not in self._cipher_info:
+            raise SSHException("Unknown client cipher " + name)
+        else:
+            cipher = Cipher(
+                self._cipher_info[name]["class"](key),
+                self._cipher_info[name]["mode"](iv),
+                backend=default_backend(),
+            )
+            if operation is self._ENCRYPT:
+                return cipher.encryptor()
+            else:
+                return cipher.decryptor()
+
+    def _set_forward_agent_handler(self, handler):
+        if handler is None:
+
+            def default_handler(channel):
+                self._queue_incoming_channel(channel)
+
+            self._forward_agent_handler = default_handler
+        else:
+            self._forward_agent_handler = handler
+
+    def _set_x11_handler(self, handler):
+        # only called if a channel has turned on x11 forwarding
+        if handler is None:
+            # by default, use the same mechanism as accept()
+            def default_handler(channel, src_addr_port):
+                self._queue_incoming_channel(channel)
+
+            self._x11_handler = default_handler
+        else:
+            self._x11_handler = handler
+
+    def _queue_incoming_channel(self, channel):
+        self.lock.acquire()
+        try:
+            self.server_accepts.append(channel)
+            self.server_accept_cv.notify()
+        finally:
+            self.lock.release()
+
+    def _sanitize_window_size(self, window_size):
+        if window_size is None:
+            window_size = self.default_window_size
+        return clamp_value(MIN_WINDOW_SIZE, window_size, MAX_WINDOW_SIZE)
+
+    def _sanitize_packet_size(self, max_packet_size):
+        if max_packet_size is None:
+            max_packet_size = self.default_max_packet_size
+        return clamp_value(MIN_PACKET_SIZE, max_packet_size, MAX_WINDOW_SIZE)
+
+    def _ensure_authed(self, ptype, message):
+        """
+        Checks message type against current auth state.
+
+        If server mode, and auth has not succeeded, and the message is of a
+        post-auth type (channel open or global request) an appropriate error
+        response Message is crafted and returned to caller for sending.
+
+        Otherwise (client mode, authed, or pre-auth message) returns None.
+        """
+        if (
+            not self.server_mode
+            or ptype <= HIGHEST_USERAUTH_MESSAGE_ID
+            or self.is_authenticated()
+        ):
+            return None
+        # WELP. We must be dealing with someone trying to do non-auth things
+        # without being authed. Tell them off, based on message class.
+        reply = Message()
+        # Global requests have no details, just failure.
+        if ptype == MSG_GLOBAL_REQUEST:
+            reply.add_byte(cMSG_REQUEST_FAILURE)
+        # Channel opens let us reject w/ a specific type + message.
+        elif ptype == MSG_CHANNEL_OPEN:
+            kind = message.get_text()  # noqa
+            chanid = message.get_int()
+            reply.add_byte(cMSG_CHANNEL_OPEN_FAILURE)
+            reply.add_int(chanid)
+            reply.add_int(OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED)
+            reply.add_string("")
+            reply.add_string("en")
+        # NOTE: Post-open channel messages do not need checking; the above will
+        # reject attempts to open channels, meaning that even if a malicious
+        # user tries to send a MSG_CHANNEL_REQUEST, it will simply fall under
+        # the logic that handles unknown channel IDs (as the channel list will
+        # be empty.)
+        return reply
+
+    def run(self):
+        # (use the exposed "run" method, because if we specify a thread target
+        # of a private method, threading.Thread will keep a reference to it
+        # indefinitely, creating a GC cycle and not letting Transport ever be
+        # GC'd. it's a bug in Thread.)
+
+        # Hold reference to 'sys' so we can test sys.modules to detect
+        # interpreter shutdown.
+        self.sys = sys
+
+        # active=True occurs before the thread is launched, to avoid a race
+        _active_threads.append(self)
+        tid = hex(id(self) & xffffffff)
+        if self.server_mode:
+            self._log(DEBUG, "starting thread (server mode): {}".format(tid))
+        else:
+            self._log(DEBUG, "starting thread (client mode): {}".format(tid))
+        try:
+            try:
+                self.packetizer.write_all(b(self.local_version + "\r\n"))
+                self._log(
+                    DEBUG,
+                    "Local version/idstring: {}".format(self.local_version),
+                )  # noqa
+                self._check_banner()
+                # The above is actually very much part of the handshake, but
+                # sometimes the banner can be read but the machine is not
+                # responding, for example when the remote ssh daemon is loaded
+                # in to memory but we can not read from the disk/spawn a new
+                # shell.
+                # Make sure we can specify a timeout for the initial handshake.
+                # Re-use the banner timeout for now.
+                self.packetizer.start_handshake(self.handshake_timeout)
+                self._send_kex_init()
+                self._expect_packet(MSG_KEXINIT)
+
+                while self.active:
+                    if self.packetizer.need_rekey() and not self.in_kex:
+                        self._send_kex_init()
+                    try:
+                        ptype, m = self.packetizer.read_message()
+                    except NeedRekeyException:
+                        continue
+                    if ptype == MSG_IGNORE:
+                        continue
+                    elif ptype == MSG_DISCONNECT:
+                        self._parse_disconnect(m)
+                        break
+                    elif ptype == MSG_DEBUG:
+                        self._parse_debug(m)
+                        continue
+                    if len(self._expected_packet) > 0:
+                        if ptype not in self._expected_packet:
+                            raise SSHException(
+                                "Expecting packet from {!r}, got {:d}".format(
+                                    self._expected_packet, ptype
+                                )
+                            )  # noqa
+                        self._expected_packet = tuple()
+                        # These message IDs indicate key exchange & will differ
+                        # depending on exact exchange algorithm
+                        if (ptype >= 30) and (ptype <= 41):
+                            self.kex_engine.parse_next(ptype, m)
+                            continue
+
+                    if ptype in self._handler_table:
+                        error_msg = self._ensure_authed(ptype, m)
+                        if error_msg:
+                            self._send_message(error_msg)
+                        else:
+                            self._handler_table[ptype](m)
+                    elif ptype in self._channel_handler_table:
+                        chanid = m.get_int()
+                        chan = self._channels.get(chanid)
+                        if chan is not None:
+                            self._channel_handler_table[ptype](chan, m)
+                        elif chanid in self.channels_seen:
+                            self._log(
+                                DEBUG,
+                                "Ignoring message for dead channel {:d}".format(  # noqa
+                                    chanid
+                                ),
+                            )
+                        else:
+                            self._log(
+                                ERROR,
+                                "Channel request for unknown channel {:d}".format(  # noqa
+                                    chanid
+                                ),
+                            )
+                            break
+                    elif (
+                        self.auth_handler is not None
+                        and ptype in self.auth_handler._handler_table
+                    ):
+                        handler = self.auth_handler._handler_table[ptype]
+                        handler(m)
+                        if len(self._expected_packet) > 0:
+                            continue
+                    else:
+                        # Respond with "I don't implement this particular
+                        # message type" message (unless the message type was
+                        # itself literally MSG_UNIMPLEMENTED, in which case, we
+                        # just shut up to avoid causing a useless loop).
+                        name = MSG_NAMES[ptype]
+                        warning = "Oops, unhandled type {} ({!r})".format(
+                            ptype, name
+                        )
+                        self._log(WARNING, warning)
+                        if ptype != MSG_UNIMPLEMENTED:
+                            msg = Message()
+                            msg.add_byte(cMSG_UNIMPLEMENTED)
+                            msg.add_int(m.seqno)
+                            self._send_message(msg)
+                    self.packetizer.complete_handshake()
+            except SSHException as e:
+                self._log(
+                    ERROR,
+                    "Exception ({}): {}".format(
+                        "server" if self.server_mode else "client", e
+                    ),
+                )
+                self._log(ERROR, util.tb_strings())
+                self.saved_exception = e
+            except EOFError as e:
+                self._log(DEBUG, "EOF in transport thread")
+                self.saved_exception = e
+            except socket.error as e:
+                if type(e.args) is tuple:
+                    if e.args:
+                        emsg = "{} ({:d})".format(e.args[1], e.args[0])
+                    else:  # empty tuple, e.g. socket.timeout
+                        emsg = str(e) or repr(e)
+                else:
+                    emsg = e.args
+                self._log(ERROR, "Socket exception: " + emsg)
+                self.saved_exception = e
+            except Exception as e:
+                self._log(ERROR, "Unknown exception: " + str(e))
+                self._log(ERROR, util.tb_strings())
+                self.saved_exception = e
+            _active_threads.remove(self)
+            for chan in list(self._channels.values()):
+                chan._unlink()
+            if self.active:
+                self.active = False
+                self.packetizer.close()
+                if self.completion_event is not None:
+                    self.completion_event.set()
+                if self.auth_handler is not None:
+                    self.auth_handler.abort()
+                for event in self.channel_events.values():
+                    event.set()
+                try:
+                    self.lock.acquire()
+                    self.server_accept_cv.notify()
+                finally:
+                    self.lock.release()
+            self.sock.close()
+        except:
+            # Don't raise spurious 'NoneType has no attribute X' errors when we
+            # wake up during interpreter shutdown. Or rather -- raise
+            # everything *if* sys.modules (used as a convenient sentinel)
+            # appears to still exist.
+            if self.sys.modules is not None:
+                raise
+
+    def _log_agreement(self, which, local, remote):
+        # Log useful, non-duplicative line re: an agreed-upon algorithm.
+        # Old code implied algorithms could be asymmetrical (different for
+        # inbound vs outbound) so we preserve that possibility.
+        msg = "{}: ".format(which)
+        if local == remote:
+            msg += local
+        else:
+            msg += "local={}, remote={}".format(local, remote)
+        self._log(DEBUG, msg)
+
+    # protocol stages
+
+    def _negotiate_keys(self, m):
+        # throws SSHException on anything unusual
+        self.clear_to_send_lock.acquire()
+        try:
+            self.clear_to_send.clear()
+        finally:
+            self.clear_to_send_lock.release()
+        if self.local_kex_init is None:
+            # remote side wants to renegotiate
+            self._send_kex_init()
+        self._parse_kex_init(m)
+        self.kex_engine.start_kex()
+
+    def _check_banner(self):
+        # this is slow, but we only have to do it once
+        for i in range(100):
+            # give them 15 seconds for the first line, then just 2 seconds
+            # each additional line.  (some sites have very high latency.)
+            if i == 0:
+                timeout = self.banner_timeout
+            else:
+                timeout = 2
+            try:
+                buf = self.packetizer.readline(timeout)
+            except ProxyCommandFailure:
+                raise
+            except Exception as e:
+                raise SSHException(
+                    "Error reading SSH protocol banner" + str(e)
+                )
+            if buf[:4] == "SSH-":
+                break
+            self._log(DEBUG, "Banner: " + buf)
+        if buf[:4] != "SSH-":
+            raise SSHException('Indecipherable protocol version "' + buf + '"')
+        # save this server version string for later
+        self.remote_version = buf
+        self._log(DEBUG, "Remote version/idstring: {}".format(buf))
+        # pull off any attached comment
+        # NOTE: comment used to be stored in a variable and then...never used.
+        # since 2003. ca 877cd974b8182d26fa76d566072917ea67b64e67
+        i = buf.find(" ")
+        if i >= 0:
+            buf = buf[:i]
+        # parse out version string and make sure it matches
+        segs = buf.split("-", 2)
+        if len(segs) < 3:
+            raise SSHException("Invalid SSH banner")
+        version = segs[1]
+        client = segs[2]
+        if version != "1.99" and version != "2.0":
+            msg = "Incompatible version ({} instead of 2.0)"
+            raise IncompatiblePeer(msg.format(version))
+        msg = "Connected (version {}, client {})".format(version, client)
+        self._log(INFO, msg)
+
+    def _send_kex_init(self):
+        """
+        announce to the other side that we'd like to negotiate keys, and what
+        kind of key negotiation we support.
+        """
+        self.clear_to_send_lock.acquire()
+        try:
+            self.clear_to_send.clear()
+        finally:
+            self.clear_to_send_lock.release()
+        self.gss_kex_used = False
+        self.in_kex = True
+        kex_algos = list(self.preferred_kex)
+        if self.server_mode:
+            mp_required_prefix = "diffie-hellman-group-exchange-sha"
+            kex_mp = [k for k in kex_algos if k.startswith(mp_required_prefix)]
+            if (self._modulus_pack is None) and (len(kex_mp) > 0):
+                # can't do group-exchange if we don't have a pack of potential
+                # primes
+                pkex = [
+                    k
+                    for k in self.get_security_options().kex
+                    if not k.startswith(mp_required_prefix)
+                ]
+                self.get_security_options().kex = pkex
+            available_server_keys = list(
+                filter(
+                    list(self.server_key_dict.keys()).__contains__,
+                    # TODO: ensure tests will catch if somebody streamlines
+                    # this by mistake - case is the admittedly silly one where
+                    # the only calls to add_server_key() contain keys which
+                    # were filtered out of the below via disabled_algorithms.
+                    # If this is streamlined, we would then be allowing the
+                    # disabled algorithm(s) for hostkey use
+                    # TODO: honestly this prob just wants to get thrown out
+                    # when we make kex configuration more straightforward
+                    self.preferred_keys,
+                )
+            )
+        else:
+            available_server_keys = self.preferred_keys
+            # Signal support for MSG_EXT_INFO.
+            # NOTE: doing this here handily means we don't even consider this
+            # value when agreeing on real kex algo to use (which is a common
+            # pitfall when adding this apparently).
+            kex_algos.append("ext-info-c")
+
+        m = Message()
+        m.add_byte(cMSG_KEXINIT)
+        m.add_bytes(os.urandom(16))
+        m.add_list(kex_algos)
+        m.add_list(available_server_keys)
+        m.add_list(self.preferred_ciphers)
+        m.add_list(self.preferred_ciphers)
+        m.add_list(self.preferred_macs)
+        m.add_list(self.preferred_macs)
+        m.add_list(self.preferred_compression)
+        m.add_list(self.preferred_compression)
+        m.add_string(bytes())
+        m.add_string(bytes())
+        m.add_boolean(False)
+        m.add_int(0)
+        # save a copy for later (needed to compute a hash)
+        self.local_kex_init = self._latest_kex_init = m.asbytes()
+        self._send_message(m)
+
+    def _really_parse_kex_init(self, m, ignore_first_byte=False):
+        parsed = {}
+        if ignore_first_byte:
+            m.get_byte()
+        m.get_bytes(16)  # cookie, discarded
+        parsed["kex_algo_list"] = m.get_list()
+        parsed["server_key_algo_list"] = m.get_list()
+        parsed["client_encrypt_algo_list"] = m.get_list()
+        parsed["server_encrypt_algo_list"] = m.get_list()
+        parsed["client_mac_algo_list"] = m.get_list()
+        parsed["server_mac_algo_list"] = m.get_list()
+        parsed["client_compress_algo_list"] = m.get_list()
+        parsed["server_compress_algo_list"] = m.get_list()
+        parsed["client_lang_list"] = m.get_list()
+        parsed["server_lang_list"] = m.get_list()
+        parsed["kex_follows"] = m.get_boolean()
+        m.get_int()  # unused
+        return parsed
+
+    def _get_latest_kex_init(self):
+        return self._really_parse_kex_init(
+            Message(self._latest_kex_init), ignore_first_byte=True
+        )
+
+    def _parse_kex_init(self, m):
+        parsed = self._really_parse_kex_init(m)
+        kex_algo_list = parsed["kex_algo_list"]
+        server_key_algo_list = parsed["server_key_algo_list"]
+        client_encrypt_algo_list = parsed["client_encrypt_algo_list"]
+        server_encrypt_algo_list = parsed["server_encrypt_algo_list"]
+        client_mac_algo_list = parsed["client_mac_algo_list"]
+        server_mac_algo_list = parsed["server_mac_algo_list"]
+        client_compress_algo_list = parsed["client_compress_algo_list"]
+        server_compress_algo_list = parsed["server_compress_algo_list"]
+        client_lang_list = parsed["client_lang_list"]
+        server_lang_list = parsed["server_lang_list"]
+        kex_follows = parsed["kex_follows"]
+
+        self._log(DEBUG, "=== Key exchange possibilities ===")
+        for prefix, value in (
+            ("kex algos", kex_algo_list),
+            ("server key", server_key_algo_list),
+            # TODO: shouldn't these two lines say "cipher" to match usual
+            # terminology (including elsewhere in paramiko!)?
+            ("client encrypt", client_encrypt_algo_list),
+            ("server encrypt", server_encrypt_algo_list),
+            ("client mac", client_mac_algo_list),
+            ("server mac", server_mac_algo_list),
+            ("client compress", client_compress_algo_list),
+            ("server compress", server_compress_algo_list),
+            ("client lang", client_lang_list),
+            ("server lang", server_lang_list),
+        ):
+            if value == [""]:
+                value = ["<none>"]
+            value = ", ".join(value)
+            self._log(DEBUG, "{}: {}".format(prefix, value))
+        self._log(DEBUG, "kex follows: {}".format(kex_follows))
+        self._log(DEBUG, "=== Key exchange agreements ===")
+
+        # Strip out ext-info "kex algo"
+        self._remote_ext_info = None
+        if kex_algo_list[-1].startswith("ext-info-"):
+            self._remote_ext_info = kex_algo_list.pop()
+
+        # as a server, we pick the first item in the client's list that we
+        # support.
+        # as a client, we pick the first item in our list that the server
+        # supports.
+        if self.server_mode:
+            agreed_kex = list(
+                filter(self.preferred_kex.__contains__, kex_algo_list)
+            )
+        else:
+            agreed_kex = list(
+                filter(kex_algo_list.__contains__, self.preferred_kex)
+            )
+        if len(agreed_kex) == 0:
+            # TODO: do an auth-overhaul style aggregate exception here?
+            # TODO: would let us streamline log output & show all failures up
+            # front
+            raise IncompatiblePeer(
+                "Incompatible ssh peer (no acceptable kex algorithm)"
+            )  # noqa
+        self.kex_engine = self._kex_info[agreed_kex[0]](self)
+        self._log(DEBUG, "Kex: {}".format(agreed_kex[0]))
+
+        if self.server_mode:
+            available_server_keys = list(
+                filter(
+                    list(self.server_key_dict.keys()).__contains__,
+                    self.preferred_keys,
+                )
+            )
+            agreed_keys = list(
+                filter(
+                    available_server_keys.__contains__, server_key_algo_list
+                )
+            )
+        else:
+            agreed_keys = list(
+                filter(server_key_algo_list.__contains__, self.preferred_keys)
+            )
+        if len(agreed_keys) == 0:
+            raise IncompatiblePeer(
+                "Incompatible ssh peer (no acceptable host key)"
+            )  # noqa
+        self.host_key_type = agreed_keys[0]
+        if self.server_mode and (self.get_server_key() is None):
+            raise IncompatiblePeer(
+                "Incompatible ssh peer (can't match requested host key type)"
+            )  # noqa
+        self._log_agreement("HostKey", agreed_keys[0], agreed_keys[0])
+
+        if self.server_mode:
+            agreed_local_ciphers = list(
+                filter(
+                    self.preferred_ciphers.__contains__,
+                    server_encrypt_algo_list,
+                )
+            )
+            agreed_remote_ciphers = list(
+                filter(
+                    self.preferred_ciphers.__contains__,
+                    client_encrypt_algo_list,
+                )
+            )
+        else:
+            agreed_local_ciphers = list(
+                filter(
+                    client_encrypt_algo_list.__contains__,
+                    self.preferred_ciphers,
+                )
+            )
+            agreed_remote_ciphers = list(
+                filter(
+                    server_encrypt_algo_list.__contains__,
+                    self.preferred_ciphers,
+                )
+            )
+        if len(agreed_local_ciphers) == 0 or len(agreed_remote_ciphers) == 0:
+            raise IncompatiblePeer(
+                "Incompatible ssh server (no acceptable ciphers)"
+            )  # noqa
+        self.local_cipher = agreed_local_ciphers[0]
+        self.remote_cipher = agreed_remote_ciphers[0]
+        self._log_agreement(
+            "Cipher", local=self.local_cipher, remote=self.remote_cipher
+        )
+
+        if self.server_mode:
+            agreed_remote_macs = list(
+                filter(self.preferred_macs.__contains__, client_mac_algo_list)
+            )
+            agreed_local_macs = list(
+                filter(self.preferred_macs.__contains__, server_mac_algo_list)
+            )
+        else:
+            agreed_local_macs = list(
+                filter(client_mac_algo_list.__contains__, self.preferred_macs)
+            )
+            agreed_remote_macs = list(
+                filter(server_mac_algo_list.__contains__, self.preferred_macs)
+            )
+        if (len(agreed_local_macs) == 0) or (len(agreed_remote_macs) == 0):
+            raise IncompatiblePeer(
+                "Incompatible ssh server (no acceptable macs)"
+            )
+        self.local_mac = agreed_local_macs[0]
+        self.remote_mac = agreed_remote_macs[0]
+        self._log_agreement(
+            "MAC", local=self.local_mac, remote=self.remote_mac
+        )
+
+        if self.server_mode:
+            agreed_remote_compression = list(
+                filter(
+                    self.preferred_compression.__contains__,
+                    client_compress_algo_list,
+                )
+            )
+            agreed_local_compression = list(
+                filter(
+                    self.preferred_compression.__contains__,
+                    server_compress_algo_list,
+                )
+            )
+        else:
+            agreed_local_compression = list(
+                filter(
+                    client_compress_algo_list.__contains__,
+                    self.preferred_compression,
+                )
+            )
+            agreed_remote_compression = list(
+                filter(
+                    server_compress_algo_list.__contains__,
+                    self.preferred_compression,
+                )
+            )
+        if (
+            len(agreed_local_compression) == 0
+            or len(agreed_remote_compression) == 0
+        ):
+            msg = "Incompatible ssh server (no acceptable compression)"
+            msg += " {!r} {!r} {!r}"
+            raise IncompatiblePeer(
+                msg.format(
+                    agreed_local_compression,
+                    agreed_remote_compression,
+                    self.preferred_compression,
+                )
+            )
+        self.local_compression = agreed_local_compression[0]
+        self.remote_compression = agreed_remote_compression[0]
+        self._log_agreement(
+            "Compression",
+            local=self.local_compression,
+            remote=self.remote_compression,
+        )
+        self._log(DEBUG, "=== End of kex handshake ===")
+
+        # save for computing hash later...
+        # now wait!  openssh has a bug (and others might too) where there are
+        # actually some extra bytes (one NUL byte in openssh's case) added to
+        # the end of the packet but not parsed.  turns out we need to throw
+        # away those bytes because they aren't part of the hash.
+        self.remote_kex_init = cMSG_KEXINIT + m.get_so_far()
+
+    def _activate_inbound(self):
+        """switch on newly negotiated encryption parameters for
+        inbound traffic"""
+        block_size = self._cipher_info[self.remote_cipher]["block-size"]
+        if self.server_mode:
+            IV_in = self._compute_key("A", block_size)
+            key_in = self._compute_key(
+                "C", self._cipher_info[self.remote_cipher]["key-size"]
+            )
+        else:
+            IV_in = self._compute_key("B", block_size)
+            key_in = self._compute_key(
+                "D", self._cipher_info[self.remote_cipher]["key-size"]
+            )
+        engine = self._get_cipher(
+            self.remote_cipher, key_in, IV_in, self._DECRYPT
+        )
+        etm = "etm@openssh.com" in self.remote_mac
+        mac_size = self._mac_info[self.remote_mac]["size"]
+        mac_engine = self._mac_info[self.remote_mac]["class"]
+        # initial mac keys are done in the hash's natural size (not the
+        # potentially truncated transmission size)
+        if self.server_mode:
+            mac_key = self._compute_key("E", mac_engine().digest_size)
+        else:
+            mac_key = self._compute_key("F", mac_engine().digest_size)
+        self.packetizer.set_inbound_cipher(
+            engine, block_size, mac_engine, mac_size, mac_key, etm=etm
+        )
+        compress_in = self._compression_info[self.remote_compression][1]
+        if compress_in is not None and (
+            self.remote_compression != "zlib@openssh.com" or self.authenticated
+        ):
+            self._log(DEBUG, "Switching on inbound compression ...")
+            self.packetizer.set_inbound_compressor(compress_in())
+
+    def _activate_outbound(self):
+        """switch on newly negotiated encryption parameters for
+        outbound traffic"""
+        m = Message()
+        m.add_byte(cMSG_NEWKEYS)
+        self._send_message(m)
+        block_size = self._cipher_info[self.local_cipher]["block-size"]
+        if self.server_mode:
+            IV_out = self._compute_key("B", block_size)
+            key_out = self._compute_key(
+                "D", self._cipher_info[self.local_cipher]["key-size"]
+            )
+        else:
+            IV_out = self._compute_key("A", block_size)
+            key_out = self._compute_key(
+                "C", self._cipher_info[self.local_cipher]["key-size"]
+            )
+        engine = self._get_cipher(
+            self.local_cipher, key_out, IV_out, self._ENCRYPT
+        )
+        etm = "etm@openssh.com" in self.local_mac
+        mac_size = self._mac_info[self.local_mac]["size"]
+        mac_engine = self._mac_info[self.local_mac]["class"]
+        # initial mac keys are done in the hash's natural size (not the
+        # potentially truncated transmission size)
+        if self.server_mode:
+            mac_key = self._compute_key("F", mac_engine().digest_size)
+        else:
+            mac_key = self._compute_key("E", mac_engine().digest_size)
+        sdctr = self.local_cipher.endswith("-ctr")
+        self.packetizer.set_outbound_cipher(
+            engine, block_size, mac_engine, mac_size, mac_key, sdctr, etm=etm
+        )
+        compress_out = self._compression_info[self.local_compression][0]
+        if compress_out is not None and (
+            self.local_compression != "zlib@openssh.com" or self.authenticated
+        ):
+            self._log(DEBUG, "Switching on outbound compression ...")
+            self.packetizer.set_outbound_compressor(compress_out())
+        if not self.packetizer.need_rekey():
+            self.in_kex = False
+        # If client indicated extension support, send that packet immediately
+        if (
+            self.server_mode
+            and self.server_sig_algs
+            and self._remote_ext_info == "ext-info-c"
+        ):
+            extensions = {"server-sig-algs": ",".join(self.preferred_pubkeys)}
+            m = Message()
+            m.add_byte(cMSG_EXT_INFO)
+            m.add_int(len(extensions))
+            for name, value in sorted(extensions.items()):
+                m.add_string(name)
+                m.add_string(value)
+            self._send_message(m)
+        # we always expect to receive NEWKEYS now
+        self._expect_packet(MSG_NEWKEYS)
+
+    def _auth_trigger(self):
+        self.authenticated = True
+        # delayed initiation of compression
+        if self.local_compression == "zlib@openssh.com":
+            compress_out = self._compression_info[self.local_compression][0]
+            self._log(DEBUG, "Switching on outbound compression ...")
+            self.packetizer.set_outbound_compressor(compress_out())
+        if self.remote_compression == "zlib@openssh.com":
+            compress_in = self._compression_info[self.remote_compression][1]
+            self._log(DEBUG, "Switching on inbound compression ...")
+            self.packetizer.set_inbound_compressor(compress_in())
+
+    def _parse_ext_info(self, msg):
+        # Packet is a count followed by that many key-string to possibly-bytes
+        # pairs.
+        extensions = {}
+        for _ in range(msg.get_int()):
+            name = msg.get_text()
+            value = msg.get_string()
+            extensions[name] = value
+        self._log(DEBUG, "Got EXT_INFO: {}".format(extensions))
+        # NOTE: this should work ok in cases where a server sends /two/ such
+        # messages; the RFC explicitly states a 2nd one should overwrite the
+        # 1st.
+        self.server_extensions = extensions
+
+    def _parse_newkeys(self, m):
+        self._log(DEBUG, "Switch to new keys ...")
+        self._activate_inbound()
+        # can also free a bunch of stuff here
+        self.local_kex_init = self.remote_kex_init = None
+        self.K = None
+        self.kex_engine = None
+        if self.server_mode and (self.auth_handler is None):
+            # create auth handler for server mode
+            self.auth_handler = AuthHandler(self)
+        if not self.initial_kex_done:
+            # this was the first key exchange
+            self.initial_kex_done = True
+        # send an event?
+        if self.completion_event is not None:
+            self.completion_event.set()
+        # it's now okay to send data again (if this was a re-key)
+        if not self.packetizer.need_rekey():
+            self.in_kex = False
+        self.clear_to_send_lock.acquire()
+        try:
+            self.clear_to_send.set()
+        finally:
+            self.clear_to_send_lock.release()
+        return
+
+    def _parse_disconnect(self, m):
+        code = m.get_int()
+        desc = m.get_text()
+        self._log(INFO, "Disconnect (code {:d}): {}".format(code, desc))
+
+    def _parse_global_request(self, m):
+        kind = m.get_text()
+        self._log(DEBUG, 'Received global request "{}"'.format(kind))
+        want_reply = m.get_boolean()
+        if not self.server_mode:
+            self._log(
+                DEBUG,
+                'Rejecting "{}" global request from server.'.format(kind),
+            )
+            ok = False
+        elif kind == "tcpip-forward":
+            address = m.get_text()
+            port = m.get_int()
+            ok = self.server_object.check_port_forward_request(address, port)
+            if ok:
+                ok = (ok,)
+        elif kind == "cancel-tcpip-forward":
+            address = m.get_text()
+            port = m.get_int()
+            self.server_object.cancel_port_forward_request(address, port)
+            ok = True
+        else:
+            ok = self.server_object.check_global_request(kind, m)
+        extra = ()
+        if type(ok) is tuple:
+            extra = ok
+            ok = True
+        if want_reply:
+            msg = Message()
+            if ok:
+                msg.add_byte(cMSG_REQUEST_SUCCESS)
+                msg.add(*extra)
+            else:
+                msg.add_byte(cMSG_REQUEST_FAILURE)
+            self._send_message(msg)
+
+    def _parse_request_success(self, m):
+        self._log(DEBUG, "Global request successful.")
+        self.global_response = m
+        if self.completion_event is not None:
+            self.completion_event.set()
+
+    def _parse_request_failure(self, m):
+        self._log(DEBUG, "Global request denied.")
+        self.global_response = None
+        if self.completion_event is not None:
+            self.completion_event.set()
+
+    def _parse_channel_open_success(self, m):
+        chanid = m.get_int()
+        server_chanid = m.get_int()
+        server_window_size = m.get_int()
+        server_max_packet_size = m.get_int()
+        chan = self._channels.get(chanid)
+        if chan is None:
+            self._log(WARNING, "Success for unrequested channel! [??]")
+            return
+        self.lock.acquire()
+        try:
+            chan._set_remote_channel(
+                server_chanid, server_window_size, server_max_packet_size
+            )
+            self._log(DEBUG, "Secsh channel {:d} opened.".format(chanid))
+            if chanid in self.channel_events:
+                self.channel_events[chanid].set()
+                del self.channel_events[chanid]
+        finally:
+            self.lock.release()
+        return
+
+    def _parse_channel_open_failure(self, m):
+        chanid = m.get_int()
+        reason = m.get_int()
+        reason_str = m.get_text()
+        m.get_text()  # ignored language
+        reason_text = CONNECTION_FAILED_CODE.get(reason, "(unknown code)")
+        self._log(
+            ERROR,
+            "Secsh channel {:d} open FAILED: {}: {}".format(
+                chanid, reason_str, reason_text
+            ),
+        )
+        self.lock.acquire()
+        try:
+            self.saved_exception = ChannelException(reason, reason_text)
+            if chanid in self.channel_events:
+                self._channels.delete(chanid)
+                if chanid in self.channel_events:
+                    self.channel_events[chanid].set()
+                    del self.channel_events[chanid]
+        finally:
+            self.lock.release()
+        return
+
+    def _parse_channel_open(self, m):
+        kind = m.get_text()
+        chanid = m.get_int()
+        initial_window_size = m.get_int()
+        max_packet_size = m.get_int()
+        reject = False
+        if (
+            kind == "auth-agent@openssh.com"
+            and self._forward_agent_handler is not None
+        ):
+            self._log(DEBUG, "Incoming forward agent connection")
+            self.lock.acquire()
+            try:
+                my_chanid = self._next_channel()
+            finally:
+                self.lock.release()
+        elif (kind == "x11") and (self._x11_handler is not None):
+            origin_addr = m.get_text()
+            origin_port = m.get_int()
+            self._log(
+                DEBUG,
+                "Incoming x11 connection from {}:{:d}".format(
+                    origin_addr, origin_port
+                ),
+            )
+            self.lock.acquire()
+            try:
+                my_chanid = self._next_channel()
+            finally:
+                self.lock.release()
+        elif (kind == "forwarded-tcpip") and (self._tcp_handler is not None):
+            server_addr = m.get_text()
+            server_port = m.get_int()
+            origin_addr = m.get_text()
+            origin_port = m.get_int()
+            self._log(
+                DEBUG,
+                "Incoming tcp forwarded connection from {}:{:d}".format(
+                    origin_addr, origin_port
+                ),
+            )
+            self.lock.acquire()
+            try:
+                my_chanid = self._next_channel()
+            finally:
+                self.lock.release()
+        elif not self.server_mode:
+            self._log(
+                DEBUG,
+                'Rejecting "{}" channel request from server.'.format(kind),
+            )
+            reject = True
+            reason = OPEN_FAILED_ADMINISTRATIVELY_PROHIBITED
+        else:
+            self.lock.acquire()
+            try:
+                my_chanid = self._next_channel()
+            finally:
+                self.lock.release()
+            if kind == "direct-tcpip":
+                # handle direct-tcpip requests coming from the client
+                dest_addr = m.get_text()
+                dest_port = m.get_int()
+                origin_addr = m.get_text()
+                origin_port = m.get_int()
+                reason = self.server_object.check_channel_direct_tcpip_request(
+                    my_chanid,
+                    (origin_addr, origin_port),
+                    (dest_addr, dest_port),
+                )
+            else:
+                reason = self.server_object.check_channel_request(
+                    kind, my_chanid
+                )
+            if reason != OPEN_SUCCEEDED:
+                self._log(
+                    DEBUG,
+                    'Rejecting "{}" channel request from client.'.format(kind),
+                )
+                reject = True
+        if reject:
+            msg = Message()
+            msg.add_byte(cMSG_CHANNEL_OPEN_FAILURE)
+            msg.add_int(chanid)
+            msg.add_int(reason)
+            msg.add_string("")
+            msg.add_string("en")
+            self._send_message(msg)
+            return
+
+        chan = Channel(my_chanid)
+        self.lock.acquire()
+        try:
+            self._channels.put(my_chanid, chan)
+            self.channels_seen[my_chanid] = True
+            chan._set_transport(self)
+            chan._set_window(
+                self.default_window_size, self.default_max_packet_size
+            )
+            chan._set_remote_channel(
+                chanid, initial_window_size, max_packet_size
+            )
+        finally:
+            self.lock.release()
+        m = Message()
+        m.add_byte(cMSG_CHANNEL_OPEN_SUCCESS)
+        m.add_int(chanid)
+        m.add_int(my_chanid)
+        m.add_int(self.default_window_size)
+        m.add_int(self.default_max_packet_size)
+        self._send_message(m)
+        self._log(
+            DEBUG, "Secsh channel {:d} ({}) opened.".format(my_chanid, kind)
+        )
+        if kind == "auth-agent@openssh.com":
+            self._forward_agent_handler(chan)
+        elif kind == "x11":
+            self._x11_handler(chan, (origin_addr, origin_port))
+        elif kind == "forwarded-tcpip":
+            chan.origin_addr = (origin_addr, origin_port)
+            self._tcp_handler(
+                chan, (origin_addr, origin_port), (server_addr, server_port)
+            )
+        else:
+            self._queue_incoming_channel(chan)
+
+    def _parse_debug(self, m):
+        m.get_boolean()  # always_display
+        msg = m.get_string()
+        m.get_string()  # language
+        self._log(DEBUG, "Debug msg: {}".format(util.safe_string(msg)))
+
+    def _get_subsystem_handler(self, name):
+        try:
+            self.lock.acquire()
+            if name not in self.subsystem_table:
+                return None, [], {}
+            return self.subsystem_table[name]
+        finally:
+            self.lock.release()
+
+    _channel_handler_table = {
+        MSG_CHANNEL_SUCCESS: Channel._request_success,
+        MSG_CHANNEL_FAILURE: Channel._request_failed,
+        MSG_CHANNEL_DATA: Channel._feed,
+        MSG_CHANNEL_EXTENDED_DATA: Channel._feed_extended,
+        MSG_CHANNEL_WINDOW_ADJUST: Channel._window_adjust,
+        MSG_CHANNEL_REQUEST: Channel._handle_request,
+        MSG_CHANNEL_EOF: Channel._handle_eof,
+        MSG_CHANNEL_CLOSE: Channel._handle_close,
+    }
+
+
+# TODO 4.0: drop this, we barely use it ourselves, it badly replicates the
+# Transport-internal algorithm management, AND does so in a way which doesn't
+# honor newer things like disabled_algorithms!
+class SecurityOptions:
+    """
+    Simple object containing the security preferences of an ssh transport.
+    These are tuples of acceptable ciphers, digests, key types, and key
+    exchange algorithms, listed in order of preference.
+
+    Changing the contents and/or order of these fields affects the underlying
+    `.Transport` (but only if you change them before starting the session).
+    If you try to add an algorithm that paramiko doesn't recognize,
+    ``ValueError`` will be raised.  If you try to assign something besides a
+    tuple to one of the fields, ``TypeError`` will be raised.
+    """
+
+    __slots__ = "_transport"
+
+    def __init__(self, transport):
+        self._transport = transport
+
+    def __repr__(self):
+        """
+        Returns a string representation of this object, for debugging.
+        """
+        return "<paramiko.SecurityOptions for {!r}>".format(self._transport)
+
+    def _set(self, name, orig, x):
+        if type(x) is list:
+            x = tuple(x)
+        if type(x) is not tuple:
+            raise TypeError("expected tuple or list")
+        possible = list(getattr(self._transport, orig).keys())
+        forbidden = [n for n in x if n not in possible]
+        if len(forbidden) > 0:
+            raise ValueError("unknown cipher")
+        setattr(self._transport, name, x)
+
+    @property
+    def ciphers(self):
+        """Symmetric encryption ciphers"""
+        return self._transport._preferred_ciphers
+
+    @ciphers.setter
+    def ciphers(self, x):
+        self._set("_preferred_ciphers", "_cipher_info", x)
+
+    @property
+    def digests(self):
+        """Digest (one-way hash) algorithms"""
+        return self._transport._preferred_macs
+
+    @digests.setter
+    def digests(self, x):
+        self._set("_preferred_macs", "_mac_info", x)
+
+    @property
+    def key_types(self):
+        """Public-key algorithms"""
+        return self._transport._preferred_keys
+
+    @key_types.setter
+    def key_types(self, x):
+        self._set("_preferred_keys", "_key_info", x)
+
+    @property
+    def kex(self):
+        """Key exchange algorithms"""
+        return self._transport._preferred_kex
+
+    @kex.setter
+    def kex(self, x):
+        self._set("_preferred_kex", "_kex_info", x)
+
+    @property
+    def compression(self):
+        """Compression algorithms"""
+        return self._transport._preferred_compression
+
+    @compression.setter
+    def compression(self, x):
+        self._set("_preferred_compression", "_compression_info", x)
+
+
+class ChannelMap:
+    def __init__(self):
+        # (id -> Channel)
+        self._map = weakref.WeakValueDictionary()
+        self._lock = threading.Lock()
+
+    def put(self, chanid, chan):
+        self._lock.acquire()
+        try:
+            self._map[chanid] = chan
+        finally:
+            self._lock.release()
+
+    def get(self, chanid):
+        self._lock.acquire()
+        try:
+            return self._map.get(chanid, None)
+        finally:
+            self._lock.release()
+
+    def delete(self, chanid):
+        self._lock.acquire()
+        try:
+            try:
+                del self._map[chanid]
+            except KeyError:
+                pass
+        finally:
+            self._lock.release()
+
+    def values(self):
+        self._lock.acquire()
+        try:
+            return list(self._map.values())
+        finally:
+            self._lock.release()
+
+    def __len__(self):
+        self._lock.acquire()
+        try:
+            return len(self._map)
+        finally:
+            self._lock.release()
+
+
+class ServiceRequestingTransport(Transport):
+    """
+    Transport, but also handling service requests, like it oughtta!
+
+    .. versionadded:: 3.2
+    """
+
+    # NOTE: this purposefully duplicates some of the parent class in order to
+    # modernize, refactor, etc. The intent is that eventually we will collapse
+    # this one onto the parent in a backwards incompatible release.
+
+    def __init__(self, *args, **kwargs):
+        super().__init__(*args, **kwargs)
+        self._service_userauth_accepted = False
+        self._handler_table[MSG_SERVICE_ACCEPT] = self._parse_service_accept
+
+    def _parse_service_accept(self, m):
+        service = m.get_text()
+        # Short-circuit for any service name not ssh-userauth.
+        # NOTE: it's technically possible for 'service name' in
+        # SERVICE_REQUEST/ACCEPT messages to be "ssh-connection" --
+        # but I don't see evidence of Paramiko ever initiating or expecting to
+        # receive one of these. We /do/ see the 'service name' field in
+        # MSG_USERAUTH_REQUEST/ACCEPT/FAILURE set to this string, but that is a
+        # different set of handlers, so...!
+        if service != "ssh-userauth":
+            # TODO 4.0: consider erroring here (with an ability to opt out?)
+            # instead as it probably means something went Very Wrong.
+            self._log(
+                DEBUG, 'Service request "{}" accepted (?)'.format(service)
+            )
+            return
+        # Record that we saw a service-userauth acceptance, meaning we are free
+        # to submit auth requests.
+        self._service_userauth_accepted = True
+        self._log(DEBUG, "MSG_SERVICE_ACCEPT received; auth may begin")
+
+    def ensure_session(self):
+        # Make sure we're not trying to auth on a not-yet-open or
+        # already-closed transport session; that's our responsibility, not that
+        # of AuthHandler.
+        if (not self.active) or (not self.initial_kex_done):
+            # TODO: better error message? this can happen in many places, eg
+            # user error (authing before connecting) or developer error (some
+            # improperly handled pre/mid auth shutdown didn't become fatal
+            # enough). The latter is much more common & should ideally be fixed
+            # by terminating things harder?
+            raise SSHException("No existing session")
+        # Also make sure we've actually been told we are allowed to auth.
+        if self._service_userauth_accepted:
+            return
+        # Or request to do so, otherwise.
+        m = Message()
+        m.add_byte(cMSG_SERVICE_REQUEST)
+        m.add_string("ssh-userauth")
+        self._log(DEBUG, "Sending MSG_SERVICE_REQUEST: ssh-userauth")
+        self._send_message(m)
+        # Now we wait to hear back; the user is expecting a blocking-style auth
+        # request so there's no point giving control back anywhere.
+        while not self._service_userauth_accepted:
+            # TODO: feels like we're missing an AuthHandler Event like
+            # 'self.auth_event' which is set when AuthHandler shuts down in
+            # ways good AND bad. Transport only seems to have completion_event
+            # which is unclear re: intent, eg it's set by newkeys which always
+            # happens on connection, so it'll always be set by the time we get
+            # here.
+            # NOTE: this copies the timing of event.wait() in
+            # AuthHandler.wait_for_response, re: 1/10 of a second. Could
+            # presumably be smaller, but seems unlikely this period is going to
+            # be "too long" for any code doing ssh networking...
+            time.sleep(0.1)
+        self.auth_handler = self.get_auth_handler()
+
+    def get_auth_handler(self):
+        # NOTE: using new sibling subclass instead of classic AuthHandler
+        return AuthOnlyHandler(self)
+
+    def auth_none(self, username):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        return self.auth_handler.auth_none(username)
+
+    def auth_password(self, username, password, fallback=True):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        try:
+            return self.auth_handler.auth_password(username, password)
+        except BadAuthenticationType as e:
+            # if password auth isn't allowed, but keyboard-interactive *is*,
+            # try to fudge it
+            if not fallback or ("keyboard-interactive" not in e.allowed_types):
+                raise
+            try:
+
+                def handler(title, instructions, fields):
+                    if len(fields) > 1:
+                        raise SSHException("Fallback authentication failed.")
+                    if len(fields) == 0:
+                        # for some reason, at least on os x, a 2nd request will
+                        # be made with zero fields requested.  maybe it's just
+                        # to try to fake out automated scripting of the exact
+                        # type we're doing here.  *shrug* :)
+                        return []
+                    return [password]
+
+                return self.auth_interactive(username, handler)
+            except SSHException:
+                # attempt to fudge failed; just raise the original exception
+                raise e
+
+    def auth_publickey(self, username, key):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        return self.auth_handler.auth_publickey(username, key)
+
+    def auth_interactive(self, username, handler, submethods=""):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        return self.auth_handler.auth_interactive(
+            username, handler, submethods
+        )
+
+    def auth_interactive_dumb(self, username, handler=None, submethods=""):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        # NOTE: legacy impl omitted equiv of ensure_session since it just wraps
+        # another call to an auth method. however we reinstate it for
+        # consistency reasons.
+        self.ensure_session()
+        if not handler:
+
+            def handler(title, instructions, prompt_list):
+                answers = []
+                if title:
+                    print(title.strip())
+                if instructions:
+                    print(instructions.strip())
+                for prompt, show_input in prompt_list:
+                    print(prompt.strip(), end=" ")
+                    answers.append(input())
+                return answers
+
+        return self.auth_interactive(username, handler, submethods)
+
+    def auth_gssapi_with_mic(self, username, gss_host, gss_deleg_creds):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        self.auth_handler = self.get_auth_handler()
+        return self.auth_handler.auth_gssapi_with_mic(
+            username, gss_host, gss_deleg_creds
+        )
+
+    def auth_gssapi_keyex(self, username):
+        # TODO 4.0: merge to parent, preserving (most of) docstring
+        self.ensure_session()
+        self.auth_handler = self.get_auth_handler()
+        return self.auth_handler.auth_gssapi_keyex(username)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/util.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/util.py
new file mode 100644
index 0000000000000000000000000000000000000000..f1e33a50e02b1b785b00131f4ea84a43a4758cc7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/util.py
@@ -0,0 +1,337 @@
+# Copyright (C) 2003-2007  Robey Pointer <robeypointer@gmail.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Useful functions used by the rest of paramiko.
+"""
+
+
+import sys
+import struct
+import traceback
+import threading
+import logging
+
+from paramiko.common import (
+    DEBUG,
+    zero_byte,
+    xffffffff,
+    max_byte,
+    byte_ord,
+    byte_chr,
+)
+from paramiko.config import SSHConfig
+
+
+def inflate_long(s, always_positive=False):
+    """turns a normalized byte string into a long-int
+    (adapted from Crypto.Util.number)"""
+    out = 0
+    negative = 0
+    if not always_positive and (len(s) > 0) and (byte_ord(s[0]) >= 0x80):
+        negative = 1
+    if len(s) % 4:
+        filler = zero_byte
+        if negative:
+            filler = max_byte
+        # never convert this to ``s +=`` because this is a string, not a number
+        # noinspection PyAugmentAssignment
+        s = filler * (4 - len(s) % 4) + s
+    for i in range(0, len(s), 4):
+        out = (out << 32) + struct.unpack(">I", s[i : i + 4])[0]
+    if negative:
+        out -= 1 << (8 * len(s))
+    return out
+
+
+def deflate_long(n, add_sign_padding=True):
+    """turns a long-int into a normalized byte string
+    (adapted from Crypto.Util.number)"""
+    # after much testing, this algorithm was deemed to be the fastest
+    s = bytes()
+    n = int(n)
+    while (n != 0) and (n != -1):
+        s = struct.pack(">I", n & xffffffff) + s
+        n >>= 32
+    # strip off leading zeros, FFs
+    for i in enumerate(s):
+        if (n == 0) and (i[1] != 0):
+            break
+        if (n == -1) and (i[1] != 0xFF):
+            break
+    else:
+        # degenerate case, n was either 0 or -1
+        i = (0,)
+        if n == 0:
+            s = zero_byte
+        else:
+            s = max_byte
+    s = s[i[0] :]
+    if add_sign_padding:
+        if (n == 0) and (byte_ord(s[0]) >= 0x80):
+            s = zero_byte + s
+        if (n == -1) and (byte_ord(s[0]) < 0x80):
+            s = max_byte + s
+    return s
+
+
+def format_binary(data, prefix=""):
+    x = 0
+    out = []
+    while len(data) > x + 16:
+        out.append(format_binary_line(data[x : x + 16]))
+        x += 16
+    if x < len(data):
+        out.append(format_binary_line(data[x:]))
+    return [prefix + line for line in out]
+
+
+def format_binary_line(data):
+    left = " ".join(["{:02X}".format(byte_ord(c)) for c in data])
+    right = "".join(
+        [".{:c}..".format(byte_ord(c))[(byte_ord(c) + 63) // 95] for c in data]
+    )
+    return "{:50s} {}".format(left, right)
+
+
+def safe_string(s):
+    out = b""
+    for c in s:
+        i = byte_ord(c)
+        if 32 <= i <= 127:
+            out += byte_chr(i)
+        else:
+            out += b("%{:02X}".format(i))
+    return out
+
+
+def bit_length(n):
+    try:
+        return n.bit_length()
+    except AttributeError:
+        norm = deflate_long(n, False)
+        hbyte = byte_ord(norm[0])
+        if hbyte == 0:
+            return 1
+        bitlen = len(norm) * 8
+        while not (hbyte & 0x80):
+            hbyte <<= 1
+            bitlen -= 1
+        return bitlen
+
+
+def tb_strings():
+    return "".join(traceback.format_exception(*sys.exc_info())).split("\n")
+
+
+def generate_key_bytes(hash_alg, salt, key, nbytes):
+    """
+    Given a password, passphrase, or other human-source key, scramble it
+    through a secure hash into some keyworthy bytes.  This specific algorithm
+    is used for encrypting/decrypting private key files.
+
+    :param function hash_alg: A function which creates a new hash object, such
+        as ``hashlib.sha256``.
+    :param salt: data to salt the hash with.
+    :type bytes salt: Hash salt bytes.
+    :param str key: human-entered password or passphrase.
+    :param int nbytes: number of bytes to generate.
+    :return: Key data, as `bytes`.
+    """
+    keydata = bytes()
+    digest = bytes()
+    if len(salt) > 8:
+        salt = salt[:8]
+    while nbytes > 0:
+        hash_obj = hash_alg()
+        if len(digest) > 0:
+            hash_obj.update(digest)
+        hash_obj.update(b(key))
+        hash_obj.update(salt)
+        digest = hash_obj.digest()
+        size = min(nbytes, len(digest))
+        keydata += digest[:size]
+        nbytes -= size
+    return keydata
+
+
+def load_host_keys(filename):
+    """
+    Read a file of known SSH host keys, in the format used by openssh, and
+    return a compound dict of ``hostname -> keytype ->`` `PKey
+    <paramiko.pkey.PKey>`. The hostname may be an IP address or DNS name.  The
+    keytype will be either ``"ssh-rsa"`` or ``"ssh-dss"``.
+
+    This type of file unfortunately doesn't exist on Windows, but on posix,
+    it will usually be stored in ``os.path.expanduser("~/.ssh/known_hosts")``.
+
+    Since 1.5.3, this is just a wrapper around `.HostKeys`.
+
+    :param str filename: name of the file to read host keys from
+    :return:
+        nested dict of `.PKey` objects, indexed by hostname and then keytype
+    """
+    from paramiko.hostkeys import HostKeys
+
+    return HostKeys(filename)
+
+
+def parse_ssh_config(file_obj):
+    """
+    Provided only as a backward-compatible wrapper around `.SSHConfig`.
+
+    .. deprecated:: 2.7
+        Use `SSHConfig.from_file` instead.
+    """
+    config = SSHConfig()
+    config.parse(file_obj)
+    return config
+
+
+def lookup_ssh_host_config(hostname, config):
+    """
+    Provided only as a backward-compatible wrapper around `.SSHConfig`.
+    """
+    return config.lookup(hostname)
+
+
+def mod_inverse(x, m):
+    # it's crazy how small Python can make this function.
+    u1, u2, u3 = 1, 0, m
+    v1, v2, v3 = 0, 1, x
+
+    while v3 > 0:
+        q = u3 // v3
+        u1, v1 = v1, u1 - v1 * q
+        u2, v2 = v2, u2 - v2 * q
+        u3, v3 = v3, u3 - v3 * q
+    if u2 < 0:
+        u2 += m
+    return u2
+
+
+_g_thread_data = threading.local()
+_g_thread_counter = 0
+_g_thread_lock = threading.Lock()
+
+
+def get_thread_id():
+    global _g_thread_data, _g_thread_counter, _g_thread_lock
+    try:
+        return _g_thread_data.id
+    except AttributeError:
+        with _g_thread_lock:
+            _g_thread_counter += 1
+            _g_thread_data.id = _g_thread_counter
+        return _g_thread_data.id
+
+
+def log_to_file(filename, level=DEBUG):
+    """send paramiko logs to a logfile,
+    if they're not already going somewhere"""
+    logger = logging.getLogger("paramiko")
+    if len(logger.handlers) > 0:
+        return
+    logger.setLevel(level)
+    f = open(filename, "a")
+    handler = logging.StreamHandler(f)
+    frm = "%(levelname)-.3s [%(asctime)s.%(msecs)03d] thr=%(_threadid)-3d"
+    frm += " %(name)s: %(message)s"
+    handler.setFormatter(logging.Formatter(frm, "%Y%m%d-%H:%M:%S"))
+    logger.addHandler(handler)
+
+
+# make only one filter object, so it doesn't get applied more than once
+class PFilter:
+    def filter(self, record):
+        record._threadid = get_thread_id()
+        return True
+
+
+_pfilter = PFilter()
+
+
+def get_logger(name):
+    logger = logging.getLogger(name)
+    logger.addFilter(_pfilter)
+    return logger
+
+
+def constant_time_bytes_eq(a, b):
+    if len(a) != len(b):
+        return False
+    res = 0
+    # noinspection PyUnresolvedReferences
+    for i in range(len(a)):  # noqa: F821
+        res |= byte_ord(a[i]) ^ byte_ord(b[i])
+    return res == 0
+
+
+class ClosingContextManager:
+    def __enter__(self):
+        return self
+
+    def __exit__(self, type, value, traceback):
+        self.close()
+
+
+def clamp_value(minimum, val, maximum):
+    return max(minimum, min(val, maximum))
+
+
+def asbytes(s):
+    """
+    Coerce to bytes if possible or return unchanged.
+    """
+    try:
+        # Attempt to run through our version of b(), which does the Right Thing
+        # for unicode strings vs bytestrings, and raises TypeError if it's not
+        # one of those types.
+        return b(s)
+    except TypeError:
+        try:
+            # If it wasn't a string/byte/buffer-ish object, try calling an
+            # asbytes() method, which many of our internal classes implement.
+            return s.asbytes()
+        except AttributeError:
+            # Finally, just do nothing & assume this object is sufficiently
+            # byte-y or buffer-y that everything will work out (or that callers
+            # are capable of handling whatever it is.)
+            return s
+
+
+# TODO: clean this up / force callers to assume bytes OR unicode
+def b(s, encoding="utf8"):
+    """cast unicode or bytes to bytes"""
+    if isinstance(s, bytes):
+        return s
+    elif isinstance(s, str):
+        return s.encode(encoding)
+    else:
+        raise TypeError(f"Expected unicode or bytes, got {type(s)}")
+
+
+# TODO: clean this up / force callers to assume bytes OR unicode
+def u(s, encoding="utf8"):
+    """cast bytes or unicode to unicode"""
+    if isinstance(s, bytes):
+        return s.decode(encoding)
+    elif isinstance(s, str):
+        return s
+    else:
+        raise TypeError(f"Expected unicode or bytes, got {type(s)}")
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/win_openssh.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/win_openssh.py
new file mode 100644
index 0000000000000000000000000000000000000000..614b5898ce1bb468cf2704dd6539bc9b11e0357f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/win_openssh.py
@@ -0,0 +1,56 @@
+# Copyright (C) 2021 Lew Gordon <lew.gordon@genesys.com>
+# Copyright (C) 2022 Patrick Spendrin <ps_ml@gmx.de>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+import os.path
+import time
+
+PIPE_NAME = r"\\.\pipe\openssh-ssh-agent"
+
+
+def can_talk_to_agent():
+    # use os.listdir() instead of os.path.exists(), because os.path.exists()
+    # uses CreateFileW() API and the pipe cannot be reopen unless the server
+    # calls DisconnectNamedPipe().
+    dir_, name = os.path.split(PIPE_NAME)
+    name = name.lower()
+    return any(name == n.lower() for n in os.listdir(dir_))
+
+
+class OpenSSHAgentConnection:
+    def __init__(self):
+        while True:
+            try:
+                self._pipe = os.open(PIPE_NAME, os.O_RDWR | os.O_BINARY)
+            except OSError as e:
+                # retry when errno 22 which means that the server has not
+                # called DisconnectNamedPipe() yet.
+                if e.errno != 22:
+                    raise
+            else:
+                break
+            time.sleep(0.1)
+
+    def send(self, data):
+        return os.write(self._pipe, data)
+
+    def recv(self, n):
+        return os.read(self._pipe, n)
+
+    def close(self):
+        return os.close(self._pipe)
diff --git a/TP03/TP03/lib/python3.9/site-packages/paramiko/win_pageant.py b/TP03/TP03/lib/python3.9/site-packages/paramiko/win_pageant.py
new file mode 100644
index 0000000000000000000000000000000000000000..c927de6578ec2a4a4fcddda5c4de8a20802455a8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/paramiko/win_pageant.py
@@ -0,0 +1,138 @@
+# Copyright (C) 2005 John Arbash-Meinel <john@arbash-meinel.com>
+# Modified up by: Todd Whiteman <ToddW@ActiveState.com>
+#
+# This file is part of paramiko.
+#
+# Paramiko is free software; you can redistribute it and/or modify it under the
+# terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation; either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# Paramiko is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with Paramiko; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA.
+
+"""
+Functions for communicating with Pageant, the basic windows ssh agent program.
+"""
+
+import array
+import ctypes.wintypes
+import platform
+import struct
+from paramiko.common import zero_byte
+from paramiko.util import b
+
+import _thread as thread
+
+from . import _winapi
+
+
+_AGENT_COPYDATA_ID = 0x804E50BA
+_AGENT_MAX_MSGLEN = 8192
+# Note: The WM_COPYDATA value is pulled from win32con, as a workaround
+# so we do not have to import this huge library just for this one variable.
+win32con_WM_COPYDATA = 74
+
+
+def _get_pageant_window_object():
+    return ctypes.windll.user32.FindWindowA(b"Pageant", b"Pageant")
+
+
+def can_talk_to_agent():
+    """
+    Check to see if there is a "Pageant" agent we can talk to.
+
+    This checks both if we have the required libraries (win32all or ctypes)
+    and if there is a Pageant currently running.
+    """
+    return bool(_get_pageant_window_object())
+
+
+if platform.architecture()[0] == "64bit":
+    ULONG_PTR = ctypes.c_uint64
+else:
+    ULONG_PTR = ctypes.c_uint32
+
+
+class COPYDATASTRUCT(ctypes.Structure):
+    """
+    ctypes implementation of
+    http://msdn.microsoft.com/en-us/library/windows/desktop/ms649010%28v=vs.85%29.aspx
+    """
+
+    _fields_ = [
+        ("num_data", ULONG_PTR),
+        ("data_size", ctypes.wintypes.DWORD),
+        ("data_loc", ctypes.c_void_p),
+    ]
+
+
+def _query_pageant(msg):
+    """
+    Communication with the Pageant process is done through a shared
+    memory-mapped file.
+    """
+    hwnd = _get_pageant_window_object()
+    if not hwnd:
+        # Raise a failure to connect exception, pageant isn't running anymore!
+        return None
+
+    # create a name for the mmap
+    map_name = f"PageantRequest{thread.get_ident():08x}"
+
+    pymap = _winapi.MemoryMap(
+        map_name, _AGENT_MAX_MSGLEN, _winapi.get_security_attributes_for_user()
+    )
+    with pymap:
+        pymap.write(msg)
+        # Create an array buffer containing the mapped filename
+        char_buffer = array.array("b", b(map_name) + zero_byte)  # noqa
+        char_buffer_address, char_buffer_size = char_buffer.buffer_info()
+        # Create a string to use for the SendMessage function call
+        cds = COPYDATASTRUCT(
+            _AGENT_COPYDATA_ID, char_buffer_size, char_buffer_address
+        )
+
+        response = ctypes.windll.user32.SendMessageA(
+            hwnd, win32con_WM_COPYDATA, ctypes.sizeof(cds), ctypes.byref(cds)
+        )
+
+        if response > 0:
+            pymap.seek(0)
+            datalen = pymap.read(4)
+            retlen = struct.unpack(">I", datalen)[0]
+            return datalen + pymap.read(retlen)
+        return None
+
+
+class PageantConnection:
+    """
+    Mock "connection" to an agent which roughly approximates the behavior of
+    a unix local-domain socket (as used by Agent).  Requests are sent to the
+    pageant daemon via special Windows magick, and responses are buffered back
+    for subsequent reads.
+    """
+
+    def __init__(self):
+        self._response = None
+
+    def send(self, data):
+        self._response = _query_pageant(data)
+
+    def recv(self, n):
+        if self._response is None:
+            return ""
+        ret = self._response[:n]
+        self._response = self._response[n:]
+        if self._response == "":
+            self._response = None
+        return ret
+
+    def close(self):
+        pass
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/LICENSE.txt b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..75eb0fd80b08c55e9dac4cc6ff6557ca4892eed0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2020 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/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..f7e5e8117f59ea96bf52662ce1cab4e44893be6e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/METADATA
@@ -0,0 +1,94 @@
+Metadata-Version: 2.1
+Name: pip
+Version: 20.3.4
+Summary: The PyPA recommended tool for installing Python packages.
+Home-page: https://pip.pypa.io/
+Author: The pip developers
+Author-email: distutils-sig@python.org
+License: MIT
+Project-URL: Documentation, https://pip.pypa.io
+Project-URL: Source, https://github.com/pypa/pip
+Project-URL: Changelog, https://pip.pypa.io/en/stable/news/
+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 :: 3.9
+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`_
+
+We release updates regularly, with a new version every 3 months. Find more details in our documentation:
+
+* `Release notes`_
+* `Release process`_
+
+In pip 20.3, we've `made a big improvement to the heart of pip`_; `learn more`_. We want your input, so `sign up for our user experience research studies`_ to help us do it right.
+
+**Note**: pip 21.0, in January 2021, will remove Python 2 support, per pip's `Python 2 support policy`_. Please migrate to Python 3.
+
+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`_
+* `Development documentation`_
+* `Development mailing list`_
+* `Development IRC`_
+
+Code of Conduct
+---------------
+
+Everyone interacting in the pip project's codebases, issue trackers, chat
+rooms, and mailing lists is expected to follow the `PSF 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
+.. _Development documentation: https://pip.pypa.io/en/latest/development
+.. _made a big improvement to the heart of pip: https://pyfound.blogspot.com/2020/11/pip-20-3-new-resolver.html
+.. _learn more: https://pip.pypa.io/en/latest/user_guide/#changes-to-the-pip-dependency-resolver-in-20-3-2020
+.. _sign up for our user experience research studies: https://pyfound.blogspot.com/2020/03/new-pip-resolver-to-roll-out-this-year.html
+.. _Python 2 support policy: https://pip.pypa.io/en/latest/development/release-process/#python-2-support
+.. _Issue tracking: https://github.com/pypa/pip/issues
+.. _Discourse channel: https://discuss.python.org/c/packaging
+.. _Development mailing list: https://mail.python.org/mailman3/lists/distutils-sig.python.org/
+.. _User IRC: https://webchat.freenode.net/?channels=%23pypa
+.. _Development IRC: https://webchat.freenode.net/?channels=%23pypa-dev
+.. _PSF Code of Conduct: https://github.com/pypa/.github/blob/main/CODE_OF_CONDUCT.md
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..08e15600d23b586c78ecc68b1439f1fa1b33219d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/RECORD
@@ -0,0 +1,284 @@
+../../../bin/pip,sha256=wBWa_EgYI53XWRR4pxDCnqmHmPFLcgre0UZmZOLMhL0,277
+../../../bin/pip3,sha256=wBWa_EgYI53XWRR4pxDCnqmHmPFLcgre0UZmZOLMhL0,277
+../../../bin/pip3.9,sha256=wBWa_EgYI53XWRR4pxDCnqmHmPFLcgre0UZmZOLMhL0,277
+pip-20.3.4.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+pip-20.3.4.dist-info/LICENSE.txt,sha256=gdAS_gPyTUkBTvvgoNNlG9Mv1KFDTig6W1JdeMD2Efg,1090
+pip-20.3.4.dist-info/METADATA,sha256=NrQymkcD8Kl04ckwQXiv2W-ZCeORlee9lZ0RlurDR-o,4304
+pip-20.3.4.dist-info/RECORD,,
+pip-20.3.4.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip-20.3.4.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
+pip-20.3.4.dist-info/entry_points.txt,sha256=5ExSa1s54zSPNA_1epJn5SX06786S8k5YHwskMvVYzw,125
+pip-20.3.4.dist-info/top_level.txt,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+pip/__init__.py,sha256=dUUDS2wGpUgaxc_qko944J7JopSJIz53d0FM7Eml96k,455
+pip/__main__.py,sha256=bqCAM1cj1HwHCDx3WJa-LJxOBXimGxE8OjBqAvnhVg0,911
+pip/__pycache__/__init__.cpython-39.pyc,,
+pip/__pycache__/__main__.cpython-39.pyc,,
+pip/_internal/__init__.py,sha256=TeXyNeKLd7EETjf3lJAGSY1Db-dYA6a_xCLHWUkEmXA,495
+pip/_internal/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/__pycache__/build_env.cpython-39.pyc,,
+pip/_internal/__pycache__/cache.cpython-39.pyc,,
+pip/_internal/__pycache__/configuration.cpython-39.pyc,,
+pip/_internal/__pycache__/exceptions.cpython-39.pyc,,
+pip/_internal/__pycache__/locations.cpython-39.pyc,,
+pip/_internal/__pycache__/main.cpython-39.pyc,,
+pip/_internal/__pycache__/pyproject.cpython-39.pyc,,
+pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc,,
+pip/_internal/__pycache__/wheel_builder.cpython-39.pyc,,
+pip/_internal/build_env.py,sha256=5PdJVlRvDe-fmGfc_wqOWtQ9Ad9gm2Elwfy2V5aVuio,8089
+pip/_internal/cache.py,sha256=HDTjGrm57Fl-vuojIcL17744KRCl66uuNXaAmwA8HLQ,12249
+pip/_internal/cli/__init__.py,sha256=FkHBgpxxb-_gd6r1FjnNhfMOzAUYyXoXKJ6abijfcFU,132
+pip/_internal/cli/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/base_command.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/command_context.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/main.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/parser.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/req_command.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/spinners.cpython-39.pyc,,
+pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc,,
+pip/_internal/cli/autocompletion.py,sha256=ekGNtcDI0p7rFVc-7s4T9Tbss4Jgb7vsB649XJIblRg,6547
+pip/_internal/cli/base_command.py,sha256=duI7mshtryhdmzI9GeHGqssTZM4UkZW0IT5pX3SYqtA,9337
+pip/_internal/cli/cmdoptions.py,sha256=biNkTbqoY13QHo0BxnjndJFrQmzFSrEiR-5PKX30rWY,28617
+pip/_internal/cli/command_context.py,sha256=k1VHqTCeYjQ0b3tyqiUToA3An5FxpQmo5rb-9AHJ6VY,975
+pip/_internal/cli/main.py,sha256=Hxc9dZyW3xiDsYZX-_J2cGXT5DWNLNn_Y7o9oUme-Ec,2616
+pip/_internal/cli/main_parser.py,sha256=QSUbu5dPZ3pxsmChno8eH16kZxAcUkGy8YcCG_eeGrc,2830
+pip/_internal/cli/parser.py,sha256=ne2OH7B3xSeGPUelZkRQ38Tv9hqyl__sgyNiP3P55-U,10388
+pip/_internal/cli/progress_bars.py,sha256=J1zykt2LI4gbBeXorfYRmYV5FgXhcW4x3r6xE_a7Z7c,9121
+pip/_internal/cli/req_command.py,sha256=_WNGkkvnuP210DcZXWRUzJ8wMYNNQQ2Nw9mGOnHCHS4,16455
+pip/_internal/cli/spinners.py,sha256=GUQWNPnBD1CTRHxxumvUwodHovIvofMBu-bkaSaUnQY,5509
+pip/_internal/cli/status_codes.py,sha256=F6uDG6Gj7RNKQJUDnd87QKqI16Us-t-B0wPF_4QMpWc,156
+pip/_internal/commands/__init__.py,sha256=30max1NT-jWYrzAKwioPuUgD75EKubqLkBhHYmeZQH8,4101
+pip/_internal/commands/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/cache.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/check.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/completion.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/configuration.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/debug.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/download.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/freeze.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/hash.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/help.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/install.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/list.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/search.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/show.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc,,
+pip/_internal/commands/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/commands/cache.py,sha256=m7T9C6jB7fmNozyG24J1LkeTsoyfyIUYg_5otImUq64,7555
+pip/_internal/commands/check.py,sha256=NijmAIKljW3kY-V0QLMT7VttuEDtDroQa5qrfy4B-1I,1677
+pip/_internal/commands/completion.py,sha256=SFurXIoVZgXMhD-rPwyftjD2dtaOosIgBbHbCJ4Bnmo,3081
+pip/_internal/commands/configuration.py,sha256=i4uMbWcK-PW1VLY7f6eKklh7qO1Jnsvqvqe4cY6Uj4Y,9327
+pip/_internal/commands/debug.py,sha256=A54tXwZIEefYoOYlHvu-QbVyfNDqN00cHWkCe_6DdCU,8193
+pip/_internal/commands/download.py,sha256=NGk_sEGui-Id-1jki2FzbcTA4HZKEVbnImENnHGw8is,4919
+pip/_internal/commands/freeze.py,sha256=BcB1CYWMK95dE2SAkuk7aAhenv-pMVRfQQZ0_W8oKNc,3888
+pip/_internal/commands/hash.py,sha256=v2nYCiEsEI9nEam1p6GwdG8xyj5gFv-4WrqvNexKmeY,1843
+pip/_internal/commands/help.py,sha256=ofk4ez1AaR16kha-w4DLuWOi_B82wxU_2aT2VnHM8cg,1294
+pip/_internal/commands/install.py,sha256=L5depJz54VvwxCFV0_b9f1F_o4sKP9QR0dKIFH1ocL4,28449
+pip/_internal/commands/list.py,sha256=uM5Dvi9FIzT_QzLEIheQ-7C3vgOF3rh2B9CjCwPIHeY,11547
+pip/_internal/commands/search.py,sha256=YtTJydvon5CVZ5OYAvof495HyghFfMQkkUberJjYm1c,6033
+pip/_internal/commands/show.py,sha256=zk9FZqNPZ5Q4dGXnKrKdk3PaLPsWOHOwoFWGbMzhoKA,6996
+pip/_internal/commands/uninstall.py,sha256=Ys8hwFsg0kvvGtLGYG3ibL5BKvURhlSlCX50ZQ-hsHk,3311
+pip/_internal/commands/wheel.py,sha256=xvUMV9v_Qjwtip_4y1CWSTDVUdxa4dd4DY1PwtkXUxI,6802
+pip/_internal/configuration.py,sha256=B57qs7H0cGj8OPHQ8feeAzF8q333Wbdgd63pp1CtScM,13904
+pip/_internal/distributions/__init__.py,sha256=ECBUW5Gtu9TjJwyFLvim-i6kUMYVuikNh9I5asL6tbA,959
+pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/distributions/__pycache__/base.cpython-39.pyc,,
+pip/_internal/distributions/__pycache__/installed.cpython-39.pyc,,
+pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc,,
+pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/distributions/base.py,sha256=rGDUfzALQQN-9vkrcbCl7bhGMQbQ-BdHLWW6xWJObQs,1426
+pip/_internal/distributions/installed.py,sha256=aUtTvTcnVQSEts20D0Z0ifHnfT-fwMA-SXoqAq5pR58,761
+pip/_internal/distributions/sdist.py,sha256=UvAp42AhjJwa0x-QM72GptF5k_Y7KXhEjm0owTrskG4,4087
+pip/_internal/distributions/wheel.py,sha256=lePMBDS_ptPq1NI7n-GQYbFdDn8RdCbXoZ1PagrqvW8,1295
+pip/_internal/exceptions.py,sha256=8_7M9CgtGmTHHwgvpT8Mg8iDli7DfIMoIDfIvpdXUSY,13003
+pip/_internal/index/__init__.py,sha256=vpt-JeTZefh8a-FC22ZeBSXFVbuBcXSGiILhQZJaNpQ,30
+pip/_internal/index/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/index/__pycache__/collector.cpython-39.pyc,,
+pip/_internal/index/__pycache__/package_finder.cpython-39.pyc,,
+pip/_internal/index/collector.py,sha256=gZ_9wP_AmiIS8TVlpzHOKZvQsZAXUwCmC4Tg12Uz7LE,22070
+pip/_internal/index/package_finder.py,sha256=l8bLOqUbTZuqt9js7lzqTTWfKzwErOsXiYE3tfJF0Mk,37454
+pip/_internal/locations.py,sha256=MEkFeloQEtkH2EgMbpAI2wHFDXVFV299pw_b1nCGYIM,6870
+pip/_internal/main.py,sha256=LqoUFbyaZAZ1wZ0xSZ6wIIx9-m1JoSnSDztWnjR_pMo,437
+pip/_internal/models/__init__.py,sha256=3DHUd_qxpPozfzouoqa9g9ts1Czr5qaHfFxbnxriepM,63
+pip/_internal/models/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/models/__pycache__/candidate.cpython-39.pyc,,
+pip/_internal/models/__pycache__/direct_url.cpython-39.pyc,,
+pip/_internal/models/__pycache__/format_control.cpython-39.pyc,,
+pip/_internal/models/__pycache__/index.cpython-39.pyc,,
+pip/_internal/models/__pycache__/link.cpython-39.pyc,,
+pip/_internal/models/__pycache__/scheme.cpython-39.pyc,,
+pip/_internal/models/__pycache__/search_scope.cpython-39.pyc,,
+pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc,,
+pip/_internal/models/__pycache__/target_python.cpython-39.pyc,,
+pip/_internal/models/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/models/candidate.py,sha256=GmprVP8YD1kXg4VlREolYjC_fqwLl7LfeCN-ZBSNNig,1196
+pip/_internal/models/direct_url.py,sha256=ZE07jfJmU_AlLgYOkuFup7kgsZP5k8BRewB8YXp50mc,6884
+pip/_internal/models/format_control.py,sha256=YFi9CrJrfpEkuS2DOCtrWqYudrho1BHaBSwT8KexxH8,2823
+pip/_internal/models/index.py,sha256=carvxxaT7mJyoEkptaECHUZiNaA6R5NrsGF55zawNn8,1161
+pip/_internal/models/link.py,sha256=BywYuw790dC1zvSFij8-Cm4QZfmUcupe6xSAmk3i8CM,7471
+pip/_internal/models/scheme.py,sha256=EhPkT_6G0Md84JTLSVopYsp5H_K6BREYmFvU8H6wMK8,778
+pip/_internal/models/search_scope.py,sha256=Lum0mY4_pdR9DDBy6HV5xHGIMPp_kU8vMsqYKFHZip4,4751
+pip/_internal/models/selection_prefs.py,sha256=1lS2d6nbrMrjWgRuwdl05tnGChjtDijKjG4XCbnuLmc,2045
+pip/_internal/models/target_python.py,sha256=PK8GMs15pSUGCG18RgTGmvxvYE8-M5WKnudl4CikTYM,4070
+pip/_internal/models/wheel.py,sha256=FTfzVb4WIbfIehxhdlAVvCil_MQ0-W44oyN56cE6NHc,2772
+pip/_internal/network/__init__.py,sha256=jf6Tt5nV_7zkARBrKojIXItgejvoegVJVKUbhAa5Ioc,50
+pip/_internal/network/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/network/__pycache__/auth.cpython-39.pyc,,
+pip/_internal/network/__pycache__/cache.cpython-39.pyc,,
+pip/_internal/network/__pycache__/download.cpython-39.pyc,,
+pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc,,
+pip/_internal/network/__pycache__/session.cpython-39.pyc,,
+pip/_internal/network/__pycache__/utils.cpython-39.pyc,,
+pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc,,
+pip/_internal/network/auth.py,sha256=ntH7kjy1f6OI0O8s8RncqhyjwiiNkMChJVFB9PInP08,11652
+pip/_internal/network/cache.py,sha256=6rpBfrrzr9SaBy7_AM1EUH1pSFYq1pXCftMqk-1kkQQ,2329
+pip/_internal/network/download.py,sha256=mcmjWRKFOwdL6niizxm0ACv9tdf06TOYBK_xY4l_3c4,6401
+pip/_internal/network/lazy_wheel.py,sha256=o8DD4VooJvZJ2SfBsZDI4i85eONCITQKLydfklNroh0,8121
+pip/_internal/network/session.py,sha256=doOFU1lep6MjHBS_H1AVmRzcwEs7zcXbJtsfu7Xcgy0,15449
+pip/_internal/network/utils.py,sha256=ZPHg7u6DEcg2EvILIdPECnvPLp21OPHxNVmeXfMy-n0,4172
+pip/_internal/network/xmlrpc.py,sha256=4GnaQBJBKycuyWStRYUi93kmv70XootLfxOymAsP4SM,1883
+pip/_internal/operations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/operations/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/operations/__pycache__/check.cpython-39.pyc,,
+pip/_internal/operations/__pycache__/freeze.cpython-39.pyc,,
+pip/_internal/operations/__pycache__/prepare.cpython-39.pyc,,
+pip/_internal/operations/build/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc,,
+pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc,,
+pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc,,
+pip/_internal/operations/build/metadata.py,sha256=lXcRhnnN2-f49dYBNf1_NLkHZ-s-4OPV7tCOyJJmZ94,1255
+pip/_internal/operations/build/metadata_legacy.py,sha256=VgzBTk8naIO8-8N_ifEYF7ZAxWUDhphWVIaVlZ2FqYM,2011
+pip/_internal/operations/build/wheel.py,sha256=Ya0i8_uzfssdN2vorOVzNJYbAYVTLUnSZimCFdP4F7w,1466
+pip/_internal/operations/build/wheel_legacy.py,sha256=9CnTpc25Agvl9MnMgrVnHUWTlJ3um8aV4m9dbGdGHi0,3347
+pip/_internal/operations/check.py,sha256=EPNWcQyUSc3_pa_6Npv_mI5sXZ5zqRrmk0M67YViDIY,5216
+pip/_internal/operations/freeze.py,sha256=35mnNtUYhwYb_Lioo1RxHEgD7Eqm3KUqOOJ6RQQT_7Y,10411
+pip/_internal/operations/install/__init__.py,sha256=mX7hyD2GNBO2mFGokDQ30r_GXv7Y_PLdtxcUv144e-s,51
+pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc,,
+pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc,,
+pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/operations/install/editable_legacy.py,sha256=rJ_xs2qtDUjpY2-n6eYlVyZiNoKbOtZXZrYrcnIELt4,1488
+pip/_internal/operations/install/legacy.py,sha256=zu3Gw54dgHtluyW5n8j5qKcAScidQXJvqB8fb0oLB-4,4281
+pip/_internal/operations/install/wheel.py,sha256=ENg_QbLbBnwYiPt1lzFIrQGu2QhkECxKm9_dTaaz5TU,31247
+pip/_internal/operations/prepare.py,sha256=-MKVSMKGYpqJ0y6fa1gq3eDvSKhR0ZLXZVlzaC_TVNo,22460
+pip/_internal/pyproject.py,sha256=DoQzvtOh5_wCPpU8E-J3IDCOKHvJw_SIY_gI8ih4I58,7400
+pip/_internal/req/__init__.py,sha256=s-E5Vxxqqpcs7xfY5gY69oHogsWJ4sLbnUiDoWmkHOU,3133
+pip/_internal/req/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/req/__pycache__/constructors.cpython-39.pyc,,
+pip/_internal/req/__pycache__/req_file.cpython-39.pyc,,
+pip/_internal/req/__pycache__/req_install.cpython-39.pyc,,
+pip/_internal/req/__pycache__/req_set.cpython-39.pyc,,
+pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc,,
+pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc,,
+pip/_internal/req/constructors.py,sha256=0pLw8q5kozJyAUfFNCHGC3Y1acQV7FxuD6f-fVmrOMo,16135
+pip/_internal/req/req_file.py,sha256=f62QFxszUwN1q14Z_YZ3GdYm8mUCe2WoD0r8sDebQoE,18594
+pip/_internal/req/req_install.py,sha256=1d1QqpMV-xgGkNTF4j1guPNDV4_SxPbaFrvAvQthcrk,33803
+pip/_internal/req/req_set.py,sha256=csA7N4VelGpf-ovyFQRaxR9XTeAk2j9kiZHO6SIDxW0,7887
+pip/_internal/req/req_tracker.py,sha256=fVl3Pgl3yl12rFBQICYpy3StxWxD3j5pDWrHo8QmP7g,4691
+pip/_internal/req/req_uninstall.py,sha256=vuT3vX3zab3d8Gh-p1AgoDhpKU1P3OVyuC8a_57Es4U,23771
+pip/_internal/resolution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/resolution/__pycache__/base.cpython-39.pyc,,
+pip/_internal/resolution/base.py,sha256=MemTQyKXiVrtdxsGzuI7QqBd7Ek0wNHvCoe3ZLZO4_A,683
+pip/_internal/resolution/legacy/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc,,
+pip/_internal/resolution/legacy/resolver.py,sha256=4aLvLZt0_BPHLaROEl9IjEhza9CZia8PLHlvZfMUMoQ,18234
+pip/_internal/resolution/resolvelib/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc,,
+pip/_internal/resolution/resolvelib/base.py,sha256=Kw8tB9Q7bYlJPIZmR4bGGRruk4SU9io5dnzshRVRvI4,5061
+pip/_internal/resolution/resolvelib/candidates.py,sha256=WNQUFRfJOokXCdpbTMadg9KcL2PXmhwnoXMwD6-E2Vo,20083
+pip/_internal/resolution/resolvelib/factory.py,sha256=ovOeMdAC2vhsZZLZbMqnisZaoBDlF8d64fJdpVCSMto,18946
+pip/_internal/resolution/resolvelib/found_candidates.py,sha256=_o9lCikecM_61kgl5xCKAByv_haREFlrc1qRoyVB9ts,3773
+pip/_internal/resolution/resolvelib/provider.py,sha256=bFS1-xUV9Pz1DefrDNfFaSlBjM785ftzoJi_fXbzdig,7339
+pip/_internal/resolution/resolvelib/reporter.py,sha256=dw4K2w0m7HEgxFF3r60voTrFDDPyhBLN8rzw4cQXaoo,2857
+pip/_internal/resolution/resolvelib/requirements.py,sha256=sps2y82iZtBdjPHZ16Ej9A4KdI7_8YC9R9nhAo1abyA,5969
+pip/_internal/resolution/resolvelib/resolver.py,sha256=ZHXXMwLkSUXfs0LG7gVK1IuIqNZlORNrwXjBmBVmDN4,11707
+pip/_internal/self_outdated_check.py,sha256=cVPuBaP89nm8Qdf_vVdXZxwtt8ebm4tL8fcStPl3dU8,6745
+pip/_internal/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pip/_internal/utils/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/compat.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/datetime.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/encoding.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/glibc.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/hashes.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/logging.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/misc.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/models.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/packaging.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/parallel.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/typing.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/urls.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc,,
+pip/_internal/utils/__pycache__/wheel.cpython-39.pyc,,
+pip/_internal/utils/appdirs.py,sha256=RZzUG-Bkh2b-miX0DSZ3v703_-bgK-v0PfWCCjwVE9g,1349
+pip/_internal/utils/compat.py,sha256=JoSVxgMmV8ZZTwXrPRGgQk1EyomJZM3gb-nolCxslko,9489
+pip/_internal/utils/compatibility_tags.py,sha256=2frtUos4dHeHKV38noN_rs_u8VTehy4eMxqyEYVtZtY,5690
+pip/_internal/utils/datetime.py,sha256=KL-vIdGU9JIpGB5NYkmwXWkH-G_2mvvABlmRtoSZsao,295
+pip/_internal/utils/deprecation.py,sha256=pBnNogoA4UGTxa_JDnPXBRRYpKMbExAhXpBwAwklOBs,3318
+pip/_internal/utils/direct_url_helpers.py,sha256=Q0c-z0iuQx_D1FeRlu7nZD5h2nt4QSow23B26PQrp0s,4146
+pip/_internal/utils/distutils_args.py,sha256=a56mblNxk9BGifbpEETG61mmBrqhjtjRkJ4HYn-oOEE,1350
+pip/_internal/utils/encoding.py,sha256=53p3H36wc49dyr0EgtBbdHdvH4Dr-Egl0zc_J0sweqc,1284
+pip/_internal/utils/entrypoints.py,sha256=yvizXdrIeK44OI-J2YBIcojfrXxGO9oe8JCxBvMdxIk,1152
+pip/_internal/utils/filesystem.py,sha256=-fU3XteCAIJwf_9FvCZU7vhywvt3nuf_cqkCdwgy1Y8,6943
+pip/_internal/utils/filetypes.py,sha256=QvagL0Vm4tMZ_qyFqopZWpaDHEM3Q6FyF35vfOY-CJg,847
+pip/_internal/utils/glibc.py,sha256=LOeNGgawCKS-4ke9fii78fwXD73dtNav3uxz1Bf-Ab8,3297
+pip/_internal/utils/hashes.py,sha256=ydFGVhDk0Nj2JyaTKzUHRe5iBnbgh4KG-HFtXbr_xmo,5297
+pip/_internal/utils/inject_securetransport.py,sha256=M17ZlFVY66ApgeASVjKKLKNz0LAfk-SyU0HZ4ZB6MmI,810
+pip/_internal/utils/logging.py,sha256=YIfuDUEkmdn9cIRQ_Ec8rgXs1m5nOwDECtZqM4CBH5U,13093
+pip/_internal/utils/misc.py,sha256=BpnBnDkypGrWZHIBFU0g9IYsO6rglX8sQVnUselvY-8,28698
+pip/_internal/utils/models.py,sha256=HqiBVtTbW_b_Umvj2fjhDWOHo2RKhPwSz4iAYkQZ688,1201
+pip/_internal/utils/packaging.py,sha256=KOLx30EXZobHKTaA8khLNqEMb986DeaCcgDhZHaw6RY,3036
+pip/_internal/utils/parallel.py,sha256=d6wJWWHnPOcwO4pyL7pv08DG3l_5YtHzIBdhHhI3epw,3404
+pip/_internal/utils/pkg_resources.py,sha256=ZX-k7V5q_aNWyDse92nN7orN1aCpRLsaxzpkBZ1XKzU,1254
+pip/_internal/utils/setuptools_build.py,sha256=E1KswI7wfNnCDE5R6G8c9ZbByENpu7NqocjY26PCQDw,5058
+pip/_internal/utils/subprocess.py,sha256=nihl4bmnTpU4wQPjJESYNdTrS2-5T1SC00kM2JZx2gI,10866
+pip/_internal/utils/temp_dir.py,sha256=cmFpYI_5VDeXUsGvia9jUNh8XEKXYvpGlIi_iq2MRVU,8845
+pip/_internal/utils/typing.py,sha256=xkYwOeHlf4zsHXBDC4310HtEqwhQcYXFPq2h35Tcrl0,1401
+pip/_internal/utils/unpacking.py,sha256=YFAckhqqvmehA8Kan5vd3b1kN_9TafqmOk4b-yz4fho,9488
+pip/_internal/utils/urls.py,sha256=q2rw1kMiiig_XZcoyJSsWMJQqYw-2wUmrMoST4mCW_I,1527
+pip/_internal/utils/virtualenv.py,sha256=fNGrRp-8QmNL5OzXajBd-z7PbwOsx1XY6G-AVMAhfso,3706
+pip/_internal/utils/wheel.py,sha256=wFzn3h8GqYvgsyWPZtUyn0Rb3MJzmtyP3owMOhKnmL0,7303
+pip/_internal/vcs/__init__.py,sha256=viJxJRqRE_mVScum85bgQIXAd6o0ozFt18VpC-qIJrM,617
+pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc,,
+pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc,,
+pip/_internal/vcs/__pycache__/git.cpython-39.pyc,,
+pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc,,
+pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc,,
+pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc,,
+pip/_internal/vcs/bazaar.py,sha256=ivvSGrrYbryp7TU9Vn8hkJddcYCRfvKzqPx05o_G71k,4016
+pip/_internal/vcs/git.py,sha256=_RePK_kSTbjzsQCn5Dv-alIxoLPJu2GkhFjehd20bpY,15893
+pip/_internal/vcs/mercurial.py,sha256=EcevyquppjAS-y1CrDxcFPwAid0d9gEGhxVp_DUJSZ0,5564
+pip/_internal/vcs/subversion.py,sha256=OajehInnYm8T9BVD-yeaIjN5hG_F9ZSJqFlt5OZqEuk,12558
+pip/_internal/vcs/versioncontrol.py,sha256=_FmtOI-jxJl5vthUgedDgNJG-OHQK_6SLoEIvTNIES4,23767
+pip/_internal/wheel_builder.py,sha256=krzl8rpbRqlXDb3W---hqTPn09msEprUmpqpG2Bcys4,11889
+pip/_vendor/__init__.py,sha256=9W5OMec7OR5iGiLkewOfrMJ9Wt-FjLAezVSYzwHc2ds,5156
+pip/_vendor/__pycache__/__init__.cpython-39.pyc,,
+pip/_vendor/vendor.txt,sha256=B9Th9JlPs1TDBKZkMFiB54aghp1RFZHuJ5djqKyl6a0,437
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/REQUESTED b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ef99c6cf3283b50a273ac4c6d009a0aa85597070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/WHEEL
@@ -0,0 +1,6 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..9609f72c5417b635743be3f8ec1ff1e507665f2e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/entry_points.txt
@@ -0,0 +1,5 @@
+[console_scripts]
+pip = pip._internal.cli.main:main
+pip3 = pip._internal.cli.main:main
+pip3.9 = pip._internal.cli.main:main
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip-20.3.4.dist-info/top_level.txt
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..f9bd0632fe296a4cf821f8776239bee14188a4c7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/__init__.py
@@ -0,0 +1,18 @@
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import List, Optional
+
+
+__version__ = "20.3.4"
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/__main__.py b/TP03/TP03/lib/python3.9/site-packages/pip/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c2505fa5bd3e8ad7da3a5c500dcf76cf1eb3810
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/__main__.py
@@ -0,0 +1,26 @@
+from __future__ import absolute_import
+
+import os
+import sys
+
+# Remove '' and current working directory from the first entry
+# of sys.path, if present to avoid using current directory
+# in pip commands check, freeze, install, list and show,
+# when invoked as python -m pip <command>
+if sys.path[0] in ('', os.getcwd()):
+    sys.path.pop(0)
+
+# If we are running from a wheel, add the wheel to sys.path
+# This allows the usage python pip-*.whl/pip install pip-*.whl
+if __package__ == '':
+    # __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/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ee721df94d4a3de283ed9c4932900ee96f8b8716
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ef8a6682f19115b1d85d9a25e15dbd0c7366fc19
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/__pycache__/__main__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a778e99488eb1c6b16da50915b70e84b0dc76912
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__init__.py
@@ -0,0 +1,17 @@
+import pip._internal.utils.inject_securetransport  # noqa
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import List, Optional
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..797f3e10369906322ea705bbb58e90298974efc1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f0a77912122d1d87388aa08d24d41b427f95a1c3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/build_env.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6df1d9fba8c49dce11b10dc09a09174e6d0f12c4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/cache.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..aec9dd23ca9783eee55df8ee6808d090b3f7eb37
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/configuration.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e3883efb15cd5c1497eee659d66d05a2d60633ff
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/exceptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/locations.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/locations.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dad10af744e61d4900b2bbec5faeb76ebdad0445
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/locations.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ebe9ef73e532f5e8186e7b3cdeaee0e0b9639c3f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/main.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..16b177acc9540aaa4059a9dbdf6083edc4f03942
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/pyproject.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a8910fb5a4622dc0bac0421e5b383ff27604c7a2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/self_outdated_check.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..886f2445ad467554c8f766e8ef0bb21d95ee4992
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/__pycache__/wheel_builder.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/build_env.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/build_env.py
new file mode 100644
index 0000000000000000000000000000000000000000..a08e63cd051cdec2d5847cb322db4b4411347915
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/build_env.py
@@ -0,0 +1,242 @@
+"""Build Environment used for isolation during sdist building
+"""
+
+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.cli.spinners import open_spinner
+from pip._internal.utils.subprocess import call_subprocess
+from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from types import TracebackType
+    from typing import Iterable, List, Optional, Set, Tuple, Type
+
+    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
+        temp_dir = TempDirectory(
+            kind=tempdir_kinds.BUILD_ENV, globally_managed=True
+        )
+
+        self._prefixes = OrderedDict((
+            (name, _Prefix(os.path.join(temp_dir.path, name)))
+            for name in ('normal', 'overlay')
+        ))
+
+        self._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(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):
+        # type: () -> None
+        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,  # type: Optional[Type[BaseException]]
+        exc_val,  # type: Optional[BaseException]
+        exc_tb  # type: Optional[TracebackType]
+    ):
+        # type: (...) -> None
+        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 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: 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')
+        if finder.prefer_binary:
+            args.append('--prefer-binary')
+        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):
+        # type: () -> None
+        pass
+
+    def __enter__(self):
+        # type: () -> None
+        pass
+
+    def __exit__(
+        self,
+        exc_type,  # type: Optional[Type[BaseException]]
+        exc_val,  # type: Optional[BaseException]
+        exc_tb  # type: Optional[TracebackType]
+    ):
+        # type: (...) -> None
+        pass
+
+    def cleanup(self):
+        # type: () -> None
+        pass
+
+    def install_requirements(
+        self,
+        finder,  # type: PackageFinder
+        requirements,  # type: Iterable[str]
+        prefix_as_string,  # type: str
+        message  # type: str
+    ):
+        # type: (...) -> None
+        raise NotImplementedError()
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cache.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cache.py
new file mode 100644
index 0000000000000000000000000000000000000000..def8dd64a18ea762a713d09db55535014cbebd30
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cache.py
@@ -0,0 +1,346 @@
+"""Cache Management
+"""
+
+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, tempdir_kinds
+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 Any, Dict, List, Optional, Set
+
+    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, 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()
+
+
+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)
+        assert self.cache_dir
+        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)
+        assert self.cache_dir
+        # 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 %s for %s as it "
+                    "does not match the expected distribution name %s.",
+                    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=tempdir_kinds.EPHEM_WHEEL_CACHE,
+            globally_managed=True,
+        )
+
+        super(EphemWheelCache, self).__init__(
+            self._temp_dir.path, format_control
+        )
+
+
+class CacheEntry(object):
+    def __init__(
+        self,
+        link,  # type: Link
+        persistent,  # type: bool
+    ):
+        self.link = link
+        self.persistent = persistent
+
+
+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
+        cache_entry = self.get_cache_entry(link, package_name, supported_tags)
+        if cache_entry is None:
+            return link
+        return cache_entry.link
+
+    def get_cache_entry(
+        self,
+        link,            # type: Link
+        package_name,    # type: Optional[str]
+        supported_tags,  # type: List[Tag]
+    ):
+        # type: (...) -> Optional[CacheEntry]
+        """Returns a CacheEntry with a link to a cached item if it exists or
+        None. The cache entry indicates if the item was found in the persistent
+        or ephemeral cache.
+        """
+        retval = self._wheel_cache.get(
+            link=link,
+            package_name=package_name,
+            supported_tags=supported_tags,
+        )
+        if retval is not link:
+            return CacheEntry(retval, persistent=True)
+
+        retval = self._ephem_cache.get(
+            link=link,
+            package_name=package_name,
+            supported_tags=supported_tags,
+        )
+        if retval is not link:
+            return CacheEntry(retval, persistent=False)
+
+        return None
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e589bb917e23823e25f9fff7e0849c4d6d4a62bc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__init__.py
@@ -0,0 +1,4 @@
+"""Subpackage containing all of pip's command line interface related code
+"""
+
+# This file intentionally does not import submodules
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d4c31e8a83aada90419bfd33dac87e323add0a87
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..722ee53f4a3a0e48ae471d21664b6990ac19b1cd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/autocompletion.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..53042607520819785818f978a537b222f7e74706
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/base_command.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2ae895df33aaa03c1d79bbef8998d4a4791d863c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/cmdoptions.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..00976b50f04e3e7d67a7980ef659d611be7ccf83
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/command_context.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d9b5eafaf0661be043a0daa89ab887b3a06ed910
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7c81124717601058b06189ccc3e7c799e3324302
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/main_parser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..47e91ba39562f46d7f2ceb2da4b96fafa4ac6657
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/parser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..837f1ea3362c2fb30b97ded8262ce4ae7a446f96
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/progress_bars.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..af51a8ee7a71e41db75c2d4c57ab3cf6f0e3cd5e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/req_command.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a1087cbfb48e843ba1ed30ab3ccfece759eab7b2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/spinners.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d02e423fffd72273ce180692cc5be86a95ea65d7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/__pycache__/status_codes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py
new file mode 100644
index 0000000000000000000000000000000000000000..329de602513d7bb868799a49d36d3f081a79e441
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/autocompletion.py
@@ -0,0 +1,164 @@
+"""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
+        # ``<file>``, ``<dir>`` or ``<path>``
+        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 ``<dir>`` after option
+        # complete directories when there is ``<file>``, ``<path>`` or
+        # ``<dir>``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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/base_command.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/base_command.py
new file mode 100644
index 0000000000000000000000000000000000000000..41e7dcf101bd61912107972691bcf9a7670a62cc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/base_command.py
@@ -0,0 +1,260 @@
+"""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._vendor.six import PY2
+
+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,
+    UNKNOWN_ERROR,
+    VIRTUALENV_NOT_FOUND,
+)
+from pip._internal.exceptions import (
+    BadCommand,
+    CommandError,
+    InstallationError,
+    NetworkConnectionError,
+    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, tempdir_registry
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+from pip._internal.utils.virtualenv import running_under_virtualenv
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Any, List, Optional, Tuple
+
+    from pip._internal.utils.temp_dir import (
+        TempDirectoryTypeRegistry as TempDirRegistry,
+    )
+
+__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': '{} {}'.format(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)
+
+        self.tempdir_registry = None  # type: Optional[TempDirRegistry]
+
+        # Commands should add options to this option group
+        optgroup_name = '{} Options'.format(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)
+
+        self.add_options()
+
+    def add_options(self):
+        # type: () -> None
+        pass
+
+    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]) -> int
+        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
+        # We must initialize this before the tempdir manager, otherwise the
+        # configuration would not be accessible by the time we clean up the
+        # tempdir manager.
+        self.tempdir_registry = self.enter_context(tempdir_registry())
+        # 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 = (
+                "pip 21.0 will drop support for Python 2.7 in January 2021. "
+                "More details about Python 2 support in pip can be found at "
+                "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="21.0")
+
+        if (
+            sys.version_info[:2] == (3, 5) and
+            not options.no_python_version_warning
+        ):
+            message = (
+                "Python 3.5 reached the end of its life on September "
+                "13th, 2020. Please upgrade your Python as Python 3.5 "
+                "is no longer maintained. pip 21.0 will drop support "
+                "for Python 3.5 in January 2021."
+            )
+            deprecated(message, replacement=None, gone_in="21.0")
+
+        # 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
+
+        if getattr(options, "build_dir", None):
+            deprecated(
+                reason=(
+                    "The -b/--build/--build-dir/--build-directory "
+                    "option is deprecated and has no effect anymore."
+                ),
+                replacement=(
+                    "use the TMPDIR/TEMP/TMP environment variable, "
+                    "possibly combined with --no-clean"
+                ),
+                gone_in="21.1",
+                issue=8333,
+            )
+
+        if '2020-resolver' in options.features_enabled and not PY2:
+            logger.warning(
+                "--use-feature=2020-resolver no longer has any effect, "
+                "since it is now the default dependency resolver in pip. "
+                "This will become an error in pip 21.0."
+            )
+
+        try:
+            status = self.run(options, args)
+            assert 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,
+                NetworkConnectionError) 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)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4af37baa0f2ecbba1b3a6e93081ac9017e7d247
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/cmdoptions.py
@@ -0,0 +1,971 @@
+"""
+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 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._vendor.packaging.utils import canonicalize_name
+
+from pip._internal.cli.progress_bars import BAR_TYPES
+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
+
+if MYPY_CHECK_RUNNING:
+    from optparse import OptionParser, Values
+    from typing import Any, Callable, Dict, Optional, Tuple
+
+    from pip._internal.cli.parser import ConfigOptionParser
+
+
+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.platforms,
+        options.abis,
+        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)
+
+
+def _package_name_option_check(option, opt, value):
+    # type: (Option, str, str) -> str
+    return canonicalize_name(value)
+
+
+class PipOption(Option):
+    TYPES = Option.TYPES + ("path", "package_name")
+    TYPE_CHECKER = Option.TYPE_CHECKER.copy()
+    TYPE_CHECKER["package_name"] = _package_name_option_check
+    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="Disable prompting for input."
+)  # 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]
+
+
+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 such as sdist (.tar.gz) or wheel (.whl) files. "
+             "If a local path or file:// URL that's a directory,  "
+             "then look for archives in the directory listing. "
+             "Links to VCS project URLs are not supported.",
+    )
+
+
+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 "<venv path>/src". '
+    'The default for global installs is "<current dir>/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 (notice '
+             'the colons), or one or more package names with commas between '
+             'them (no colons). Note that some packages are tricky to compile '
+             'and may fail to install when this option is used on them.',
+    )
+
+
+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.',
+    )
+
+
+platforms = partial(
+    Option,
+    '--platform',
+    dest='platforms',
+    metavar='platform',
+    action='append',
+    default=None,
+    help=("Only use wheels compatible with <platform>. Defaults to the "
+          "platform of the running system. Use this option multiple times to "
+          "specify multiple platforms supported by the target interpreter."),
+)  # 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 <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]
+
+
+abis = partial(
+    Option,
+    '--abi',
+    dest='abis',
+    metavar='abi',
+    action='append',
+    default=None,
+    help=("Only use wheels compatible with Python abi <abi>, e.g. 'pypy_41'. "
+          "If not specified, then the current interpreter abi tag is used. "
+          "Use this option multiple times to specify multiple abis supported "
+          "by the target interpreter. 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(platforms())
+    cmd_opts.add_option(python_version())
+    cmd_opts.add_option(implementation())
+    cmd_opts.add_option(abis())
+
+
+def make_target_python(options):
+    # type: (Values) -> TargetPython
+    target_python = TargetPython(
+        platforms=options.platforms,
+        py_version_info=options.python_version,
+        abis=options.abis,
+        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 <dir>."
+)  # 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]
+
+build_dir = partial(
+    PipOption,
+    '-b', '--build', '--build-dir', '--build-directory',
+    dest='build_dir',
+    type='path',
+    metavar='dir',
+    help=SUPPRESS_HELP,
+)  # 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]
+
+
+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 {} must be a hash name '  # noqa
+                     'followed by a value, like --hash=sha256:'
+                     'abcde...'.format(opt_str))
+    if algo not in STRONG_HASHES:
+        parser.error('Allowed hash algorithms for {} are {}.'.format(  # noqa
+                     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'"
+        )
+
+
+list_exclude = partial(
+    PipOption,
+    '--exclude',
+    dest='excludes',
+    action='append',
+    metavar='package',
+    type='package_name',
+    help="Exclude specified package from the output",
+)  # type: Callable[..., Option]
+
+
+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]
+
+
+use_new_feature = partial(
+    Option,
+    '--use-feature',
+    dest='features_enabled',
+    metavar='feature',
+    action='append',
+    default=[],
+    choices=['2020-resolver', 'fast-deps'],
+    help='Enable new functionality, that may be backward incompatible.',
+)  # type: Callable[..., Option]
+
+use_deprecated_feature = partial(
+    Option,
+    '--use-deprecated',
+    dest='deprecated_features_enabled',
+    metavar='feature',
+    action='append',
+    default=[],
+    choices=['legacy-resolver'],
+    help=(
+        'Enable deprecated functionality, that will be removed in the future.'
+    ),
+)  # type: Callable[..., Option]
+
+
+##########
+# groups #
+##########
+
+general_group = {
+    'name': 'General Options',
+    'options': [
+        help_,
+        isolated_mode,
+        require_virtualenv,
+        verbose,
+        version,
+        quiet,
+        log,
+        no_input,
+        proxy,
+        retries,
+        timeout,
+        exists_action,
+        trusted_host,
+        cert,
+        client_cert,
+        cache_dir,
+        no_cache,
+        disable_pip_version_check,
+        no_color,
+        no_python_version_warning,
+        use_new_feature,
+        use_deprecated_feature,
+    ]
+}  # 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/command_context.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/command_context.py
new file mode 100644
index 0000000000000000000000000000000000000000..669c777749d0e377e7087a7c2dbb4cc4281a365b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/command_context.py
@@ -0,0 +1,36 @@
+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 ContextManager, Iterator, 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main.py
new file mode 100644
index 0000000000000000000000000000000000000000..172f30dd5bf550158a6b24fe020001616839da11
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main.py
@@ -0,0 +1,75 @@
+"""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: {}".format(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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..ba3cf68aafb3409198069633fb79d06c66a19a1e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/main_parser.py
@@ -0,0 +1,96 @@
+"""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 List, Tuple
+
+
+__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 <command> [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 = [''] + [
+        '{name:27} {command_info.summary}'.format(**locals())
+        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 "{}"'.format(cmd_name)]
+        if guess:
+            msg.append('maybe you meant "{}"'.format(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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/parser.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..7170bfd38419f334c92fb5006cbd4587e042f87a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/parser.py
@@ -0,0 +1,285 @@
+"""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.contextlib2 import suppress
+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
+from pip._internal.utils.misc import redact_auth_from_url
+
+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)
+
+    def _format_option_strings(self, option, mvarfmt=' <{}>', 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
+        :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.format(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: {}\n'.format(
+            self.indent_lines(textwrap.dedent(usage), "  "))
+        return msg
+
+    def format_description(self, description):
+        # leave full control over description to us
+        if description:
+            if hasattr(self.parser, 'main'):
+                label = 'Commands'
+            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 = '{}:\n{}\n'.format(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.
+
+    Also redact auth from url type options
+    """
+
+    def expand_default(self, option):
+        default_values = None
+        if self.parser is not None:
+            self.parser._update_defaults(self.parser.defaults)
+            default_values = self.parser.defaults.get(option.dest)
+        help_text = optparse.IndentedHelpFormatter.expand_default(self, option)
+
+        if default_values and option.metavar == 'URL':
+            if isinstance(default_values, string_types):
+                default_values = [default_values]
+
+            # If its not a list, we should abort and just return the help text
+            if not isinstance(default_values, list):
+                default_values = []
+
+            for val in default_values:
+                help_text = help_text.replace(
+                    val, redact_auth_from_url(val))
+
+        return help_text
+
+
+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: {}".format(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'):
+                try:
+                    val = strtobool(val)
+                except ValueError:
+                    self.error(
+                        '{} is not a valid value for {} option, '  # noqa
+                        'please specify a boolean value like yes/no, '
+                        'true/false or 1/0 instead.'.format(val, key)
+                    )
+            elif option.action == 'count':
+                with suppress(ValueError):
+                    val = strtobool(val)
+                with suppress(ValueError):
+                    val = int(val)
+                if not isinstance(val, int) or val < 0:
+                    self.error(
+                        '{} is not a valid value for {} option, '  # noqa
+                        'please instead specify either a non-negative integer '
+                        'or a boolean value like yes/no or false/true '
+                        'which is equivalent to 1/0.'.format(val, key)
+                    )
+            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, "{}\n".format(msg))
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py
new file mode 100644
index 0000000000000000000000000000000000000000..69338552f13ecb80730127480f644b2e3d49a71d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/progress_bars.py
@@ -0,0 +1,280 @@
+from __future__ import division
+
+import itertools
+import sys
+from signal import SIGINT, default_int_handler, signal
+
+from pip._vendor import six
+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, Dict, List
+
+try:
+    from pip._vendor import colorama
+# Lots of different errors can come from this, including SystemError and
+# ImportError.
+except Exception:
+    colorama = None
+
+
+def _select_progress_class(preferred, fallback):
+    # type: (Bar, Bar) -> Bar
+    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):
+        # type: (List[Any], Dict[Any, Any]) -> None
+        """
+        Save the original SIGINT handler for later.
+        """
+        # https://github.com/python/mypy/issues/5887
+        super(InterruptibleMixin, self).__init__(  # type: ignore
+            *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):
+        # type: () -> None
+        """
+        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()  # type: ignore
+        signal(SIGINT, self.original_handler)
+
+    def handle_sigint(self, signum, frame):  # type: ignore
+        """
+        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):
+        # type: () -> None
+        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):
+        # type: (List[Any], Dict[Any, Any]) -> None
+        # https://github.com/python/mypy/issues/5887
+        super(DownloadProgressMixin, self).__init__(  # type: ignore
+            *args,
+            **kwargs
+        )
+        self.message = (" " * (
+            get_indentation() + 2
+        )) + self.message  # type: str
+
+    @property
+    def downloaded(self):
+        # type: () -> str
+        return format_size(self.index)  # type: ignore
+
+    @property
+    def download_speed(self):
+        # type: () -> str
+        # Avoid zero division errors...
+        if self.avg == 0.0:  # type: ignore
+            return "..."
+        return format_size(1 / self.avg) + "/s"  # type: ignore
+
+    @property
+    def pretty_eta(self):
+        # type: () -> str
+        if self.eta:  # type: ignore
+            return "eta {}".format(self.eta_td)  # type: ignore
+        return ""
+
+    def iter(self, it):  # type: ignore
+        for x in it:
+            yield x
+            # B305 is incorrectly raised here
+            # https://github.com/PyCQA/flake8-bugbear/issues/59
+            self.next(len(x))  # noqa: B305
+        self.finish()
+
+
+class WindowsMixin(object):
+
+    def __init__(self, *args, **kwargs):
+        # type: (List[Any], Dict[Any, Any]) -> None
+        # The Windows terminal does not support the hide/show cursor ANSI codes
+        # 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:  # type: ignore
+            self.hide_cursor = False
+
+        # https://github.com/python/mypy/issues/5887
+        super(WindowsMixin, self).__init__(*args, **kwargs)  # type: ignore
+
+        # 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)  # type: ignore
+            # 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"
+
+
+class DefaultDownloadProgressBar(BaseDownloadProgressBar,
+                                 _BaseBar):
+    pass
+
+
+class DownloadSilentBar(BaseDownloadProgressBar, SilentBar):
+    pass
+
+
+class DownloadBar(BaseDownloadProgressBar,
+                  Bar):
+    pass
+
+
+class DownloadFillingCirclesBar(BaseDownloadProgressBar,
+                                FillingCirclesBar):
+    pass
+
+
+class DownloadBlueEmojiProgressBar(BaseDownloadProgressBar,
+                                   BlueEmojiBar):
+    pass
+
+
+class DownloadProgressSpinner(WindowsMixin, InterruptibleMixin,
+                              DownloadProgressMixin, Spinner):
+
+    file = sys.stdout
+    suffix = "%(downloaded)s %(download_speed)s"
+
+    def next_phase(self):
+        # type: () -> str
+        if not hasattr(self, "_phaser"):
+            self._phaser = itertools.cycle(self.phases)
+        return next(self._phaser)
+
+    def update(self):
+        # type: () -> None
+        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):  # type: ignore
+    if max is None or max == 0:
+        return BAR_TYPES[progress_bar][1]().iter
+    else:
+        return BAR_TYPES[progress_bar][0](max=max).iter
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/req_command.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/req_command.py
new file mode 100644
index 0000000000000000000000000000000000000000..008066ab1c4df211f16216cd11639045381f8657
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/req_command.py
@@ -0,0 +1,436 @@
+"""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._vendor.six import PY2
+
+from pip._internal.cli import cmdoptions
+from pip._internal.cli.base_command import Command
+from pip._internal.cli.command_context import CommandContextMixIn
+from pip._internal.exceptions import CommandError, PreviousBuildDirError
+from pip._internal.index.collector import LinkCollector
+from pip._internal.index.package_finder import PackageFinder
+from pip._internal.models.selection_prefs import SelectionPreferences
+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_parsed_requirement,
+    install_req_from_req_string,
+)
+from pip._internal.req.req_file import parse_requirements
+from pip._internal.self_outdated_check import pip_self_version_check
+from pip._internal.utils.temp_dir import tempdir_kinds
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Any, List, Optional, Tuple
+
+    from pip._internal.cache import WheelCache
+    from pip._internal.models.target_python import TargetPython
+    from pip._internal.req.req_install import InstallRequirement
+    from pip._internal.req.req_tracker import RequirementTracker
+    from pip._internal.resolution.base import BaseResolver
+    from pip._internal.utils.temp_dir import TempDirectory, TempDirectoryTypeRegistry
+
+
+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)
+
+
+KEEPABLE_TEMPDIR_TYPES = [
+    tempdir_kinds.BUILD_ENV,
+    tempdir_kinds.EPHEM_WHEEL_CACHE,
+    tempdir_kinds.REQ_BUILD,
+]
+
+
+def with_cleanup(func):
+    # type: (Any) -> Any
+    """Decorator for common logic related to managing temporary
+    directories.
+    """
+    def configure_tempdir_registry(registry):
+        # type: (TempDirectoryTypeRegistry) -> None
+        for t in KEEPABLE_TEMPDIR_TYPES:
+            registry.set_delete(t, False)
+
+    def wrapper(self, options, args):
+        # type: (RequirementCommand, Values, List[Any]) -> Optional[int]
+        assert self.tempdir_registry is not None
+        if options.no_clean:
+            configure_tempdir_registry(self.tempdir_registry)
+
+        try:
+            return func(self, options, args)
+        except PreviousBuildDirError:
+            # This kind of conflict can occur when the user passes an explicit
+            # build directory with a pre-existing folder. In that case we do
+            # not want to accidentally remove it.
+            configure_tempdir_registry(self.tempdir_registry)
+            raise
+
+    return wrapper
+
+
+class RequirementCommand(IndexGroupCommand):
+
+    def __init__(self, *args, **kw):
+        # type: (Any, Any) -> None
+        super(RequirementCommand, self).__init__(*args, **kw)
+
+        self.cmd_opts.add_option(cmdoptions.no_clean())
+
+    @staticmethod
+    def determine_resolver_variant(options):
+        # type: (Values) -> str
+        """Determines which resolver should be used, based on the given options."""
+        # We didn't want to change things for Python 2, since it's nearly done with
+        # and we're using performance improvements that only work on Python 3.
+        if PY2:
+            if '2020-resolver' in options.features_enabled:
+                return "2020-resolver"
+            else:
+                return "legacy"
+
+        if "legacy-resolver" in options.deprecated_features_enabled:
+            return "legacy"
+
+        return "2020-resolver"
+
+    @classmethod
+    def make_requirement_preparer(
+        cls,
+        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
+    ):
+        # type: (...) -> RequirementPreparer
+        """
+        Create a RequirementPreparer instance for the given parameters.
+        """
+        temp_build_dir_path = temp_build_dir.path
+        assert temp_build_dir_path is not None
+
+        resolver_variant = cls.determine_resolver_variant(options)
+        if resolver_variant == "2020-resolver":
+            lazy_wheel = 'fast-deps' in options.features_enabled
+            if lazy_wheel:
+                logger.warning(
+                    'pip is using lazily downloaded wheels using HTTP '
+                    'range requests to obtain dependency information. '
+                    'This experimental feature is enabled through '
+                    '--use-feature=fast-deps and it is not ready for '
+                    'production.'
+                )
+        else:
+            lazy_wheel = False
+            if 'fast-deps' in options.features_enabled:
+                logger.warning(
+                    'fast-deps has no effect when used with the legacy resolver.'
+                )
+
+        return RequirementPreparer(
+            build_dir=temp_build_dir_path,
+            src_dir=options.src_dir,
+            download_dir=download_dir,
+            build_isolation=options.build_isolation,
+            req_tracker=req_tracker,
+            session=session,
+            progress_bar=options.progress_bar,
+            finder=finder,
+            require_hashes=options.require_hashes,
+            use_user_site=use_user_site,
+            lazy_wheel=lazy_wheel,
+        )
+
+    @classmethod
+    def make_resolver(
+        cls,
+        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: (...) -> BaseResolver
+        """
+        Create a Resolver instance for the given parameters.
+        """
+        make_install_req = partial(
+            install_req_from_req_string,
+            isolated=options.isolated_mode,
+            use_pep517=use_pep517,
+        )
+        resolver_variant = cls.determine_resolver_variant(options)
+        # The long import name and duplicated invocation is needed to convince
+        # Mypy into correctly typechecking. Otherwise it would complain the
+        # "Resolver" class being redefined.
+        if resolver_variant == "2020-resolver":
+            import pip._internal.resolution.resolvelib.resolver
+
+            return pip._internal.resolution.resolvelib.resolver.Resolver(
+                preparer=preparer,
+                finder=finder,
+                wheel_cache=wheel_cache,
+                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,
+            )
+        import pip._internal.resolution.legacy.resolver
+        return pip._internal.resolution.legacy.resolver.Resolver(
+            preparer=preparer,
+            finder=finder,
+            wheel_cache=wheel_cache,
+            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 get_requirements(
+        self,
+        args,             # type: List[str]
+        options,          # type: Values
+        finder,           # type: PackageFinder
+        session,          # type: PipSession
+    ):
+        # type: (...) -> List[InstallRequirement]
+        """
+        Parse command-line arguments into the corresponding requirements.
+        """
+        requirements = []  # type: List[InstallRequirement]
+        for filename in options.constraints:
+            for parsed_req in parse_requirements(
+                    filename,
+                    constraint=True, finder=finder, options=options,
+                    session=session):
+                req_to_add = install_req_from_parsed_requirement(
+                    parsed_req,
+                    isolated=options.isolated_mode,
+                    user_supplied=False,
+                )
+                requirements.append(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,
+                user_supplied=True,
+            )
+            requirements.append(req_to_add)
+
+        for req in options.editables:
+            req_to_add = install_req_from_editable(
+                req,
+                user_supplied=True,
+                isolated=options.isolated_mode,
+                use_pep517=options.use_pep517,
+            )
+            requirements.append(req_to_add)
+
+        # NOTE: options.require_hashes may be set if --require-hashes is True
+        for filename in options.requirements:
+            for parsed_req in parse_requirements(
+                    filename,
+                    finder=finder, options=options, session=session):
+                req_to_add = install_req_from_parsed_requirement(
+                    parsed_req,
+                    isolated=options.isolated_mode,
+                    use_pep517=options.use_pep517,
+                    user_supplied=True,
+                )
+                requirements.append(req_to_add)
+
+        # If any requirement has hash options, enable hash checking.
+        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} '
+                    '(maybe you meant "pip {name} {links}"?)'.format(
+                        **dict(opts, links=' '.join(options.find_links))))
+            else:
+                raise CommandError(
+                    'You must give at least one requirement to {name} '
+                    '(see "pip help {name}")'.format(**opts))
+
+        return requirements
+
+    @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 = LinkCollector.create(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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/spinners.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/spinners.py
new file mode 100644
index 0000000000000000000000000000000000000000..65c3c23d7425e7537647672f0c08132a9c2eadce
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/spinners.py
@@ -0,0 +1,173 @@
+from __future__ import absolute_import, division
+
+import contextlib
+import itertools
+import logging
+import sys
+import time
+
+from pip._vendor.progress import HIDE_CURSOR, SHOW_CURSOR
+
+from pip._internal.utils.compat import WINDOWS
+from pip._internal.utils.logging import get_indentation
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import IO, Iterator
+
+logger = logging.getLogger(__name__)
+
+
+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):
+        # type: (str, IO[str], str, float) -> None
+        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):
+        # type: (str) -> None
+        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):
+        # type: (str) -> None
+        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 '{final_status}'".format(**locals()))
+        self._finished = True
+
+
+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()
+
+
+@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")
+
+
+@contextlib.contextmanager
+def hidden_cursor(file):
+    # type: (IO[str]) -> 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)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/status_codes.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/status_codes.py
new file mode 100644
index 0000000000000000000000000000000000000000..275360a3175abaeab86148d61b735904f96d72f6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/cli/status_codes.py
@@ -0,0 +1,8 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..4f0c4ba3ab9b76c420879d941dee98b672036871
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__init__.py
@@ -0,0 +1,123 @@
+"""
+Package containing all pip commands
+"""
+
+# The following comment should be removed at some point in the future.
+# mypy: disallow-untyped-defs=False
+# There is currently a bug in python/typeshed mentioned at
+# https://github.com/python/typeshed/issues/3906 which causes the
+# return type of difflib.get_close_matches to be reported
+# as List[Sequence[str]] whereas it should have been List[str]
+
+from __future__ import absolute_import
+
+import importlib
+from collections import OrderedDict, namedtuple
+
+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.',
+    )),
+    ('cache', CommandInfo(
+        'pip._internal.commands.cache', 'CacheCommand',
+        "Inspect and manage pip's wheel cache.",
+    )),
+    ('wheel', CommandInfo(
+        'pip._internal.commands.wheel', 'WheelCommand',
+        'Build wheels from your requirements.',
+    )),
+    ('hash', CommandInfo(
+        'pip._internal.commands.hash', 'HashCommand',
+        'Compute hashes of package archives.',
+    )),
+    ('completion', CommandInfo(
+        'pip._internal.commands.completion', 'CompletionCommand',
+        'A helper command used for command completion.',
+    )),
+    ('debug', CommandInfo(
+        'pip._internal.commands.debug', 'DebugCommand',
+        'Show information useful for debugging.',
+    )),
+    ('help', CommandInfo(
+        'pip._internal.commands.help', 'HelpCommand',
+        'Show help for commands.',
+    )),
+])  # type: OrderedDict[str, CommandInfo]
+
+
+def create_command(name, **kwargs):
+    # 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7cf9019eee7e291c430f0daf32435a492e3018a6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..78e353cdfe39fdbd2a67e45368526b55baa415f6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/cache.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2a5287f1fd4d83a124c5e406ca3cb9bbbe95549e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/check.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..27cdacaa32565326874a5350eaa179951fe2d639
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/completion.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d6bea403a05edd9815ac2759e48f34a3b603115b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/configuration.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..19cffaadeb3f29f56878183ee1cf8f492f359769
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/debug.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7f7b827b4ccd1402bb117f816d326ea49aa41fa5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/download.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8cd814a16ebd640767fbd5f665b7deb7ed575137
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/freeze.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ed7ee3d89fe492726f00bf42c8ffa9ce27e5d29a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/hash.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..53020e5e818e76ed35b6cec21e611e056ef6faf8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/help.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e2c419288115eea565321900de8d43011624227d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/install.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..55b1108691d3c87dd7dbc820faadc8388c927287
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/list.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0417a66747e094fea38cd4236d7d075df315254b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/search.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bc37973824a2318c0afac57554163252bff63bd5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/show.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7129facfe578ff78dc1718f867389fc0ce63ed79
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/uninstall.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..86d7997142b8425fdc07cd3aa08f4a6e0b6b2fa8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/cache.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/cache.py
new file mode 100644
index 0000000000000000000000000000000000000000..ec21be68fb5af77b7edf302a66af8b007f2e46f0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/cache.py
@@ -0,0 +1,234 @@
+from __future__ import absolute_import
+
+import logging
+import os
+import textwrap
+
+import pip._internal.utils.filesystem as filesystem
+from pip._internal.cli.base_command import Command
+from pip._internal.cli.status_codes import ERROR, SUCCESS
+from pip._internal.exceptions import CommandError, PipError
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Any, List
+
+
+logger = logging.getLogger(__name__)
+
+
+class CacheCommand(Command):
+    """
+    Inspect and manage pip's wheel cache.
+
+    Subcommands:
+
+    - dir: Show the cache directory.
+    - info: Show information about the cache.
+    - list: List filenames of packages stored in the cache.
+    - remove: Remove one or more package from the cache.
+    - purge: Remove all items from the cache.
+
+    ``<pattern>`` can be a glob expression or a package name.
+    """
+
+    ignore_require_venv = True
+    usage = """
+        %prog dir
+        %prog info
+        %prog list [<pattern>] [--format=[human, abspath]]
+        %prog remove <pattern>
+        %prog purge
+    """
+
+    def add_options(self):
+        # type: () -> None
+
+        self.cmd_opts.add_option(
+            '--format',
+            action='store',
+            dest='list_format',
+            default="human",
+            choices=('human', 'abspath'),
+            help="Select the output format among: human (default) or abspath"
+        )
+
+        self.parser.insert_option_group(0, self.cmd_opts)
+
+    def run(self, options, args):
+        # type: (Values, List[Any]) -> int
+        handlers = {
+            "dir": self.get_cache_dir,
+            "info": self.get_cache_info,
+            "list": self.list_cache_items,
+            "remove": self.remove_cache_items,
+            "purge": self.purge_cache,
+        }
+
+        if not options.cache_dir:
+            logger.error("pip cache commands can not "
+                         "function since cache is disabled.")
+            return ERROR
+
+        # Determine action
+        if not args or args[0] not in handlers:
+            logger.error(
+                "Need an action (%s) to perform.",
+                ", ".join(sorted(handlers)),
+            )
+            return ERROR
+
+        action = args[0]
+
+        # 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 get_cache_dir(self, options, args):
+        # type: (Values, List[Any]) -> None
+        if args:
+            raise CommandError('Too many arguments')
+
+        logger.info(options.cache_dir)
+
+    def get_cache_info(self, options, args):
+        # type: (Values, List[Any]) -> None
+        if args:
+            raise CommandError('Too many arguments')
+
+        num_http_files = len(self._find_http_files(options))
+        num_packages = len(self._find_wheels(options, '*'))
+
+        http_cache_location = self._cache_dir(options, 'http')
+        wheels_cache_location = self._cache_dir(options, 'wheels')
+        http_cache_size = filesystem.format_directory_size(http_cache_location)
+        wheels_cache_size = filesystem.format_directory_size(
+            wheels_cache_location
+        )
+
+        message = textwrap.dedent("""
+            Package index page cache location: {http_cache_location}
+            Package index page cache size: {http_cache_size}
+            Number of HTTP files: {num_http_files}
+            Wheels location: {wheels_cache_location}
+            Wheels size: {wheels_cache_size}
+            Number of wheels: {package_count}
+        """).format(
+            http_cache_location=http_cache_location,
+            http_cache_size=http_cache_size,
+            num_http_files=num_http_files,
+            wheels_cache_location=wheels_cache_location,
+            package_count=num_packages,
+            wheels_cache_size=wheels_cache_size,
+        ).strip()
+
+        logger.info(message)
+
+    def list_cache_items(self, options, args):
+        # type: (Values, List[Any]) -> None
+        if len(args) > 1:
+            raise CommandError('Too many arguments')
+
+        if args:
+            pattern = args[0]
+        else:
+            pattern = '*'
+
+        files = self._find_wheels(options, pattern)
+        if options.list_format == 'human':
+            self.format_for_human(files)
+        else:
+            self.format_for_abspath(files)
+
+    def format_for_human(self, files):
+        # type: (List[str]) -> None
+        if not files:
+            logger.info('Nothing cached.')
+            return
+
+        results = []
+        for filename in files:
+            wheel = os.path.basename(filename)
+            size = filesystem.format_file_size(filename)
+            results.append(' - {} ({})'.format(wheel, size))
+        logger.info('Cache contents:\n')
+        logger.info('\n'.join(sorted(results)))
+
+    def format_for_abspath(self, files):
+        # type: (List[str]) -> None
+        if not files:
+            return
+
+        results = []
+        for filename in files:
+            results.append(filename)
+
+        logger.info('\n'.join(sorted(results)))
+
+    def remove_cache_items(self, options, args):
+        # type: (Values, List[Any]) -> None
+        if len(args) > 1:
+            raise CommandError('Too many arguments')
+
+        if not args:
+            raise CommandError('Please provide a pattern')
+
+        files = self._find_wheels(options, args[0])
+
+        # Only fetch http files if no specific pattern given
+        if args[0] == '*':
+            files += self._find_http_files(options)
+
+        if not files:
+            raise CommandError('No matching packages')
+
+        for filename in files:
+            os.unlink(filename)
+            logger.debug('Removed %s', filename)
+        logger.info('Files removed: %s', len(files))
+
+    def purge_cache(self, options, args):
+        # type: (Values, List[Any]) -> None
+        if args:
+            raise CommandError('Too many arguments')
+
+        return self.remove_cache_items(options, ['*'])
+
+    def _cache_dir(self, options, subdir):
+        # type: (Values, str) -> str
+        return os.path.join(options.cache_dir, subdir)
+
+    def _find_http_files(self, options):
+        # type: (Values) -> List[str]
+        http_dir = self._cache_dir(options, 'http')
+        return filesystem.find_files(http_dir, '*')
+
+    def _find_wheels(self, options, pattern):
+        # type: (Values, str) -> List[str]
+        wheel_dir = self._cache_dir(options, 'wheels')
+
+        # The wheel filename format, as specified in PEP 427, is:
+        #     {distribution}-{version}(-{build})?-{python}-{abi}-{platform}.whl
+        #
+        # Additionally, non-alphanumeric values in the distribution are
+        # normalized to underscores (_), meaning hyphens can never occur
+        # before `-{version}`.
+        #
+        # Given that information:
+        # - If the pattern we're given contains a hyphen (-), the user is
+        #   providing at least the version. Thus, we can just append `*.whl`
+        #   to match the rest of it.
+        # - If the pattern we're given doesn't contain a hyphen (-), the
+        #   user is only providing the name. Thus, we append `-*.whl` to
+        #   match the hyphen before the version, followed by anything else.
+        #
+        # PEP 427: https://www.python.org/dev/peps/pep-0427/
+        pattern = pattern + ("*.whl" if "-" in pattern else "-*.whl")
+
+        return filesystem.find_files(wheel_dir, pattern)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/check.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/check.py
new file mode 100644
index 0000000000000000000000000000000000000000..e066bb63c74175ccb3272449f7a6225cb1aab4a7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/check.py
@@ -0,0 +1,51 @@
+import logging
+
+from pip._internal.cli.base_command import Command
+from pip._internal.cli.status_codes import ERROR, SUCCESS
+from pip._internal.operations.check import (
+    check_package_set,
+    create_package_set_from_installed,
+)
+from pip._internal.utils.misc import write_output
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+logger = logging.getLogger(__name__)
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Any, List
+
+
+class CheckCommand(Command):
+    """Verify installed packages have compatible dependencies."""
+
+    usage = """
+      %prog [options]"""
+
+    def run(self, options, args):
+        # type: (Values, List[Any]) -> int
+
+        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 ERROR
+        else:
+            write_output("No broken requirements found.")
+            return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/completion.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/completion.py
new file mode 100644
index 0000000000000000000000000000000000000000..b19f1ed1a5619d6e58ce087f53660e8f835a254c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/completion.py
@@ -0,0 +1,98 @@
+from __future__ import absolute_import
+
+import sys
+import textwrap
+
+from pip._internal.cli.base_command import Command
+from pip._internal.cli.status_codes import SUCCESS
+from pip._internal.utils.misc import get_prog
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+BASE_COMPLETION = """
+# pip {shell} completion start{script}# pip {shell} 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}
+    """,
+    '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}
+    """,
+    '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}
+    """,
+}
+
+
+class CompletionCommand(Command):
+    """A helper command to be used for command completion."""
+
+    ignore_require_venv = True
+
+    def add_options(self):
+        # type: () -> None
+        self.cmd_opts.add_option(
+            '--bash', '-b',
+            action='store_const',
+            const='bash',
+            dest='shell',
+            help='Emit completion code for bash')
+        self.cmd_opts.add_option(
+            '--zsh', '-z',
+            action='store_const',
+            const='zsh',
+            dest='shell',
+            help='Emit completion code for zsh')
+        self.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, self.cmd_opts)
+
+    def run(self, options, args):
+        #  type: (Values, List[str]) -> int
+        """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, '').format(
+                    prog=get_prog())
+            )
+            print(BASE_COMPLETION.format(script=script, shell=options.shell))
+            return SUCCESS
+        else:
+            sys.stderr.write(
+                'ERROR: You must pass {}\n' .format(' or '.join(shell_options))
+            )
+            return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/configuration.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/configuration.py
new file mode 100644
index 0000000000000000000000000000000000000000..1ab90b47b4310064d67d07d35365ba71e43ab947
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/configuration.py
@@ -0,0 +1,280 @@
+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.logging import indent_log
+from pip._internal.utils.misc import get_prog, write_output
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Any, List, Optional
+
+    from pip._internal.configuration import Kind
+
+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
+    - debug: List the configuration files and values defined under them
+
+    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 [<file-option>] list
+        %prog [<file-option>] [--editor <editor-path>] edit
+
+        %prog [<file-option>] get name
+        %prog [<file-option>] set name value
+        %prog [<file-option>] unset name
+        %prog [<file-option>] debug
+    """
+
+    def add_options(self):
+        # type: () -> 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):
+        # type: (Values, List[str]) -> int
+        handlers = {
+            "list": self.list_values,
+            "edit": self.open_in_editor,
+            "get": self.get_name,
+            "set": self.set_name_value,
+            "unset": self.unset_name,
+            "debug": self.list_config_values,
+        }
+
+        # Determine action
+        if not args or args[0] not in handlers:
+            logger.error(
+                "Need an action (%s) to perform.",
+                ", ".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):
+        # type: (Values, bool) -> Optional[Kind]
+        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):
+        # type: (Values, List[str]) -> None
+        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):
+        # type: (Values, List[str]) -> None
+        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):
+        # type: (Values, List[str]) -> None
+        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):
+        # type: (Values, List[str]) -> None
+        key = self._get_n_args(args, "unset [name]", n=1)
+        self.configuration.unset_value(key)
+
+        self._save_configuration()
+
+    def list_config_values(self, options, args):
+        # type: (Values, List[str]) -> None
+        """List config key-value pairs across different config files"""
+        self._get_n_args(args, "debug", n=0)
+
+        self.print_env_var_values()
+        # Iterate over config files and print if they exist, and the
+        # key-value pairs present in them if they do
+        for variant, files in sorted(self.configuration.iter_config_files()):
+            write_output("%s:", variant)
+            for fname in files:
+                with indent_log():
+                    file_exists = os.path.exists(fname)
+                    write_output("%s, exists: %r",
+                                 fname, file_exists)
+                    if file_exists:
+                        self.print_config_file_values(variant)
+
+    def print_config_file_values(self, variant):
+        # type: (Kind) -> None
+        """Get key-value pairs from the file of a variant"""
+        for name, value in self.configuration.\
+                get_values_in_config(variant).items():
+            with indent_log():
+                write_output("%s: %s", name, value)
+
+    def print_env_var_values(self):
+        # type: () -> None
+        """Get key-values pairs present as environment variables"""
+        write_output("%s:", 'env_var')
+        with indent_log():
+            for key, value in sorted(self.configuration.get_environ_vars()):
+                env_var = 'PIP_{}'.format(key.upper())
+                write_output("%s=%r", env_var, value)
+
+    def open_in_editor(self, options, args):
+        # type: (Values, List[str]) -> None
+        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):
+        # type: (List[str], str, int) -> Any
+        """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):
+        # type: () -> None
+        # We successfully ran a modifying command. Need to save the
+        # configuration.
+        try:
+            self.configuration.save()
+        except Exception:
+            logger.exception(
+                "Unable to save configuration. Please report this as a bug."
+            )
+            raise PipError("Internal Error.")
+
+    def _determine_editor(self, options):
+        # type: (Values) -> str
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/debug.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/debug.py
new file mode 100644
index 0000000000000000000000000000000000000000..0ccc63af2655e60b1935e7568c9d8ea36efa85c1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/debug.py
@@ -0,0 +1,251 @@
+from __future__ import absolute_import
+
+import locale
+import logging
+import os
+import sys
+
+import pip._vendor
+from pip._vendor import pkg_resources
+from pip._vendor.certifi import where
+
+from pip import __file__ as pip_location
+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 optparse import Values
+    from types import ModuleType
+    from typing import Dict, List, Optional
+
+    from pip._internal.configuration import Configuration
+
+logger = logging.getLogger(__name__)
+
+
+def show_value(name, value):
+    # type: (str, Optional[str]) -> None
+    logger.info('%s: %s', 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 create_vendor_txt_map():
+    # type: () -> Dict[str, str]
+    vendor_txt_path = os.path.join(
+        os.path.dirname(pip_location),
+        '_vendor',
+        'vendor.txt'
+    )
+
+    with open(vendor_txt_path) as f:
+        # Purge non version specifying lines.
+        # Also, remove any space prefix or suffixes (including comments).
+        lines = [line.strip().split(' ', 1)[0]
+                 for line in f.readlines() if '==' in line]
+
+    # Transform into "module" -> version dict.
+    return dict(line.split('==', 1) for line in lines)  # type: ignore
+
+def create_debundle_txt_map():
+    # type: () -> Dict[str, str]
+    wheels = [fn for fn in os.listdir(pip._vendor.WHEEL_DIR)]
+    # Transform into "module" -> version dict.
+    return dict((wheel.split('-')[0], wheel.split('-')[1]) for wheel in wheels) # type: ignore
+
+def get_module_from_module_name(module_name):
+    # type: (str) -> ModuleType
+    # Module name can be uppercase in vendor.txt for some reason...
+    module_name = module_name.lower()
+    # PATCH: setuptools is actually only pkg_resources.
+    if module_name == 'setuptools':
+        module_name = 'pkg_resources'
+
+    __import__(
+        'pip._vendor.{}'.format(module_name),
+        globals(),
+        locals(),
+        level=0
+    )
+    return getattr(pip._vendor, module_name)
+
+
+def get_vendor_version_from_module(module_name):
+    # type: (str) -> Optional[str]
+    module = get_module_from_module_name(module_name)
+    version = getattr(module, '__version__', None)
+
+    if not version:
+        # Try to find version in debundled module info
+        # The type for module.__file__ is Optional[str] in
+        # Python 2, and str in Python 3. The type: ignore is
+        # added to account for Python 2, instead of a cast
+        # and should be removed once we drop Python 2 support
+        pkg_set = pkg_resources.WorkingSet(
+            [os.path.dirname(module.__file__)]  # type: ignore
+        )
+        package = pkg_set.find(pkg_resources.Requirement.parse(module_name))
+        version = getattr(package, 'version', None)
+
+    return version
+
+
+def show_actual_vendor_versions(vendor_txt_versions):
+    # type: (Dict[str, str]) -> None
+    """Log the actual version and print extra info if there is
+    a conflict or if the actual version could not be imported.
+    """
+    for module_name, expected_version in vendor_txt_versions.items():
+        extra_message = ''
+        actual_version = get_vendor_version_from_module(module_name)
+        if not actual_version:
+            extra_message = ' (Unable to locate actual module version, using'\
+                            ' vendor.txt specified version)'
+            actual_version = expected_version
+        elif actual_version != expected_version:
+            extra_message = ' (CONFLICT: vendor.txt suggests version should'\
+                            ' be {})'.format(expected_version)
+        logger.info('%s==%s%s', module_name, actual_version, extra_message)
+
+
+def show_vendor_versions():
+    # type: () -> None
+    logger.info('vendored library versions:')
+
+    vendor_txt_versions = create_vendor_txt_map()
+    with indent_log():
+        show_actual_vendor_versions(vendor_txt_versions)
+
+def show_debundled_versions():
+    # type: () -> None
+    logger.info('debundled wheel versions:')
+    debundle_txt_versions = create_debundle_txt_map()
+    for module_name, installed_version in sorted(debundle_txt_versions.items()):
+        with indent_log():
+            logger.info(
+                '{name}=={actual}'.format(
+                    name=module_name,
+                    actual=installed_version,
+                )
+            )
+
+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):
+    # type: (Configuration) -> str
+    levels = set()
+    for key, _ 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'
+
+    if 'global' in levels:
+        levels.remove('global')
+    return ", ".join(levels)
+
+
+class DebugCommand(Command):
+    """
+    Display debug information.
+    """
+
+    usage = """
+      %prog <options>"""
+    ignore_require_venv = True
+
+    def add_options(self):
+        # type: () -> None
+        cmdoptions.add_target_python_options(self.cmd_opts)
+        self.parser.insert_option_group(0, self.cmd_opts)
+        self.parser.config.load()
+
+    def run(self, options, args):
+        # type: (Values, List[str]) -> 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_value("pip._vendor.DEBUNDLED", pip._vendor.DEBUNDLED)
+
+        if not pip._vendor.DEBUNDLED:
+            show_vendor_versions()
+        else:
+            show_value("pip._vendor.WHEEL_DIR", pip._vendor.WHEEL_DIR)
+            show_debundled_versions()
+
+        show_tags(options)
+
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/download.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/download.py
new file mode 100644
index 0000000000000000000000000000000000000000..7405870aefc8356aadab9fab534be3b428078b25
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/download.py
@@ -0,0 +1,143 @@
+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, with_cleanup
+from pip._internal.cli.status_codes import SUCCESS
+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
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+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] <requirement specifier> [package-index-options] ...
+      %prog [options] -r <requirements file> [package-index-options] ...
+      %prog [options] <vcs project url> ...
+      %prog [options] <local project path> ...
+      %prog [options] <archive url/path> ..."""
+
+    def add_options(self):
+        # type: () -> None
+        self.cmd_opts.add_option(cmdoptions.constraints())
+        self.cmd_opts.add_option(cmdoptions.requirements())
+        self.cmd_opts.add_option(cmdoptions.build_dir())
+        self.cmd_opts.add_option(cmdoptions.no_deps())
+        self.cmd_opts.add_option(cmdoptions.global_options())
+        self.cmd_opts.add_option(cmdoptions.no_binary())
+        self.cmd_opts.add_option(cmdoptions.only_binary())
+        self.cmd_opts.add_option(cmdoptions.prefer_binary())
+        self.cmd_opts.add_option(cmdoptions.src())
+        self.cmd_opts.add_option(cmdoptions.pre())
+        self.cmd_opts.add_option(cmdoptions.require_hashes())
+        self.cmd_opts.add_option(cmdoptions.progress_bar())
+        self.cmd_opts.add_option(cmdoptions.no_build_isolation())
+        self.cmd_opts.add_option(cmdoptions.use_pep517())
+        self.cmd_opts.add_option(cmdoptions.no_use_pep517())
+
+        self.cmd_opts.add_option(
+            '-d', '--dest', '--destination-dir', '--destination-directory',
+            dest='download_dir',
+            metavar='dir',
+            default=os.curdir,
+            help=("Download packages into <dir>."),
+        )
+
+        cmdoptions.add_target_python_options(self.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, self.cmd_opts)
+
+    @with_cleanup
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+
+        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,
+        )
+
+        req_tracker = self.enter_context(get_requirement_tracker())
+
+        directory = TempDirectory(
+            delete=not options.no_clean,
+            kind="download",
+            globally_managed=True,
+        )
+
+        reqs = self.get_requirements(args, options, finder, session)
+
+        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)
+
+        requirement_set = resolver.resolve(
+            reqs, check_supported_wheels=True
+        )
+
+        downloaded = []  # type: List[str]
+        for req in requirement_set.requirements.values():
+            if req.satisfied_by is None:
+                assert req.name is not None
+                preparer.save_linked_requirement(req)
+                downloaded.append(req.name)
+        if downloaded:
+            write_output('Successfully downloaded %s', ' '.join(downloaded))
+
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/freeze.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/freeze.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f71bd305c356346383419bd188021a6c01e4958
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/freeze.py
@@ -0,0 +1,116 @@
+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.cli.status_codes import SUCCESS
+from pip._internal.models.format_control import FormatControl
+from pip._internal.operations.freeze import freeze
+from pip._internal.utils.compat import stdlib_pkgs
+from pip._internal.utils.deprecation import deprecated
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+DEV_PKGS = {'pip', 'setuptools', 'distribute', 'wheel', 'pkg-resources'}
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+
+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 add_options(self):
+        # type: () -> None
+        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:'
+                 ' {}'.format(', '.join(DEV_PKGS)))
+        self.cmd_opts.add_option(
+            '--exclude-editable',
+            dest='exclude_editable',
+            action='store_true',
+            help='Exclude editable package from output.')
+        self.cmd_opts.add_option(cmdoptions.list_exclude())
+
+        self.parser.insert_option_group(0, self.cmd_opts)
+
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+        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)
+
+        if options.excludes:
+            skip.update(options.excludes)
+
+        cmdoptions.check_list_path_option(options)
+
+        if options.find_links:
+            deprecated(
+                "--find-links option in pip freeze is deprecated.",
+                replacement=None,
+                gone_in="21.2",
+                issue=9069,
+            )
+
+        freeze_kwargs = dict(
+            requirement=options.requirements,
+            find_links=options.find_links,
+            local_only=options.local,
+            user_only=options.user,
+            paths=options.path,
+            isolated=options.isolated_mode,
+            wheel_cache=wheel_cache,
+            skip=skip,
+            exclude_editable=options.exclude_editable,
+        )
+
+        for line in freeze(**freeze_kwargs):
+            sys.stdout.write(line + '\n')
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/hash.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/hash.py
new file mode 100644
index 0000000000000000000000000000000000000000..37831c3952289f7ecadc553e8a2eecaeb3d9ede8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/hash.py
@@ -0,0 +1,63 @@
+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, SUCCESS
+from pip._internal.utils.hashes import FAVORITE_HASH, STRONG_HASHES
+from pip._internal.utils.misc import read_chunks, write_output
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+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] <file> ...'
+    ignore_require_venv = True
+
+    def add_options(self):
+        # type: () -> None
+        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 {}'.format(
+                 ', '.join(STRONG_HASHES)))
+        self.parser.insert_option_group(0, self.cmd_opts)
+
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+        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))
+        return SUCCESS
+
+
+def _hash_of_file(path, algorithm):
+    # type: (str, str) -> str
+    """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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/help.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/help.py
new file mode 100644
index 0000000000000000000000000000000000000000..2ab2b6d8f25e3d1548e2cc36de8255e20a72c8ec
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/help.py
@@ -0,0 +1,46 @@
+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
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+
+class HelpCommand(Command):
+    """Show help for commands"""
+
+    usage = """
+      %prog <command>"""
+    ignore_require_venv = True
+
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+        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 "{}"'.format(cmd_name)]
+            if guess:
+                msg.append('maybe you meant "{}"'.format(guess))
+
+            raise CommandError(' - '.join(msg))
+
+        command = create_command(cmd_name)
+        command.parser.print_help()
+
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/install.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/install.py
new file mode 100644
index 0000000000000000000000000000000000000000..d91af888346cbdfd22dff4f7675ef1e59dda926a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/install.py
@@ -0,0 +1,763 @@
+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, with_cleanup
+from pip._internal.cli.status_codes import ERROR, SUCCESS
+from pip._internal.exceptions import CommandError, InstallationError
+from pip._internal.locations import distutils_scheme
+from pip._internal.operations.check import check_install_conflicts
+from pip._internal.req import install_given_reqs
+from pip._internal.req.req_tracker import get_requirement_tracker
+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,
+    get_pip_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 Iterable, List, Optional
+
+    from pip._internal.models.format_control import FormatControl
+    from pip._internal.operations.check import ConflictDetails
+    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] <requirement specifier> [package-index-options] ...
+      %prog [options] -r <requirements file> [package-index-options] ...
+      %prog [options] [-e] <vcs project url> ...
+      %prog [options] [-e] <local project path> ...
+      %prog [options] <archive url/path> ..."""
+
+    def add_options(self):
+        # type: () -> None
+        self.cmd_opts.add_option(cmdoptions.requirements())
+        self.cmd_opts.add_option(cmdoptions.constraints())
+        self.cmd_opts.add_option(cmdoptions.no_deps())
+        self.cmd_opts.add_option(cmdoptions.pre())
+
+        self.cmd_opts.add_option(cmdoptions.editable())
+        self.cmd_opts.add_option(
+            '-t', '--target',
+            dest='target_dir',
+            metavar='dir',
+            default=None,
+            help='Install packages into <dir>. '
+                 'By default this will not replace existing files/folders in '
+                 '<dir>. Use --upgrade to replace existing packages in <dir> '
+                 'with new versions.'
+        )
+        cmdoptions.add_target_python_options(self.cmd_opts)
+
+        self.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.")
+
+        self.cmd_opts.add_option(
+            '--no-user',
+            dest='use_system_location',
+            action='store_true',
+            help=SUPPRESS_HELP)
+        self.cmd_opts.add_option(
+            '--root',
+            dest='root_path',
+            metavar='dir',
+            default=None,
+            help="Install everything relative to this alternate root "
+                 "directory.")
+        self.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")
+
+        self.cmd_opts.add_option(
+            '--system',
+            dest='use_system_location',
+            action='store_true',
+            help="Install using the system scheme (overrides --user on "
+                 "Debian systems)")
+
+        self.cmd_opts.add_option(cmdoptions.build_dir())
+
+        self.cmd_opts.add_option(cmdoptions.src())
+
+        self.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.'
+        )
+
+        self.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).'
+        )
+
+        self.cmd_opts.add_option(
+            '--force-reinstall',
+            dest='force_reinstall',
+            action='store_true',
+            help='Reinstall all packages even if they are already '
+                 'up-to-date.')
+
+        self.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!'
+        )
+
+        self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
+        self.cmd_opts.add_option(cmdoptions.no_build_isolation())
+        self.cmd_opts.add_option(cmdoptions.use_pep517())
+        self.cmd_opts.add_option(cmdoptions.no_use_pep517())
+
+        self.cmd_opts.add_option(cmdoptions.install_options())
+        self.cmd_opts.add_option(cmdoptions.global_options())
+
+        self.cmd_opts.add_option(
+            "--compile",
+            action="store_true",
+            dest="compile",
+            default=True,
+            help="Compile Python source files to bytecode",
+        )
+
+        self.cmd_opts.add_option(
+            "--no-compile",
+            action="store_false",
+            dest="compile",
+            help="Do not compile Python source files to bytecode",
+        )
+
+        self.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",
+        )
+        self.cmd_opts.add_option(
+            "--no-warn-conflicts",
+            action="store_false",
+            dest="warn_about_conflicts",
+            default=True,
+            help="Do not warn about broken dependencies",
+        )
+
+        self.cmd_opts.add_option(cmdoptions.no_binary())
+        self.cmd_opts.add_option(cmdoptions.only_binary())
+        self.cmd_opts.add_option(cmdoptions.prefer_binary())
+        self.cmd_opts.add_option(cmdoptions.require_hashes())
+        self.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, self.cmd_opts)
+
+    @with_cleanup
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+        if options.use_user_site and options.target_dir is not None:
+            raise CommandError("Can not combine '--user' and '--target'")
+
+        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 []
+
+        logger.debug("Using %s", get_pip_version())
+        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
+            self.enter_context(target_temp_dir)
+
+        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,
+        )
+        wheel_cache = WheelCache(options.cache_dir, options.format_control)
+
+        req_tracker = self.enter_context(get_requirement_tracker())
+
+        directory = TempDirectory(
+            delete=not options.no_clean,
+            kind="install",
+            globally_managed=True,
+        )
+
+        try:
+            reqs = self.get_requirements(args, options, finder, session)
+
+            reject_location_related_install_options(
+                reqs, 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)
+
+            requirement_set = resolver.resolve(
+                reqs, check_supported_wheels=not options.target_dir
+            )
+
+            try:
+                pip_req = requirement_set.get_requirement("pip")
+            except KeyError:
+                modifying_pip = False
+            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,
+                verify=True,
+                build_options=[],
+                global_options=[],
+            )
+
+            # If we're using PEP 517, we cannot do a direct install
+            # so we fail here.
+            pep517_build_failure_names = [
+                r.name   # type: ignore
+                for r in build_failures if r.use_pep517
+            ]  # type: List[str]
+            if pep517_build_failure_names:
+                raise InstallationError(
+                    "Could not build wheels for {} which use"
+                    " PEP 517 and cannot be installed directly".format(
+                        ", ".join(pep517_build_failure_names)
+                    )
+                )
+
+            # For now, we just warn about failures building legacy
+            # requirements, as we'll fall through to a direct
+            # install for those.
+            for r in build_failures:
+                if not r.use_pep517:
+                    r.legacy_install_reason = 8368
+
+            to_install = resolver.get_installation_order(
+                requirement_set
+            )
+
+            # Check for conflicts in the package set we're installing.
+            conflicts = None  # type: Optional[ConflictDetails]
+            should_warn_about_conflicts = (
+                not options.ignore_dependencies and
+                options.warn_about_conflicts
+            )
+            if should_warn_about_conflicts:
+                conflicts = self._determine_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,
+                warn_script_location=warn_script_location,
+                use_user_site=options.use_user_site,
+                pycompile=options.compile,
+            )
+
+            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)
+
+            if conflicts is not None:
+                self._warn_about_conflicts(
+                    conflicts,
+                    resolver_variant=self.determine_resolver_variant(options),
+                )
+
+            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)  # noqa
+
+            return ERROR
+
+        if options.target_dir:
+            assert target_temp_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):
+        # type: (str, TempDirectory, bool) -> None
+        ensure_dir(target_dir)
+
+        # Checking both purelib and platlib directories for installed
+        # packages to be moved to target directory
+        lib_dir_list = []
+
+        # 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 _determine_conflicts(self, to_install):
+        # type: (List[InstallRequirement]) -> Optional[ConflictDetails]
+        try:
+            return check_install_conflicts(to_install)
+        except Exception:
+            logger.exception(
+                "Error while checking for conflicts. Please file an issue on "
+                "pip's issue tracker: https://github.com/pypa/pip/issues/new"
+            )
+            return None
+
+    def _warn_about_conflicts(self, conflict_details, resolver_variant):
+        # type: (ConflictDetails, str) -> None
+        package_set, (missing, conflicting) = conflict_details
+        if not missing and not conflicting:
+            return
+
+        parts = []  # type: List[str]
+        if resolver_variant == "legacy":
+            parts.append(
+                "pip's legacy dependency resolver does not consider dependency "
+                "conflicts when selecting packages. This behaviour is the "
+                "source of the following dependency conflicts."
+            )
+        else:
+            assert resolver_variant == "2020-resolver"
+            parts.append(
+                "pip's dependency resolver does not currently take into account "
+                "all the packages that are installed. This behaviour is the "
+                "source of the following dependency conflicts."
+            )
+
+        # NOTE: There is some duplication here, with commands/check.py
+        for project_name in missing:
+            version = package_set[project_name][0]
+            for dependency in missing[project_name]:
+                message = (
+                    "{name} {version} requires {requirement}, "
+                    "which is not installed."
+                ).format(
+                    name=project_name,
+                    version=version,
+                    requirement=dependency[1],
+                )
+                parts.append(message)
+
+        for project_name in conflicting:
+            version = package_set[project_name][0]
+            for dep_name, dep_version, req in conflicting[project_name]:
+                message = (
+                    "{name} {version} requires {requirement}, but {you} have "
+                    "{dep_name} {dep_version} which is incompatible."
+                ).format(
+                    name=project_name,
+                    version=version,
+                    requirement=req,
+                    dep_name=dep_name,
+                    dep_version=dep_version,
+                    you=("you" if resolver_variant == "2020-resolver" else "you'll")
+                )
+                parts.append(message)
+
+        logger.critical("\n".join(parts))
+
+
+def get_lib_location_guesses(
+        user=False,  # type: bool
+        home=None,  # type: Optional[str]
+        root=None,  # type: Optional[str]
+        isolated=False,  # type: bool
+        prefix=None  # type: Optional[str]
+):
+    # type:(...) -> List[str]
+    scheme = distutils_scheme('', user=user, home=home, root=root,
+                              isolated=isolated, prefix=prefix)
+    return [scheme['purelib'], scheme['platlib']]
+
+
+def site_packages_writable(root, isolated):
+    # type: (Optional[str], bool) -> bool
+    return all(
+        test_writable_dir(d) for d in set(
+            get_lib_location_guesses(root=root, isolated=isolated))
+    )
+
+
+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 reject_location_related_install_options(requirements, options):
+    # type: (List[InstallRequirement], 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]
+
+    offenders = []
+
+    for requirement in requirements:
+        install_options = requirement.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
+
+    raise CommandError(
+        "Location-changing options found in --install-option: {}."
+        " This is unsupported, use pip-level options like --user,"
+        " --prefix, --root, and --target instead.".format(
+            "; ".join(offenders)
+        )
+    )
+
+
+def create_env_error_message(error, show_traceback, using_user_site):
+    # type: (EnvironmentError, bool, bool) -> str
+    """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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/list.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/list.py
new file mode 100644
index 0000000000000000000000000000000000000000..8e63eea23cf443d4f040ad5a58d3afcc72c76b8b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/list.py
@@ -0,0 +1,328 @@
+from __future__ import absolute_import
+
+import json
+import logging
+
+from pip._vendor import six
+
+from pip._internal.cli import cmdoptions
+from pip._internal.cli.req_command import IndexGroupCommand
+from pip._internal.cli.status_codes import SUCCESS
+from pip._internal.exceptions import CommandError
+from pip._internal.index.collector import LinkCollector
+from pip._internal.index.package_finder import PackageFinder
+from pip._internal.models.selection_prefs import SelectionPreferences
+from pip._internal.utils.compat import stdlib_pkgs
+from pip._internal.utils.misc import (
+    dist_is_editable,
+    get_installed_distributions,
+    tabulate,
+    write_output,
+)
+from pip._internal.utils.packaging import get_installer
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Iterator, List, Set, Tuple
+
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.network.session import PipSession
+
+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.
+    """
+
+    ignore_require_venv = True
+    usage = """
+      %prog [options]"""
+
+    def add_options(self):
+        # type: () -> None
+        self.cmd_opts.add_option(
+            '-o', '--outdated',
+            action='store_true',
+            default=False,
+            help='List outdated packages')
+        self.cmd_opts.add_option(
+            '-u', '--uptodate',
+            action='store_true',
+            default=False,
+            help='List uptodate packages')
+        self.cmd_opts.add_option(
+            '-e', '--editable',
+            action='store_true',
+            default=False,
+            help='List editable projects.')
+        self.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.')
+        self.cmd_opts.add_option(cmdoptions.list_path())
+        self.cmd_opts.add_option(
+            '--pre',
+            action='store_true',
+            default=False,
+            help=("Include pre-release and development versions. By default, "
+                  "pip only finds stable versions."),
+        )
+
+        self.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",
+        )
+
+        self.cmd_opts.add_option(
+            '--not-required',
+            action='store_true',
+            dest='not_required',
+            help="List packages that are not dependencies of "
+                 "installed packages.",
+        )
+
+        self.cmd_opts.add_option(
+            '--exclude-editable',
+            action='store_false',
+            dest='include_editable',
+            help='Exclude editable package from output.',
+        )
+        self.cmd_opts.add_option(
+            '--include-editable',
+            action='store_true',
+            dest='include_editable',
+            help='Include editable package from output.',
+            default=True,
+        )
+        self.cmd_opts.add_option(cmdoptions.list_exclude())
+        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, self.cmd_opts)
+
+    def _build_package_finder(self, options, session):
+        # type: (Values, PipSession) -> PackageFinder
+        """
+        Create a package finder appropriate to this list command.
+        """
+        link_collector = LinkCollector.create(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):
+        # type: (Values, List[str]) -> int
+        if options.outdated and options.uptodate:
+            raise CommandError(
+                "Options --outdated and --uptodate cannot be combined.")
+
+        cmdoptions.check_list_path_option(options)
+
+        skip = set(stdlib_pkgs)
+        if options.excludes:
+            skip.update(options.excludes)
+
+        packages = get_installed_distributions(
+            local_only=options.local,
+            user_only=options.user,
+            editables_only=options.editable,
+            include_editables=options.include_editable,
+            paths=options.path,
+            skip=skip,
+        )
+
+        # 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)
+        return SUCCESS
+
+    def get_outdated(self, packages, options):
+        # type: (List[Distribution], Values) -> List[Distribution]
+        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):
+        # type: (List[Distribution], Values) -> List[Distribution]
+        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):
+        # type: (List[Distribution], Values) -> List[Distribution]
+        dep_keys = set()  # type: Set[Distribution]
+        for dist in packages:
+            dep_keys.update(requirement.key for requirement in dist.requires())
+
+        # Create a set to remove duplicate packages, and cast it to a list
+        # to keep the return type consistent with get_outdated and
+        # get_uptodate
+        return list({pkg for pkg in packages if pkg.key not in dep_keys})
+
+    def iter_packages_latest_infos(self, packages, options):
+        # type: (List[Distribution], Values) -> Iterator[Distribution]
+        with self._build_session(options) as session:
+            finder = self._build_package_finder(options, session)
+
+            def latest_info(dist):
+                # type: (Distribution) -> Distribution
+                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:
+                    return None
+
+                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
+                return dist
+
+            for dist in map(latest_info, packages):
+                if dist is not None:
+                    yield dist
+
+    def output_package_listing(self, packages, options):
+        # type: (List[Distribution], Values) -> None
+        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):
+        # type: (List[List[str]], List[str]) -> None
+        # 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 format_for_columns(pkgs, options):
+    # type: (List[Distribution], Values) -> Tuple[List[List[str]], List[str]]
+    """
+    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):
+    # type: (List[Distribution], Values) -> str
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/search.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/search.py
new file mode 100644
index 0000000000000000000000000000000000000000..185495e7688667b86ecc9397955ea34d6b526e19
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/search.py
@@ -0,0 +1,169 @@
+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 get_distribution, write_output
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Dict, List, Optional
+
+    from typing_extensions import TypedDict
+    TransformedHit = TypedDict(
+        'TransformedHit',
+        {'name': str, 'summary': str, 'versions': List[str]},
+    )
+
+logger = logging.getLogger(__name__)
+
+
+class SearchCommand(Command, SessionCommandMixin):
+    """Search for PyPI packages whose name or summary contains <query>."""
+
+    usage = """
+      %prog [options] <query>"""
+    ignore_require_venv = True
+
+    def add_options(self):
+        # type: () -> None
+        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):
+        # type: (Values, List[str]) -> int
+        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):
+        # type: (List[str], Values) -> List[Dict[str, str]]
+        index_url = options.index
+
+        session = self.get_default_session(options)
+
+        transport = PipXmlrpcTransport(index_url, session)
+        pypi = xmlrpc_client.ServerProxy(index_url, transport)
+        try:
+            hits = pypi.search({'name': query, 'summary': query}, 'or')
+        except xmlrpc_client.Fault as fault:
+            message = "XMLRPC request failed [code: {code}]\n{string}".format(
+                code=fault.faultCode,
+                string=fault.faultString,
+            )
+            raise CommandError(message)
+        return hits
+
+
+def transform_hits(hits):
+    # type: (List[Dict[str, str]]) -> List[TransformedHit]
+    """
+    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()  # type: OrderedDict[str, TransformedHit]
+    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):
+    # type: (List[TransformedHit], Optional[int], Optional[int]) -> 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_lines = textwrap.wrap(summary, target_width)
+                summary = ('\n' + ' ' * (name_column_width + 3)).join(
+                    summary_lines)
+
+        line = '{name_latest:{name_column_width}} - {summary}'.format(
+            name_latest='{name} ({latest})'.format(**locals()),
+            **locals())
+        try:
+            write_output(line)
+            if name in installed_packages:
+                dist = get_distribution(name)
+                assert dist is not None
+                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):
+    # type: (List[str]) -> str
+    return max(versions, key=parse_version)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/show.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/show.py
new file mode 100644
index 0000000000000000000000000000000000000000..b0b3f3abdccce7025ff8a00d29861e8bdc25379e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/show.py
@@ -0,0 +1,186 @@
+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
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import Dict, Iterator, List
+
+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] <package> ..."""
+    ignore_require_venv = True
+
+    def add_options(self):
+        # type: () -> None
+        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):
+        # type: (Values, List[str]) -> int
+        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):
+    # type: (List[str]) -> Iterator[Dict[str, str]]
+    """
+    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):
+        # type: (str) -> List[str]
+        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 = ''
+        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 = [line.split(',')[0] for line 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):
+    # type: (Iterator[Dict[str, str]], bool, bool) -> bool
+    """
+    Print the information 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py
new file mode 100644
index 0000000000000000000000000000000000000000..3371fe47ff16ab7af57606a941692262d3a8b4e0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/uninstall.py
@@ -0,0 +1,95 @@
+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.cli.status_codes import SUCCESS
+from pip._internal.exceptions import InstallationError
+from pip._internal.req import parse_requirements
+from pip._internal.req.constructors import (
+    install_req_from_line,
+    install_req_from_parsed_requirement,
+)
+from pip._internal.utils.misc import protect_pip_from_modification_on_windows
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import List
+
+
+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] <package> ...
+      %prog [options] -r <requirements file> ..."""
+
+    def add_options(self):
+        # type: () -> None
+        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):
+        # type: (Values, List[str]) -> int
+        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 parsed_req in parse_requirements(
+                    filename,
+                    options=options,
+                    session=session):
+                req = install_req_from_parsed_requirement(
+                    parsed_req,
+                    isolated=options.isolated_mode
+                )
+                if req.name:
+                    reqs_to_uninstall[canonicalize_name(req.name)] = req
+        if not reqs_to_uninstall:
+            raise InstallationError(
+                'You must give at least one requirement to {self.name} (see '
+                '"pip help {self.name}")'.format(**locals())
+            )
+
+        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()
+
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..a9f66258a14f5ae1ebdd6100d1ff7a07021821de
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/commands/wheel.py
@@ -0,0 +1,198 @@
+# -*- coding: utf-8 -*-
+
+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, with_cleanup
+from pip._internal.cli.status_codes import SUCCESS
+from pip._internal.exceptions import CommandError
+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 List
+
+    from pip._internal.req.req_install import InstallRequirement
+
+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] <requirement specifier> ...
+      %prog [options] -r <requirements file> ...
+      %prog [options] [-e] <vcs project url> ...
+      %prog [options] [-e] <local project path> ...
+      %prog [options] <archive url/path> ..."""
+
+    def add_options(self):
+        # type: () -> None
+
+        self.cmd_opts.add_option(
+            '-w', '--wheel-dir',
+            dest='wheel_dir',
+            metavar='dir',
+            default=os.curdir,
+            help=("Build wheels into <dir>, where the default is the "
+                  "current working directory."),
+        )
+        self.cmd_opts.add_option(cmdoptions.no_binary())
+        self.cmd_opts.add_option(cmdoptions.only_binary())
+        self.cmd_opts.add_option(cmdoptions.prefer_binary())
+        self.cmd_opts.add_option(
+            '--build-option',
+            dest='build_options',
+            metavar='options',
+            action='append',
+            help="Extra arguments to be supplied to 'setup.py bdist_wheel'.",
+        )
+        self.cmd_opts.add_option(cmdoptions.no_build_isolation())
+        self.cmd_opts.add_option(cmdoptions.use_pep517())
+        self.cmd_opts.add_option(cmdoptions.no_use_pep517())
+        self.cmd_opts.add_option(cmdoptions.constraints())
+        self.cmd_opts.add_option(cmdoptions.editable())
+        self.cmd_opts.add_option(cmdoptions.requirements())
+        self.cmd_opts.add_option(cmdoptions.src())
+        self.cmd_opts.add_option(cmdoptions.ignore_requires_python())
+        self.cmd_opts.add_option(cmdoptions.no_deps())
+        self.cmd_opts.add_option(cmdoptions.build_dir())
+        self.cmd_opts.add_option(cmdoptions.progress_bar())
+
+        self.cmd_opts.add_option(
+            '--no-verify',
+            dest='no_verify',
+            action='store_true',
+            default=False,
+            help="Don't verify if built wheel is valid.",
+        )
+
+        self.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.")
+
+        self.cmd_opts.add_option(
+            '--pre',
+            action='store_true',
+            default=False,
+            help=("Include pre-release and development versions. By default, "
+                  "pip only finds stable versions."),
+        )
+
+        self.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, self.cmd_opts)
+
+    @with_cleanup
+    def run(self, options, args):
+        # type: (Values, List[str]) -> int
+        cmdoptions.check_install_build_global(options)
+
+        session = self.get_default_session(options)
+
+        finder = self._build_package_finder(options, session)
+        wheel_cache = WheelCache(options.cache_dir, options.format_control)
+
+        options.wheel_dir = normalize_path(options.wheel_dir)
+        ensure_dir(options.wheel_dir)
+
+        req_tracker = self.enter_context(get_requirement_tracker())
+
+        directory = TempDirectory(
+            delete=not options.no_clean,
+            kind="wheel",
+            globally_managed=True,
+        )
+
+        reqs = self.get_requirements(args, options, finder, session)
+
+        preparer = self.make_requirement_preparer(
+            temp_build_dir=directory,
+            options=options,
+            req_tracker=req_tracker,
+            session=session,
+            finder=finder,
+            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)
+
+        requirement_set = resolver.resolve(
+            reqs, check_supported_wheels=True
+        )
+
+        reqs_to_build = []  # type: List[InstallRequirement]
+        for req in requirement_set.requirements.values():
+            if req.is_wheel:
+                preparer.save_linked_requirement(req)
+            elif should_build_for_wheel_command(req):
+                reqs_to_build.append(req)
+
+        # build wheels
+        build_successes, build_failures = build(
+            reqs_to_build,
+            wheel_cache=wheel_cache,
+            verify=(not options.no_verify),
+            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"
+            )
+
+        return SUCCESS
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/configuration.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/configuration.py
new file mode 100644
index 0000000000000000000000000000000000000000..23614fd2bbebe324696d1dce50552ff9f7c2e353
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/configuration.py
@@ -0,0 +1,407 @@
+"""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
+"""
+
+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)
+
+CONFIG_BASENAME = 'pip.ini' if WINDOWS else 'pip.conf'
+ENV_NAMES_IGNORED = "version", "help"
+
+# 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
+)
+OVERRIDE_ORDER = kinds.GLOBAL, kinds.USER, kinds.SITE, kinds.ENV, kinds.ENV_VAR
+VALID_LOAD_ONLY = kinds.USER, kinds.GLOBAL, kinds.SITE
+
+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)
+
+
+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, Optional[Kind]) -> None
+        super(Configuration, self).__init__()
+
+        if load_only is not None and 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))
+                )
+            )
+        self.isolated = isolated
+        self.load_only = load_only
+
+        # Because we keep track of where we got the data from
+        self._parsers = {
+            variant: [] for variant in OVERRIDE_ORDER
+        }  # type: Dict[Kind, List[Tuple[str, RawConfigParser]]]
+        self._config = {
+            variant: {} for variant in 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()
+
+        assert self.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()
+
+        assert self.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)
+            if not (parser.has_section(section)
+                    and parser.remove_option(section, name)):
+                # The option was not removed.
+                raise ConfigurationError(
+                    "Fatal Internal error [id=1]. Please report as a bug."
+                )
+
+            # The section may be empty after the option was removed.
+            if not parser.items(section):
+                parser.remove_section(section)
+            self._mark_as_modified(fname, parser)
+
+        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 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():
+            if key.startswith("PIP_"):
+                name = key[4:].lower()
+                if name not in ENV_NAMES_IGNORED:
+                    yield name, 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_values_in_config(self, variant):
+        # type: (Kind) -> Dict[str, Any]
+        """Get values present in a config file"""
+        return self._config[variant]
+
+    def _get_parser_to_modify(self):
+        # type: () -> Tuple[str, RawConfigParser]
+        # Determine which parser to modify
+        assert self.load_only
+        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)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{}({!r})".format(self.__class__.__name__, self._dictionary)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d5c1afc5bc1ffd09c0ce46f4f2f700a1b996fe47
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__init__.py
@@ -0,0 +1,24 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4be17d5263954d2241c2e6d26df78f3f37dbeb2e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fac52b27462be3c196415f7635521e47100d2eb1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..598252deccbe0dd9074591829e7b89fdc7406ac5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/installed.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ed96199efe64d446b272fbf2dbb668c8329182a8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/sdist.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..55f8d42bdb58629fccfa06077ba98b068e2bc78b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/base.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..3a789f804335312d6add6eec334bdc40fe5c151e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/base.py
@@ -0,0 +1,46 @@
+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.index.package_finder import PackageFinder
+    from pip._internal.req import InstallRequirement
+
+
+@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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/installed.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/installed.py
new file mode 100644
index 0000000000000000000000000000000000000000..a813b211fe6825f087c67c3700649cb7f2a9868d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/installed.py
@@ -0,0 +1,25 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..06b9df09cbe60444c056d8b2cdbeb40f7b9ca240
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/sdist.py
@@ -0,0 +1,105 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..2adc22862712f05cc92ece4b83e412be10105298
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/distributions/wheel.py
@@ -0,0 +1,37 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/exceptions.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/exceptions.py
new file mode 100644
index 0000000000000000000000000000000000000000..8d7f7fa39be6422b8230921186d39bb60430bc5f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/exceptions.py
@@ -0,0 +1,391 @@
+"""Exceptions used throughout package"""
+
+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 Any, Dict, List, Optional, Text
+
+    from pip._vendor.pkg_resources import Distribution
+    from pip._vendor.requests.models import Request, Response
+    from pip._vendor.six import PY3
+    from pip._vendor.six.moves import configparser
+
+    from pip._internal.req.req_install import InstallRequirement
+
+    if PY3:
+        from hashlib import _Hash
+    else:
+        from hashlib import _hash as _Hash
+
+
+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 NetworkConnectionError(PipError):
+    """HTTP connection error"""
+
+    def __init__(self, error_msg, response=None, request=None):
+        # type: (Text, Response, Request) -> None
+        """
+        Initialize NetworkConnectionError with  `request` and `response`
+        objects.
+        """
+        self.response = response
+        self.request = request
+        self.error_msg = error_msg
+        if (self.response is not None and not self.request and
+                hasattr(response, 'request')):
+            self.request = self.response.request
+        super(NetworkConnectionError, self).__init__(
+            error_msg, response, request)
+
+    def __str__(self):
+        # type: () -> str
+        return str(self.error_msg)
+
+
+class InvalidWheelFilename(InstallationError):
+    """Invalid wheel filename."""
+
+
+class UnsupportedWheel(InstallationError):
+    """Unsupported wheel."""
+
+
+class MetadataInconsistent(InstallationError):
+    """Built metadata contains inconsistent information.
+
+    This is raised when the metadata contains values (e.g. name and version)
+    that do not match the information previously obtained from sdist filename
+    or user-supplied ``#egg=`` value.
+    """
+    def __init__(self, ireq, field, built):
+        # type: (InstallRequirement, str, Any) -> None
+        self.ireq = ireq
+        self.field = field
+        self.built = built
+
+    def __str__(self):
+        # type: () -> str
+        return "Requested {} has different {} in metadata: {!r}".format(
+            self.ireq, self.field, self.built,
+        )
+
+
+class InstallationSubprocessError(InstallationError):
+    """A subprocess call failed during installation."""
+    def __init__(self, returncode, description):
+        # type: (int, str) -> None
+        self.returncode = returncode
+        self.description = description
+
+    def __str__(self):
+        # type: () -> str
+        return (
+            "Command errored out with exit status {}: {} "
+            "Check the logs for full command output."
+        ).format(self.returncode, self.description)
+
+
+class HashErrors(InstallationError):
+    """Multiple HashError instances rolled into one for reporting"""
+
+    def __init__(self):
+        # type: () -> None
+        self.errors = []  # type: List[HashError]
+
+    def append(self, error):
+        # type: (HashError) -> None
+        self.errors.append(error)
+
+    def __str__(self):
+        # type: () -> str
+        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)
+        return ''
+
+    def __nonzero__(self):
+        # type: () -> bool
+        return bool(self.errors)
+
+    def __bool__(self):
+        # type: () -> bool
+        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 = ''
+    order = -1  # type: int
+
+    def body(self):
+        # type: () -> str
+        """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
+            its link already populated by the resolver's _populate_link().
+
+        """
+        return '    {}'.format(self._requirement_name())
+
+    def __str__(self):
+        # type: () -> str
+        return '{}\n{}'.format(self.head, self.body())
+
+    def _requirement_name(self):
+        # type: () -> str
+        """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):
+        # type: (str) -> None
+        """
+        :param gotten_hash: The hash of the (possibly malicious) archive we
+            just downloaded
+        """
+        self.gotten_hash = gotten_hash
+
+    def body(self):
+        # type: () -> str
+        # 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 '    {} --hash={}:{}'.format(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):
+        # type: (Dict[str, List[str]], Dict[str, _Hash]) -> None
+        """
+        :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):
+        # type: () -> str
+        return '    {}:\n{}'.format(self._requirement_name(),
+                                    self._hash_comparison())
+
+    def _hash_comparison(self):
+        # type: () -> str
+        """
+        Return a comparison of actual and expected hash values.
+
+        Example::
+
+               Expected sha256 abcdeabcdeabcdeabcdeabcdeabcdeabcdeabcdeabcde
+                            or 123451234512345123451234512345123451234512345
+                    Got        bcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdefbcdef
+
+        """
+        def hash_then_or(hash_name):
+            # type: (str) -> chain[str]
+            # 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 = []  # type: List[str]
+        for hash_name, expecteds in iteritems(self.allowed):
+            prefix = hash_then_or(hash_name)
+            lines.extend(('        Expected {} {}'.format(next(prefix), e))
+                         for e in expecteds)
+            lines.append('             Got        {}\n'.format(
+                         self.gots[hash_name].hexdigest()))
+        return '\n'.join(lines)
+
+
+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):
+        # type: (str, Optional[str], Optional[configparser.Error]) -> None
+        super(ConfigurationFileCouldNotBeLoaded, self).__init__(error)
+        self.reason = reason
+        self.fname = fname
+        self.error = error
+
+    def __str__(self):
+        # type: () -> str
+        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)
+        return "Configuration file {}{}".format(self.reason, message_part)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7a17b7b3b6ad49157ee41f3da304fec3d32342d3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__init__.py
@@ -0,0 +1,2 @@
+"""Index interaction code
+"""
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..41dc9769970db9bb09fc6fb8827cc5af9e99c37b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ca16c785374fcb1e2549507f598c956d582daee4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/collector.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dc9f42315cb11a6bd8e1c8086797d15143ffbc39
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/__pycache__/package_finder.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/collector.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/collector.py
new file mode 100644
index 0000000000000000000000000000000000000000..b850b8cbed6c233d245282781c5a41054ec4b689
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/collector.py
@@ -0,0 +1,667 @@
+"""
+The main purpose of this module is to expose LinkCollector.collect_links().
+"""
+
+import cgi
+import functools
+import itertools
+import logging
+import mimetypes
+import os
+import re
+from collections import OrderedDict
+
+from pip._vendor import html5lib, requests
+from pip._vendor.distlib.compat import unescape
+from pip._vendor.requests.exceptions import 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.exceptions import NetworkConnectionError
+from pip._internal.models.link import Link
+from pip._internal.models.search_scope import SearchScope
+from pip._internal.network.utils import raise_for_status
+from pip._internal.utils.compat import lru_cache
+from pip._internal.utils.filetypes import is_archive_file
+from pip._internal.utils.misc import pairwise, 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:
+    import xml.etree.ElementTree
+    from optparse import Values
+    from typing import (
+        Callable,
+        Iterable,
+        List,
+        MutableMapping,
+        Optional,
+        Sequence,
+        Tuple,
+        Union,
+    )
+
+    from pip._vendor.requests import Response
+
+    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
+
+
+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)
+    raise_for_status(resp)
+
+    _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_archive_file(Link(url).filename):
+        _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",
+        },
+    )
+    raise_for_status(resp)
+
+    # 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 ``<base>`` 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_url_path_part(part):
+    # type: (str) -> str
+    """
+    Clean a "part" of a URL path (i.e. after splitting on "@" characters).
+    """
+    # We unquote prior to quoting to make sure nothing is double quoted.
+    return urllib_parse.quote(urllib_parse.unquote(part))
+
+
+def _clean_file_url_path(part):
+    # type: (str) -> str
+    """
+    Clean the first part of a URL path that corresponds to a local
+    filesystem path (i.e. the first part after splitting on "@" characters).
+    """
+    # We unquote prior to quoting to make sure nothing is double quoted.
+    # Also, 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.
+    return urllib_request.pathname2url(urllib_request.url2pathname(part))
+
+
+# percent-encoded:                   /
+_reserved_chars_re = re.compile('(@|%2F)', re.IGNORECASE)
+
+
+def _clean_url_path(path, is_local_path):
+    # type: (str, bool) -> str
+    """
+    Clean the path portion of a URL.
+    """
+    if is_local_path:
+        clean_func = _clean_file_url_path
+    else:
+        clean_func = _clean_url_path_part
+
+    # Split on the reserved characters prior to cleaning so that
+    # revision strings in VCS URLs are properly preserved.
+    parts = _reserved_chars_re.split(path)
+
+    cleaned_parts = []
+    for to_clean, reserved in pairwise(itertools.chain(parts, [''])):
+        cleaned_parts.append(clean_func(to_clean))
+        # Normalize %xx escapes (e.g. %2f -> %2F)
+        cleaned_parts.append(reserved.upper())
+
+    return ''.join(cleaned_parts)
+
+
+def _clean_link(url):
+    # type: (str) -> str
+    """
+    Make sure a link is fully quoted.
+    For example, if ' ' occurs in the URL, it will be replaced with "%20",
+    and without double-quoting other characters.
+    """
+    # Split the URL into parts according to the general structure
+    # `scheme://netloc/path;parameters?query#fragment`.
+    result = urllib_parse.urlparse(url)
+    # If the netloc is empty, then the URL refers to a local filesystem path.
+    is_local_path = not result.netloc
+    path = _clean_url_path(result.path, is_local_path=is_local_path)
+    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
+
+
+class CacheablePageContent(object):
+    def __init__(self, page):
+        # type: (HTMLPage) -> None
+        assert page.cache_link_parsing
+        self.page = page
+
+    def __eq__(self, other):
+        # type: (object) -> bool
+        return (isinstance(other, type(self)) and
+                self.page.url == other.page.url)
+
+    def __hash__(self):
+        # type: () -> int
+        return hash(self.page.url)
+
+
+def with_cached_html_pages(
+    fn,    # type: Callable[[HTMLPage], Iterable[Link]]
+):
+    # type: (...) -> Callable[[HTMLPage], List[Link]]
+    """
+    Given a function that parses an Iterable[Link] from an HTMLPage, cache the
+    function's result (keyed by CacheablePageContent), unless the HTMLPage
+    `page` has `page.cache_link_parsing == False`.
+    """
+
+    @lru_cache(maxsize=None)
+    def wrapper(cacheable_page):
+        # type: (CacheablePageContent) -> List[Link]
+        return list(fn(cacheable_page.page))
+
+    @functools.wraps(fn)
+    def wrapper_wrapper(page):
+        # type: (HTMLPage) -> List[Link]
+        if page.cache_link_parsing:
+            return wrapper(CacheablePageContent(page))
+        return list(fn(page))
+
+    return wrapper_wrapper
+
+
+@with_cached_html_pages
+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
+        cache_link_parsing=True,  # type: bool
+    ):
+        # type: (...) -> None
+        """
+        :param encoding: the encoding to decode the given content.
+        :param url: the URL from which the HTML was downloaded.
+        :param cache_link_parsing: whether links parsed from this page's url
+                                   should be cached. PyPI index urls should
+                                   have this set to False, for example.
+        """
+        self.content = content
+        self.encoding = encoding
+        self.url = url
+        self.cache_link_parsing = cache_link_parsing
+
+    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, cache_link_parsing=True):
+    # type: (Response, bool) -> HTMLPage
+    encoding = _get_encoding_from_headers(response.headers)
+    return HTMLPage(
+        response.content,
+        encoding=encoding,
+        url=response.url,
+        cache_link_parsing=cache_link_parsing)
+
+
+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.warning('Cannot look at %s URL %s because it does not support '
+                       'lookup as web pages.', 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.warning(
+            'Skipping page %s because it looks like an archive, and cannot '
+            'be checked by a HTTP HEAD request.', link,
+        )
+    except _NotHTML as exc:
+        logger.warning(
+            'Skipping page %s because the %s request got Content-Type: %s.'
+            'The only supported Content-Type is text/html',
+            link, exc.request_desc, exc.content_type,
+        )
+    except NetworkConnectionError 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: {}".format(exc))
+    except requests.Timeout:
+        _handle_get_page_fail(link, "timed out")
+    else:
+        return _make_html_page(resp,
+                               cache_link_parsing=link.cache_link_parsing)
+    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 '%s' is ignored: it is a directory.", 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
+
+    @classmethod
+    def create(cls, session, options, suppress_no_index=False):
+        # type: (PipSession, Values, bool) -> 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
+
+    @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(
+                # Mark PyPI indices as "cache_link_parsing == False" -- this
+                # will avoid caching the result of parsing the page for links.
+                (Link(url, cache_link_parsing=False) for url in index_url_loc),
+                (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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/package_finder.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/package_finder.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f39631dde2e90dd5d204fefcae10155f5eb3d27
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/index/package_finder.py
@@ -0,0 +1,1015 @@
+"""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.compat import lru_cache
+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 '<none given>'
+            # 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: {}'.format(ext))
+            if "binary" not in self._formats and ext == WHEEL_EXTENSION:
+                reason = 'No binaries permitted for {}'.format(
+                    self.project_name)
+                return (False, reason)
+            if "macosx10" in link.path and ext == '.zip':
+                return (False, 'macosx10 one')
+            if 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 {})'.format(
+                        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:
+            reason = 'No sources permitted for {}'.format(self.project_name)
+            return (False, reason)
+
+        if not version:
+            version = _extract_version_from_fragment(
+                egg_info, self._canonical_name,
+            )
+        if not version:
+            reason = 'Missing project version for {}'.format(self.project_name)
+            return (False, reason)
+
+        match = self._py_version_re.search(version)
+        if match:
+            version = version[:match.start()]
+            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(
+                    "{} is not a supported wheel for this platform. It "
+                    "can't be sorted.".format(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)
+        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 target_python(self):
+        # type: () -> TargetPython
+        return self._target_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
+
+    @property
+    def prefer_binary(self):
+        # type: () -> bool
+        return self._candidate_prefs.prefer_binary
+
+    def set_prefer_binary(self):
+        # type: () -> None
+        self._candidate_prefs.prefer_binary = 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
+
+    @lru_cache(maxsize=None)
+    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,
+        )
+
+    @lru_cache(maxsize=None)
+    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[InstallationCandidate]
+        """Try to find a Link matching req
+
+        Expects req, an InstallRequirement and upgrade, a boolean
+        Returns a InstallationCandidate 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 {}'.format(
+                    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
+
+
+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 <package>+<version> 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 <package>+<version> 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/locations.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/locations.py
new file mode 100644
index 0000000000000000000000000000000000000000..f521844525a6a2de0559a640205636a61edc7c18
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/locations.py
@@ -0,0 +1,199 @@
+"""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 distutils.cmd import Command as DistutilsCommand
+    from typing import Dict, List, Optional, Union
+
+
+# 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
+
+# The python2.7 part of this is Debian specific:
+# https://github.com/pypa/pip/issues/5193
+# https://bitbucket.org/pypy/pypy/issues/2506/sysconfig-returns-incorrect-paths
+can_not_depend_on_purelib = (
+    sys.version_info[:2] == (2, 7) or
+    platform.python_implementation().lower() == "pypy"
+)
+site_packages = None  # type: Optional[str]
+if can_not_depend_on_purelib:
+    site_packages = distutils_sysconfig.get_python_lib()
+else:
+    site_packages = sysconfig.get_path("purelib")
+
+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(
+            i.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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/main.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/main.py
new file mode 100644
index 0000000000000000000000000000000000000000..1c99c49a1f1121fa1fec618eb3330fdfe991dc83
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/main.py
@@ -0,0 +1,16 @@
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import List, Optional
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7855226e4b500142deef8fb247cd33a9a991d122
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__init__.py
@@ -0,0 +1,2 @@
+"""A package that contains models that represent entities.
+"""
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dfb835cca7ba4046c2d3b1a6cdfa779916793c28
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ab961d01909e5cd52d6441663870c1644fdc236e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/candidate.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f74f36444a0c0476e36c7df01d1e7be3561a87f7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/direct_url.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..029dc27353fe13c23cfe5427bd4826d2ca82b738
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/format_control.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fe3068f21a2e6cfebed6202da0875799a214b7e3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/index.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f3eddd6e18b1d7b8f4ddad661d7252177d58f0b8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/link.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9b324cd514ca3eedc1b4c73d548dfa253c2b094c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/scheme.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..335f89f0cee50a67b0b6a72e9643bab6d74002c9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/search_scope.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ed08ebd938a0efd0783033eaf69f468622c8352a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/selection_prefs.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49bbd2ba7601e2c4b4ae7bb061248c6ac9ab9852
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/target_python.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fbd0dc58f2c15c62d46a34627bfd8d36c3e10435
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/candidate.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/candidate.py
new file mode 100644
index 0000000000000000000000000000000000000000..0d89a8c07dac80629d5ff140006206c8400e77f1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/candidate.py
@@ -0,0 +1,39 @@
+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.
+    """
+
+    __slots__ = ["name", "version", "link"]
+
+    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 "<InstallationCandidate({!r}, {!r}, {!r})>".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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/direct_url.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/direct_url.py
new file mode 100644
index 0000000000000000000000000000000000000000..99aa68d121bb5c1512a4c6723295741923bc0f67
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/direct_url.py
@@ -0,0 +1,243 @@
+""" PEP 610 """
+import json
+import re
+
+from pip._vendor import six
+from pip._vendor.six.moves.urllib import parse as urllib_parse
+
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, Dict, Iterable, Optional, Type, TypeVar, Union
+
+    T = TypeVar("T")
+
+
+DIRECT_URL_METADATA_NAME = "direct_url.json"
+ENV_VAR_RE = re.compile(r"^\$\{[A-Za-z0-9-_]+\}(:\$\{[A-Za-z0-9-_]+\})?$")
+
+__all__ = [
+    "DirectUrl",
+    "DirectUrlValidationError",
+    "DirInfo",
+    "ArchiveInfo",
+    "VcsInfo",
+]
+
+
+class DirectUrlValidationError(Exception):
+    pass
+
+
+def _get(d, expected_type, key, default=None):
+    # type: (Dict[str, Any], Type[T], str, Optional[T]) -> Optional[T]
+    """Get value from dictionary and verify expected type."""
+    if key not in d:
+        return default
+    value = d[key]
+    if six.PY2 and expected_type is str:
+        expected_type = six.string_types  # type: ignore
+    if not isinstance(value, expected_type):
+        raise DirectUrlValidationError(
+            "{!r} has unexpected type for {} (expected {})".format(
+                value, key, expected_type
+            )
+        )
+    return value
+
+
+def _get_required(d, expected_type, key, default=None):
+    # type: (Dict[str, Any], Type[T], str, Optional[T]) -> T
+    value = _get(d, expected_type, key, default)
+    if value is None:
+        raise DirectUrlValidationError("{} must have a value".format(key))
+    return value
+
+
+def _exactly_one_of(infos):
+    # type: (Iterable[Optional[InfoType]]) -> InfoType
+    infos = [info for info in infos if info is not None]
+    if not infos:
+        raise DirectUrlValidationError(
+            "missing one of archive_info, dir_info, vcs_info"
+        )
+    if len(infos) > 1:
+        raise DirectUrlValidationError(
+            "more than one of archive_info, dir_info, vcs_info"
+        )
+    assert infos[0] is not None
+    return infos[0]
+
+
+def _filter_none(**kwargs):
+    # type: (Any) -> Dict[str, Any]
+    """Make dict excluding None values."""
+    return {k: v for k, v in kwargs.items() if v is not None}
+
+
+class VcsInfo(object):
+    name = "vcs_info"
+
+    def __init__(
+        self,
+        vcs,  # type: str
+        commit_id,  # type: str
+        requested_revision=None,  # type: Optional[str]
+        resolved_revision=None,  # type: Optional[str]
+        resolved_revision_type=None,  # type: Optional[str]
+    ):
+        self.vcs = vcs
+        self.requested_revision = requested_revision
+        self.commit_id = commit_id
+        self.resolved_revision = resolved_revision
+        self.resolved_revision_type = resolved_revision_type
+
+    @classmethod
+    def _from_dict(cls, d):
+        # type: (Optional[Dict[str, Any]]) -> Optional[VcsInfo]
+        if d is None:
+            return None
+        return cls(
+            vcs=_get_required(d, str, "vcs"),
+            commit_id=_get_required(d, str, "commit_id"),
+            requested_revision=_get(d, str, "requested_revision"),
+            resolved_revision=_get(d, str, "resolved_revision"),
+            resolved_revision_type=_get(d, str, "resolved_revision_type"),
+        )
+
+    def _to_dict(self):
+        # type: () -> Dict[str, Any]
+        return _filter_none(
+            vcs=self.vcs,
+            requested_revision=self.requested_revision,
+            commit_id=self.commit_id,
+            resolved_revision=self.resolved_revision,
+            resolved_revision_type=self.resolved_revision_type,
+        )
+
+
+class ArchiveInfo(object):
+    name = "archive_info"
+
+    def __init__(
+        self,
+        hash=None,  # type: Optional[str]
+    ):
+        self.hash = hash
+
+    @classmethod
+    def _from_dict(cls, d):
+        # type: (Optional[Dict[str, Any]]) -> Optional[ArchiveInfo]
+        if d is None:
+            return None
+        return cls(hash=_get(d, str, "hash"))
+
+    def _to_dict(self):
+        # type: () -> Dict[str, Any]
+        return _filter_none(hash=self.hash)
+
+
+class DirInfo(object):
+    name = "dir_info"
+
+    def __init__(
+        self,
+        editable=False,  # type: bool
+    ):
+        self.editable = editable
+
+    @classmethod
+    def _from_dict(cls, d):
+        # type: (Optional[Dict[str, Any]]) -> Optional[DirInfo]
+        if d is None:
+            return None
+        return cls(
+            editable=_get_required(d, bool, "editable", default=False)
+        )
+
+    def _to_dict(self):
+        # type: () -> Dict[str, Any]
+        return _filter_none(editable=self.editable or None)
+
+
+if MYPY_CHECK_RUNNING:
+    InfoType = Union[ArchiveInfo, DirInfo, VcsInfo]
+
+
+class DirectUrl(object):
+
+    def __init__(
+        self,
+        url,  # type: str
+        info,  # type: InfoType
+        subdirectory=None,  # type: Optional[str]
+    ):
+        self.url = url
+        self.info = info
+        self.subdirectory = subdirectory
+
+    def _remove_auth_from_netloc(self, netloc):
+        # type: (str) -> str
+        if "@" not in netloc:
+            return netloc
+        user_pass, netloc_no_user_pass = netloc.split("@", 1)
+        if (
+            isinstance(self.info, VcsInfo) and
+            self.info.vcs == "git" and
+            user_pass == "git"
+        ):
+            return netloc
+        if ENV_VAR_RE.match(user_pass):
+            return netloc
+        return netloc_no_user_pass
+
+    @property
+    def redacted_url(self):
+        # type: () -> str
+        """url with user:password part removed unless it is formed with
+        environment variables as specified in PEP 610, or it is ``git``
+        in the case of a git URL.
+        """
+        purl = urllib_parse.urlsplit(self.url)
+        netloc = self._remove_auth_from_netloc(purl.netloc)
+        surl = urllib_parse.urlunsplit(
+            (purl.scheme, netloc, purl.path, purl.query, purl.fragment)
+        )
+        return surl
+
+    def validate(self):
+        # type: () -> None
+        self.from_dict(self.to_dict())
+
+    @classmethod
+    def from_dict(cls, d):
+        # type: (Dict[str, Any]) -> DirectUrl
+        return DirectUrl(
+            url=_get_required(d, str, "url"),
+            subdirectory=_get(d, str, "subdirectory"),
+            info=_exactly_one_of(
+                [
+                    ArchiveInfo._from_dict(_get(d, dict, "archive_info")),
+                    DirInfo._from_dict(_get(d, dict, "dir_info")),
+                    VcsInfo._from_dict(_get(d, dict, "vcs_info")),
+                ]
+            ),
+        )
+
+    def to_dict(self):
+        # type: () -> Dict[str, Any]
+        res = _filter_none(
+            url=self.redacted_url,
+            subdirectory=self.subdirectory,
+        )
+        res[self.info.name] = self.info._to_dict()
+        return res
+
+    @classmethod
+    def from_json(cls, s):
+        # type: (str) -> DirectUrl
+        return cls.from_dict(json.loads(s))
+
+    def to_json(self):
+        # type: () -> str
+        return json.dumps(self.to_dict(), sort_keys=True)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/format_control.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/format_control.py
new file mode 100644
index 0000000000000000000000000000000000000000..adcf61e28549478acd14ec73f530bbce61ef395e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/format_control.py
@@ -0,0 +1,92 @@
+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 FrozenSet, Optional, Set
+
+
+class FormatControl(object):
+    """Helper for managing formats from which a package can be installed.
+    """
+
+    __slots__ = ["no_binary", "only_binary"]
+
+    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
+        if not isinstance(other, self.__class__):
+            return NotImplemented
+
+        if self.__slots__ != other.__slots__:
+            return False
+
+        return all(
+            getattr(self, k) == getattr(other, k)
+            for k in self.__slots__
+        )
+
+    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, Set[str], 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/index.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/index.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b4a1fe2274126ffa27d62e1ed4a7cbc2699ea3a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/index.py
@@ -0,0 +1,34 @@
+from pip._vendor.six.moves.urllib import parse as urllib_parse
+
+
+class PackageIndex(object):
+    """Represents a Package Index and provides easier access to endpoints
+    """
+
+    __slots__ = ['url', 'netloc', 'simple_url', 'pypi_url',
+                 'file_storage_domain']
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/link.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/link.py
new file mode 100644
index 0000000000000000000000000000000000000000..29ef402beefccb82a3c6fa6b8fe85c21f09ce56c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/link.py
@@ -0,0 +1,246 @@
+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
+    """
+
+    __slots__ = [
+        "_parsed_url",
+        "_url",
+        "comes_from",
+        "requires_python",
+        "yanked_reason",
+        "cache_link_parsing",
+    ]
+
+    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]
+        cache_link_parsing=True,  # type: bool
+    ):
+        # 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.
+        :param cache_link_parsing: A flag that is used elsewhere to determine
+                                   whether resources retrieved from this link
+                                   should be cached. PyPI index urls should
+                                   generally have this set to False, for
+                                   example.
+        """
+
+        # 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)
+
+        self.cache_link_parsing = cache_link_parsing
+
+    def __str__(self):
+        # type: () -> str
+        if self.requires_python:
+            rp = ' (requires-python:{})'.format(self.requires_python)
+        else:
+            rp = ''
+        if self.comes_from:
+            return '{} (from {}){}'.format(
+                redact_auth_from_url(self._url), self.comes_from, rp)
+        else:
+            return redact_auth_from_url(str(self._url))
+
+    def __repr__(self):
+        # type: () -> str
+        return '<Link {}>'.format(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 {self._url!r} produced no filename'.format(**locals()))
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/scheme.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/scheme.py
new file mode 100644
index 0000000000000000000000000000000000000000..5040551eb0e9b55bd88df6fd57da7c8a1d6a467c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/scheme.py
@@ -0,0 +1,31 @@
+"""
+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.
+"""
+
+
+SCHEME_KEYS = ['platlib', 'purelib', 'headers', 'scripts', 'data']
+
+
+class Scheme(object):
+    """A Scheme holds paths which are used as the base directories for
+    artifacts associated with a Python package.
+    """
+
+    __slots__ = SCHEME_KEYS
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/search_scope.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/search_scope.py
new file mode 100644
index 0000000000000000000000000000000000000000..d732504e6f55f9fab4ab222754bab4beab31ca87
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/search_scope.py
@@ -0,0 +1,135 @@
+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.
+    """
+
+    __slots__ = ["find_links", "index_urls"]
+
+    @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 = []
+        redacted_index_urls = []
+        if self.index_urls and self.index_urls != [PyPI.simple_url]:
+            for url in self.index_urls:
+
+                redacted_index_url = redact_auth_from_url(url)
+
+                # Parse the URL
+                purl = urllib_parse.urlsplit(redacted_index_url)
+
+                # URL is generally invalid if scheme and netloc is missing
+                # there are issues with Python and URL parsing, so this test
+                # is a bit crude. See bpo-20271, bpo-23505. Python doesn't
+                # always parse invalid URLs correctly - it should raise
+                # exceptions for malformed URLs
+                if not purl.scheme and not purl.netloc:
+                    logger.warning(
+                        'The index url "%s" seems invalid, '
+                        'please provide a scheme.', redacted_index_url)
+
+                redacted_index_urls.append(redacted_index_url)
+
+            lines.append('Looking in indexes: {}'.format(
+                ', '.join(redacted_index_urls)))
+
+        if self.find_links:
+            lines.append(
+                'Looking in links: {}'.format(', '.join(
+                    redact_auth_from_url(url) for url in self.find_links))
+            )
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py
new file mode 100644
index 0000000000000000000000000000000000000000..83110dd8f9032be10ac3bb55dd5e7c6834b339b6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/selection_prefs.py
@@ -0,0 +1,50 @@
+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.
+    """
+
+    __slots__ = ['allow_yanked', 'allow_all_prereleases', 'format_control',
+                 'prefer_binary', 'ignore_requires_python']
+
+    # 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/target_python.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/target_python.py
new file mode 100644
index 0000000000000000000000000000000000000000..4593dc854f89846cf9507f0d0035ae799def5d8d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/target_python.py
@@ -0,0 +1,117 @@
+import sys
+
+from pip._internal.utils.compatibility_tags 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.
+    """
+
+    __slots__ = [
+        "_given_py_version_info",
+        "abis",
+        "implementation",
+        "platforms",
+        "py_version",
+        "py_version_info",
+        "_valid_tags",
+    ]
+
+    def __init__(
+        self,
+        platforms=None,  # type: Optional[List[str]]
+        py_version_info=None,  # type: Optional[Tuple[int, ...]]
+        abis=None,  # type: Optional[List[str]]
+        implementation=None,  # type: Optional[str]
+    ):
+        # type: (...) -> None
+        """
+        :param platforms: A list of strings or None. If None, searches for
+            packages that are supported by the current system. Otherwise, will
+            find packages that can be built on the platforms 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 abis: A list of strings or None. This is passed to
+            compatibility_tags.py's get_supported() function as is.
+        :param implementation: A string or None. This is passed to
+            compatibility_tags.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.abis = abis
+        self.implementation = implementation
+        self.platforms = platforms
+        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 = [
+            ('platforms', self.platforms),
+            ('version_info', display_version),
+            ('abis', self.abis),
+            ('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,
+                platforms=self.platforms,
+                abis=self.abis,
+                impl=self.implementation,
+            )
+            self._valid_tags = tags
+
+        return self._valid_tags
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d4068f3b737da1fb607812e6f170b5aa746baff
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/models/wheel.py
@@ -0,0 +1,78 @@
+"""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<namever>(?P<name>.+?)-(?P<ver>.*?))
+        ((-(?P<build>\d[^-]*?))?-(?P<pyver>.+?)-(?P<abi>.+?)-(?P<plat>.+?)
+        \.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(
+                "{} is not a valid wheel filename.".format(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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..b51bde91b2e5b4e557ed9b70fc113843cc3d49ae
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__init__.py
@@ -0,0 +1,2 @@
+"""Contains purely network-related utilities.
+"""
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3fb263382974a07ceecac6cce5d438786ef27ea0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ae96c5f9060c569a6d49f7d4f516db6b2f8ad256
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/auth.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a3a28e54fe9f341245c6584fa7ff94fdbd66b488
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/cache.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b5d83dd1162f912a07d7f317293b5ec40accd49b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/download.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..377799f20600d1d02304d60308d1094039dad5c8
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/lazy_wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8cac2aba21748ce2f8c0d7a1d8f58aa6b155055b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/session.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1da16404ade3344c1d036668918e1a3686921565
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ba7805fa6a1d72b2e3fec36129a8fd75d2e2e8e9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/__pycache__/xmlrpc.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/auth.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/auth.py
new file mode 100644
index 0000000000000000000000000000000000000000..357811a16f14107484bdd1590d5c770698dcc2da
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/auth.py
@@ -0,0 +1,310 @@
+"""Network Authentication Helpers
+
+Contains interface (MultiDomainBasicAuth) and associated glue code for
+providing credentials in the context of network requests.
+"""
+
+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 typing import Any, Dict, List, Optional, Tuple
+
+    from pip._vendor.requests.models import Request, Response
+
+    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):
+    # type: (str, str) -> Optional[AuthInfo]
+    """Return the tuple auth for a given url from keyring."""
+    global 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),
+        )
+        keyring = None
+    return None
+
+
+class MultiDomainBasicAuth(AuthBase):
+
+    def __init__(self, prompting=True, index_urls=None):
+        # type: (bool, Optional[List[str]]) -> 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):
+        # type: (str) -> Optional[str]
+        """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
+        return None
+
+    def _get_new_credentials(self, original_url, allow_netrc=True,
+                             allow_keyring=True):
+        # type: (str, bool, bool) -> AuthInfo
+        """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):
+        # type: (str) -> Tuple[str, Optional[str], Optional[str]]
+        """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):
+        # type: (Request) -> Request
+        # 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):
+        # type: (str) -> Tuple[Optional[str], Optional[str], bool]
+        username = ask_input("User for {}: ".format(netloc))
+        if not username:
+            return None, None, False
+        auth = get_keyring_auth(netloc, username)
+        if auth and auth[0] is not None and auth[1] is not None:
+            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):
+        # type: () -> bool
+        if not keyring:
+            return False
+        return ask("Save credentials to keyring [y/N]: ", ["y", "n"]) == "y"
+
+    def handle_401(self, resp, **kwargs):
+        # type: (Response, **Any) -> Response
+        # 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):
+        # type: (Response, **Any) -> None
+        """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):
+        # type: (Response, **Any) -> None
+        """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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/cache.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/cache.py
new file mode 100644
index 0000000000000000000000000000000000000000..d2a1b7313f7f070d5ae14efbdc62db574861ec24
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/cache.py
@@ -0,0 +1,79 @@
+"""HTTP cache implementation.
+"""
+
+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 Iterator, Optional
+
+
+def is_from_cache(response):
+    # type: (Response) -> bool
+    return getattr(response, "from_cache", False)
+
+
+@contextmanager
+def suppressed_cache_errors():
+    # type: () -> Iterator[None]
+    """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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/download.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/download.py
new file mode 100644
index 0000000000000000000000000000000000000000..76896e89970a2f47bf71c9dc15603d5c72aac2b6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/download.py
@@ -0,0 +1,202 @@
+"""Download files with progress indicators.
+"""
+import cgi
+import logging
+import mimetypes
+import os
+
+from pip._vendor.requests.models import CONTENT_CHUNK_SIZE
+
+from pip._internal.cli.progress_bars import DownloadProgressProvider
+from pip._internal.exceptions import NetworkConnectionError
+from pip._internal.models.index import PyPI
+from pip._internal.network.cache import is_from_cache
+from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks
+from pip._internal.utils.misc import format_size, redact_auth_from_url, splitext
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Iterable, Optional, Tuple
+
+    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, headers=HEADERS, stream=True)
+    raise_for_status(resp)
+    return resp
+
+
+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, location):
+        # type: (Link, str) -> Tuple[str, str]
+        """Download the file given by link into location."""
+        try:
+            resp = _http_get_download(self._session, link)
+        except NetworkConnectionError as e:
+            assert e.response is not None
+            logger.critical(
+                "HTTP error %s while getting %s", e.response.status_code, link
+            )
+            raise
+
+        filename = _get_http_response_filename(resp, link)
+        filepath = os.path.join(location, filename)
+
+        chunks = _prepare_download(resp, link, self._progress_bar)
+        with open(filepath, 'wb') as content_file:
+            for chunk in chunks:
+                content_file.write(chunk)
+        content_type = resp.headers.get('Content-Type', '')
+        return filepath, content_type
+
+
+class BatchDownloader(object):
+
+    def __init__(
+        self,
+        session,  # type: PipSession
+        progress_bar,  # type: str
+    ):
+        # type: (...) -> None
+        self._session = session
+        self._progress_bar = progress_bar
+
+    def __call__(self, links, location):
+        # type: (Iterable[Link], str) -> Iterable[Tuple[str, Tuple[str, str]]]
+        """Download the files given by links into location."""
+        for link in links:
+            try:
+                resp = _http_get_download(self._session, link)
+            except NetworkConnectionError as e:
+                assert e.response is not None
+                logger.critical(
+                    "HTTP error %s while getting %s",
+                    e.response.status_code, link,
+                )
+                raise
+
+            filename = _get_http_response_filename(resp, link)
+            filepath = os.path.join(location, filename)
+
+            chunks = _prepare_download(resp, link, self._progress_bar)
+            with open(filepath, 'wb') as content_file:
+                for chunk in chunks:
+                    content_file.write(chunk)
+            content_type = resp.headers.get('Content-Type', '')
+            yield link.url, (filepath, content_type)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/lazy_wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/lazy_wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..608475abab37b01caaf7790e7bdfb7df2e38549f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/lazy_wheel.py
@@ -0,0 +1,231 @@
+"""Lazy ZIP over HTTP"""
+
+__all__ = ['HTTPRangeRequestUnsupported', 'dist_from_wheel_url']
+
+from bisect import bisect_left, bisect_right
+from contextlib import contextmanager
+from tempfile import NamedTemporaryFile
+from zipfile import BadZipfile, ZipFile
+
+from pip._vendor.requests.models import CONTENT_CHUNK_SIZE
+from pip._vendor.six.moves import range
+
+from pip._internal.network.utils import HEADERS, raise_for_status, response_chunks
+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 typing import Any, Dict, Iterator, List, Optional, Tuple
+
+    from pip._vendor.pkg_resources import Distribution
+    from pip._vendor.requests.models import Response
+
+    from pip._internal.network.session import PipSession
+
+
+class HTTPRangeRequestUnsupported(Exception):
+    pass
+
+
+def dist_from_wheel_url(name, url, session):
+    # type: (str, str, PipSession) -> Distribution
+    """Return a pkg_resources.Distribution from the given wheel URL.
+
+    This uses HTTP range requests to only fetch the potion of the wheel
+    containing metadata, just enough for the object to be constructed.
+    If such requests are not supported, HTTPRangeRequestUnsupported
+    is raised.
+    """
+    with LazyZipOverHTTP(url, session) as wheel:
+        # For read-only ZIP files, ZipFile only needs methods read,
+        # seek, seekable and tell, not the whole IO protocol.
+        zip_file = ZipFile(wheel)  # type: ignore
+        # After context manager exit, wheel.name
+        # is an invalid file by intention.
+        return pkg_resources_distribution_for_wheel(zip_file, name, wheel.name)
+
+
+class LazyZipOverHTTP(object):
+    """File-like object mapped to a ZIP file over HTTP.
+
+    This uses HTTP range requests to lazily fetch the file's content,
+    which is supposed to be fed to ZipFile.  If such requests are not
+    supported by the server, raise HTTPRangeRequestUnsupported
+    during initialization.
+    """
+
+    def __init__(self, url, session, chunk_size=CONTENT_CHUNK_SIZE):
+        # type: (str, PipSession, int) -> None
+        head = session.head(url, headers=HEADERS)
+        raise_for_status(head)
+        assert head.status_code == 200
+        self._session, self._url, self._chunk_size = session, url, chunk_size
+        self._length = int(head.headers['Content-Length'])
+        self._file = NamedTemporaryFile()
+        self.truncate(self._length)
+        self._left = []  # type: List[int]
+        self._right = []  # type: List[int]
+        if 'bytes' not in head.headers.get('Accept-Ranges', 'none'):
+            raise HTTPRangeRequestUnsupported('range request is not supported')
+        self._check_zip()
+
+    @property
+    def mode(self):
+        # type: () -> str
+        """Opening mode, which is always rb."""
+        return 'rb'
+
+    @property
+    def name(self):
+        # type: () -> str
+        """Path to the underlying file."""
+        return self._file.name
+
+    def seekable(self):
+        # type: () -> bool
+        """Return whether random access is supported, which is True."""
+        return True
+
+    def close(self):
+        # type: () -> None
+        """Close the file."""
+        self._file.close()
+
+    @property
+    def closed(self):
+        # type: () -> bool
+        """Whether the file is closed."""
+        return self._file.closed
+
+    def read(self, size=-1):
+        # type: (int) -> bytes
+        """Read up to size bytes from the object and return them.
+
+        As a convenience, if size is unspecified or -1,
+        all bytes until EOF are returned.  Fewer than
+        size bytes may be returned if EOF is reached.
+        """
+        download_size = max(size, self._chunk_size)
+        start, length = self.tell(), self._length
+        stop = length if size < 0 else min(start+download_size, length)
+        start = max(0, stop-download_size)
+        self._download(start, stop-1)
+        return self._file.read(size)
+
+    def readable(self):
+        # type: () -> bool
+        """Return whether the file is readable, which is True."""
+        return True
+
+    def seek(self, offset, whence=0):
+        # type: (int, int) -> int
+        """Change stream position and return the new absolute position.
+
+        Seek to offset relative position indicated by whence:
+        * 0: Start of stream (the default).  pos should be >= 0;
+        * 1: Current position - pos may be negative;
+        * 2: End of stream - pos usually negative.
+        """
+        return self._file.seek(offset, whence)
+
+    def tell(self):
+        # type: () -> int
+        """Return the current possition."""
+        return self._file.tell()
+
+    def truncate(self, size=None):
+        # type: (Optional[int]) -> int
+        """Resize the stream to the given size in bytes.
+
+        If size is unspecified resize to the current position.
+        The current stream position isn't changed.
+
+        Return the new file size.
+        """
+        return self._file.truncate(size)
+
+    def writable(self):
+        # type: () -> bool
+        """Return False."""
+        return False
+
+    def __enter__(self):
+        # type: () -> LazyZipOverHTTP
+        self._file.__enter__()
+        return self
+
+    def __exit__(self, *exc):
+        # type: (*Any) -> Optional[bool]
+        return self._file.__exit__(*exc)
+
+    @contextmanager
+    def _stay(self):
+        # type: ()-> Iterator[None]
+        """Return a context manager keeping the position.
+
+        At the end of the block, seek back to original position.
+        """
+        pos = self.tell()
+        try:
+            yield
+        finally:
+            self.seek(pos)
+
+    def _check_zip(self):
+        # type: () -> None
+        """Check and download until the file is a valid ZIP."""
+        end = self._length - 1
+        for start in reversed(range(0, end, self._chunk_size)):
+            self._download(start, end)
+            with self._stay():
+                try:
+                    # For read-only ZIP files, ZipFile only needs
+                    # methods read, seek, seekable and tell.
+                    ZipFile(self)  # type: ignore
+                except BadZipfile:
+                    pass
+                else:
+                    break
+
+    def _stream_response(self, start, end, base_headers=HEADERS):
+        # type: (int, int, Dict[str, str]) -> Response
+        """Return HTTP response to a range request from start to end."""
+        headers = base_headers.copy()
+        headers['Range'] = 'bytes={}-{}'.format(start, end)
+        # TODO: Get range requests to be correctly cached
+        headers['Cache-Control'] = 'no-cache'
+        return self._session.get(self._url, headers=headers, stream=True)
+
+    def _merge(self, start, end, left, right):
+        # type: (int, int, int, int) -> Iterator[Tuple[int, int]]
+        """Return an iterator of intervals to be fetched.
+
+        Args:
+            start (int): Start of needed interval
+            end (int): End of needed interval
+            left (int): Index of first overlapping downloaded data
+            right (int): Index after last overlapping downloaded data
+        """
+        lslice, rslice = self._left[left:right], self._right[left:right]
+        i = start = min([start]+lslice[:1])
+        end = max([end]+rslice[-1:])
+        for j, k in zip(lslice, rslice):
+            if j > i:
+                yield i, j-1
+            i = k + 1
+        if i <= end:
+            yield i, end
+        self._left[left:right], self._right[left:right] = [start], [end]
+
+    def _download(self, start, end):
+        # type: (int, int) -> None
+        """Download bytes from start to end inclusively."""
+        with self._stay():
+            left = bisect_left(self._right, start)
+            right = bisect_right(self._left, end)
+            for start, end in self._merge(start, end, left, right):
+                response = self._stream_response(start, end)
+                response.raise_for_status()
+                self.seek(start)
+                for chunk in response_chunks(response, self._chunk_size):
+                    self._file.write(chunk)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/session.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/session.py
new file mode 100644
index 0000000000000000000000000000000000000000..454945d9aedd45d60dc3bfadfa732c63debc7137
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/session.py
@@ -0,0 +1,428 @@
+"""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 InsecureCacheControlAdapter(CacheControlAdapter):
+
+    def cert_verify(self, conn, url, verify, cert):
+        super(InsecureCacheControlAdapter, 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,
+        )
+
+        # Our Insecure HTTPAdapter disables HTTPS validation. It does not
+        # support caching so we'll use it for all http:// URLs.
+        # If caching is disabled, we will also use it for
+        # https:// hosts that we've marked as ignoring
+        # TLS errors for (trusted-hosts).
+        insecure_adapter = InsecureHTTPAdapter(max_retries=retries)
+
+        # We want to _only_ cache responses on securely fetched origins or when
+        # the host is specified as trusted. We do this because
+        # we can't validate the response of an insecurely/untrusted 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,
+            )
+            self._trusted_host_adapter = InsecureCacheControlAdapter(
+                cache=SafeFileCache(cache),
+                max_retries=retries,
+            )
+        else:
+            secure_adapter = HTTPAdapter(max_retries=retries)
+            self._trusted_host_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 update_index_urls(self, new_index_urls):
+        # type: (List[str]) -> None
+        """
+        :param new_index_urls: New index urls to update the authentication
+            handler with.
+        """
+        self.auth.index_urls = new_index_urls
+
+    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._trusted_host_adapter
+        )
+        if not host_port[1]:
+            # Mount wildcard ports for the same host.
+            self.mount(
+                build_url_from_netloc(host) + ':',
+                self._trusted_host_adapter
+            )
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/utils.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..907b3fed49aa24757293560f33993130dd928a5d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/utils.py
@@ -0,0 +1,97 @@
+from pip._vendor.requests.models import CONTENT_CHUNK_SIZE, Response
+
+from pip._internal.exceptions import NetworkConnectionError
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Dict, Iterator
+
+# The following comments and HTTP headers were originally added by
+# Donald Stufft in git commit 22c562429a61bb77172039e480873fb239dd8c03.
+#
+# 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, adding 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'}  # type: Dict[str, str]
+
+
+def raise_for_status(resp):
+    # type: (Response) -> None
+    http_error_msg = u''
+    if isinstance(resp.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.
+        try:
+            reason = resp.reason.decode('utf-8')
+        except UnicodeDecodeError:
+            reason = resp.reason.decode('iso-8859-1')
+    else:
+        reason = resp.reason
+
+    if 400 <= resp.status_code < 500:
+        http_error_msg = u'%s Client Error: %s for url: %s' % (
+            resp.status_code, reason, resp.url)
+
+    elif 500 <= resp.status_code < 600:
+        http_error_msg = u'%s Server Error: %s for url: %s' % (
+            resp.status_code, reason, resp.url)
+
+    if http_error_msg:
+        raise NetworkConnectionError(http_error_msg, response=resp)
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/xmlrpc.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/xmlrpc.py
new file mode 100644
index 0000000000000000000000000000000000000000..504018f28fe9b356c008cac9e136b26d42334f85
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/network/xmlrpc.py
@@ -0,0 +1,53 @@
+"""xmlrpclib.Transport implementation
+"""
+
+import logging
+
+# 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
+
+from pip._internal.exceptions import NetworkConnectionError
+from pip._internal.network.utils import raise_for_status
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Dict
+
+    from pip._internal.network.session import PipSession
+
+
+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):
+        # type: (str, PipSession, bool) -> None
+        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):
+        # type: (str, str, Dict[str, str], bool) -> None
+        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)
+            raise_for_status(response)
+            self.verbose = verbose
+            return self.parse_response(response.raw)
+        except NetworkConnectionError as exc:
+            assert exc.response
+            logger.critical(
+                "HTTP error %s while getting %s",
+                exc.response.status_code, url,
+            )
+            raise
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f462bdf91f055474a7c25dc6728b993363c9943c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6f83c442ef06cb9bb53c3943bd5a42d65d0bc57e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/check.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c134f07b6f7f2d3afe7573ee434eb5b3a9863295
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/freeze.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e6ca7347b082bde917b066d57e6f472945543197
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/__pycache__/prepare.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3977e3f5bb8c49c71fb9719fca81218f5cd9444c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..36f4a3547d38231e39694be281757b76c7a2a89f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1a55af673e15ad1f054debeaf1c06a98d6301f9b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/metadata_legacy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..609dac7831cddfae537059fbea6595d588679cb1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3607c85d0ff29e37db67d7de625df4b6893c622a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/__pycache__/wheel_legacy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.py
new file mode 100644
index 0000000000000000000000000000000000000000..5709962b09edca43daaf683d65341a287cfffca2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata.py
@@ -0,0 +1,38 @@
+"""Metadata generation logic for source distributions.
+"""
+
+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._vendor.pep517.wrappers import Pep517HookCaller
+
+    from pip._internal.build_env import BuildEnvironment
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py
new file mode 100644
index 0000000000000000000000000000000000000000..14762aef3c0037ed0cd5cd8cc9331bbccfaf7c97
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/metadata_legacy.py
@@ -0,0 +1,77 @@
+"""Metadata generation logic for legacy source distributions.
+"""
+
+import logging
+import os
+
+from pip._internal.exceptions import InstallationError
+from pip._internal.utils.setuptools_build import make_setuptools_egg_info_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
+
+if MYPY_CHECK_RUNNING:
+    from pip._internal.build_env import BuildEnvironment
+
+logger = logging.getLogger(__name__)
+
+
+def _find_egg_info(directory):
+    # type: (str) -> str
+    """Find an .egg-info subdirectory in `directory`.
+    """
+    filenames = [
+        f for f in os.listdir(directory) if f.endswith(".egg-info")
+    ]
+
+    if not filenames:
+        raise InstallationError(
+            "No .egg-info directory found in {}".format(directory)
+        )
+
+    if len(filenames) > 1:
+        raise InstallationError(
+            "More than one .egg-info directory found in {}".format(
+                directory
+            )
+        )
+
+    return os.path.join(directory, filenames[0])
+
+
+def generate_metadata(
+    build_env,  # type: BuildEnvironment
+    setup_py_path,  # type: str
+    source_dir,  # type: str
+    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 = TempDirectory(
+        kind="pip-egg-info", globally_managed=True
+    ).path
+
+    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(egg_info_dir)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..d16ee0966e1f940bd0c5ede469b7d651d72d1e34
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel.py
@@ -0,0 +1,47 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel_legacy.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel_legacy.py
new file mode 100644
index 0000000000000000000000000000000000000000..9da365e4ddd79cb77100b31951556d3931241e72
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/build/wheel_legacy.py
@@ -0,0 +1,113 @@
+import logging
+import os.path
+
+from pip._internal.cli.spinners import open_spinner
+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
+
+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 {} (setup.py)'.format(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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/check.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/check.py
new file mode 100644
index 0000000000000000000000000000000000000000..5dee6bcb40011a77f7d87d17fe8b977d00bab5ca
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/check.py
@@ -0,0 +1,155 @@
+"""Validation of dependencies of packages
+"""
+
+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 typing import Any, Callable, Dict, List, Optional, Set, Tuple
+
+    from pip._internal.req.req_install import InstallRequirement
+
+    # 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]
+    ConflictDetails = Tuple[PackageSet, CheckResult]
+
+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 (OSError, RequirementParseError) as e:
+            # Don't crash on unreadable or 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.
+    """
+
+    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 and 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]) -> ConflictDetails
+    """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()
+
+        assert dist is not None
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/freeze.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/freeze.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4f790cd447569ac1ff67b7aa8e227a51410eb31
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/freeze.py
@@ -0,0 +1,277 @@
+from __future__ import absolute_import
+
+import collections
+import logging
+import os
+
+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.direct_url_helpers import (
+    direct_url_as_pep440_direct_reference,
+    dist_get_direct_url,
+)
+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 (
+        Container,
+        Dict,
+        Iterable,
+        Iterator,
+        List,
+        Optional,
+        Set,
+        Tuple,
+        Union,
+    )
+
+    from pip._vendor.pkg_resources import Distribution, Requirement
+
+    from pip._internal.cache import WheelCache
+
+    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=False,  # type: bool
+    user_only=False,  # type: bool
+    paths=None,  # type: Optional[List[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 []
+
+    for link in find_links:
+        yield '-f {}'.format(link)
+    installations = {}  # type: Dict[str, FrozenRequirement]
+
+    for dist in get_installed_distributions(
+            local_only=local_only,
+            skip=(),
+            user_only=user_only,
+            paths=paths
+    ):
+        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
+                            line.startswith((
+                                '-r', '--requirement',
+                                '-f', '--find-links',
+                                '-i', '--index-url',
+                                '--pre',
+                                '--trusted-host',
+                                '--process-dependency-links',
+                                '--extra-index-url',
+                                '--use-feature'))):
+                        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,
+                        )
+                    else:
+                        line_req = install_req_from_line(
+                            COMMENT_RE.sub('', line).strip(),
+                            isolated=isolated,
+                        )
+
+                    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 RemoteNotFoundError, vcs
+    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
+        # TODO `get_requirement_info` is taking care of editable requirements.
+        # TODO This should be refactored when we will add detection of
+        #      editable that provide .dist-info metadata.
+        req, editable, comments = get_requirement_info(dist)
+        if req is None and not editable:
+            # if PEP 610 metadata is present, attempt to use it
+            direct_url = dist_get_direct_url(dist)
+            if direct_url:
+                req = direct_url_as_pep440_direct_reference(
+                    direct_url, dist.project_name
+                )
+                comments = []
+        if req is None:
+            # name==version requirement
+            req = dist.as_requirement()
+
+        return cls(dist.project_name, req, editable, comments=comments)
+
+    def __str__(self):
+        # type: () -> str
+        req = self.req
+        if self.editable:
+            req = '-e {}'.format(req)
+        return '\n'.join(list(self.comments) + [str(req)]) + '\n'
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..24d6a5dd31fe33b03f90ed0f9ee465253686900c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__init__.py
@@ -0,0 +1,2 @@
+"""For modules related to installing packages.
+"""
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..21b73319c194bd62252e10a95896bd33eccf6367
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dc48abe1fc1f88b2668e6ce2ae28511dc70be9e7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/editable_legacy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f5eaced8ad44a4b74d0b7da6d46c1faff2f98789
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/legacy.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d1d6e12b3941542274a3402afbaa2ae685668ef9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/editable_legacy.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/editable_legacy.py
new file mode 100644
index 0000000000000000000000000000000000000000..a668a61dc60f50963186b5a358e1e581bb6bbf09
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/editable_legacy.py
@@ -0,0 +1,52 @@
+"""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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.py
new file mode 100644
index 0000000000000000000000000000000000000000..87227d5fed6aaf0df05a2f7794120ec3f6c2fd7b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/legacy.py
@@ -0,0 +1,130 @@
+"""Legacy installation process, i.e. `setup.py install`.
+"""
+
+import logging
+import os
+import sys
+from distutils.util import change_root
+
+from pip._internal.exceptions import InstallationError
+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.build_env import BuildEnvironment
+    from pip._internal.models.scheme import Scheme
+
+
+logger = logging.getLogger(__name__)
+
+
+class LegacyInstallFailure(Exception):
+    def __init__(self):
+        # type: () -> None
+        self.parent = sys.exc_info()
+
+
+def install(
+    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
+    setup_py_path,  # type: str
+    isolated,  # type: bool
+    req_name,  # type: str
+    build_env,  # type: BuildEnvironment
+    unpacked_source_directory,  # type: str
+    req_description,  # type: str
+):
+    # type: (...) -> bool
+
+    header_dir = scheme.headers
+
+    with TempDirectory(kind="record") as temp_dir:
+        try:
+            record_filename = os.path.join(temp_dir.path, 'install-record.txt')
+            install_args = make_setuptools_install_args(
+                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=isolated,
+                pycompile=pycompile,
+            )
+
+            runner = runner_with_spinner_message(
+                "Running setup.py install for {}".format(req_name)
+            )
+            with indent_log(), build_env:
+                runner(
+                    cmd=install_args,
+                    cwd=unpacked_source_directory,
+                )
+
+            if not os.path.exists(record_filename):
+                logger.debug('Record file %s not found', record_filename)
+                # Signal to the caller that we didn't install the new package
+                return False
+
+        except Exception:
+            # Signal to the caller that we didn't install the new package
+            raise LegacyInstallFailure
+
+        # At this point, we have successfully installed the requirement.
+
+        # 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:
+        message = (
+            "{} did not indicate that it installed an "
+            ".egg-info directory. Only setup.py projects "
+            "generating .egg-info directories are supported."
+        ).format(req_description)
+        raise InstallationError(message)
+
+    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')
+
+    return True
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..8b67ebb9431f2db6547064cadc63b60ee3cb3631
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/install/wheel.py
@@ -0,0 +1,846 @@
+"""Support for installing and building the "wheel" binary package format.
+"""
+
+from __future__ import absolute_import
+
+import collections
+import compileall
+import contextlib
+import csv
+import importlib
+import logging
+import os.path
+import re
+import shutil
+import sys
+import warnings
+from base64 import urlsafe_b64encode
+from itertools import chain, starmap
+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 PY2, ensure_str, ensure_text, itervalues, reraise, text_type
+from pip._vendor.six.moves import filterfalse, map
+
+from pip._internal.exceptions import InstallationError
+from pip._internal.locations import get_major_minor_version
+from pip._internal.models.direct_url import DIRECT_URL_METADATA_NAME, DirectUrl
+from pip._internal.models.scheme import SCHEME_KEYS
+from pip._internal.utils.filesystem import adjacent_tmp_file, replace
+from pip._internal.utils.misc import captured_stdout, ensure_dir, hash_file, partition
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+from pip._internal.utils.unpacking import (
+    current_umask,
+    is_within_directory,
+    set_extracted_file_to_default_mode_plus_executable,
+    zip_item_is_executable,
+)
+from pip._internal.utils.wheel import parse_wheel, pkg_resources_distribution_for_wheel
+
+# Use the custom cast function at runtime to make cast work,
+# and import typing.cast when performing pre-commit and type
+# checks
+if not MYPY_CHECK_RUNNING:
+    from pip._internal.utils.typing import cast
+else:
+    from email.message import Message
+    from typing import (
+        IO,
+        Any,
+        Callable,
+        Dict,
+        Iterable,
+        Iterator,
+        List,
+        NewType,
+        Optional,
+        Protocol,
+        Sequence,
+        Set,
+        Tuple,
+        Union,
+        cast,
+    )
+    from zipfile import ZipInfo
+
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.models.scheme import Scheme
+    from pip._internal.utils.filesystem import NamedTemporaryFileResult
+
+    RecordPath = NewType('RecordPath', text_type)
+    InstalledCSVRow = Tuple[RecordPath, str, Union[int, str]]
+
+    class File(Protocol):
+        src_record_path = None  # type: RecordPath
+        dest_path = None  # type: text_type
+        changed = None  # type: bool
+
+        def save(self):
+            # type: () -> None
+            pass
+
+
+logger = logging.getLogger(__name__)
+
+
+def rehash(path, blocksize=1 << 20):
+    # type: (text_type, 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 csv_io_kwargs(mode):
+    # type: (str) -> Dict[str, Any]
+    """Return keyword arguments to properly open a CSV file
+    in the given mode.
+    """
+    if PY2:
+        return {'mode': '{}b'.format(mode)}
+    else:
+        return {'mode': mode, 'newline': '', 'encoding': 'utf-8'}
+
+
+def fix_script(path):
+    # type: (text_type) -> bool
+    """Replace #!python with #!/path/to/python
+    Return True if file was changed.
+    """
+    # XXX RECORD hashes will need to be updated
+    assert 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
+
+
+def wheel_root_is_purelib(metadata):
+    # type: (Message) -> bool
+    return metadata.get("Root-Is-Purelib", "").lower() == "true"
+
+
+def get_entrypoints(distribution):
+    # type: (Distribution) -> Tuple[Dict[str, str], Dict[str, str]]
+    # get the entry points and then the script names
+    try:
+        console = distribution.get_entry_map('console_scripts')
+        gui = distribution.get_entry_map('gui_scripts')
+    except KeyError:
+        # Our dict-based Distribution raises KeyError if entry_points.txt
+        # doesn't exist.
+        return {}, {}
+
+    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 _normalized_outrows(outrows):
+    # type: (Iterable[InstalledCSVRow]) -> List[Tuple[str, str, str]]
+    """Normalize the given rows of a RECORD file.
+
+    Items in each row are converted into str. Rows are then sorted to make
+    the value more predictable for tests.
+
+    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(
+        (ensure_str(record_path, encoding='utf-8'), hash_, str(size))
+        for record_path, hash_, size in outrows
+    )
+
+
+def _record_to_fs_path(record_path):
+    # type: (RecordPath) -> text_type
+    return record_path
+
+
+def _fs_to_record_path(path, relative_to=None):
+    # type: (text_type, Optional[text_type]) -> RecordPath
+    if relative_to is not None:
+        # On Windows, do not handle relative paths if they belong to different
+        # logical disks
+        if os.path.splitdrive(path)[0].lower() == \
+                os.path.splitdrive(relative_to)[0].lower():
+            path = os.path.relpath(path, relative_to)
+    path = path.replace(os.path.sep, '/')
+    return cast('RecordPath', path)
+
+
+def _parse_record_path(record_column):
+    # type: (str) -> RecordPath
+    p = ensure_text(record_column, encoding='utf-8')
+    return cast('RecordPath', p)
+
+
+def get_csv_rows_for_installed(
+    old_csv_rows,  # type: List[List[str]]
+    installed,  # type: Dict[RecordPath, RecordPath]
+    changed,  # type: Set[RecordPath]
+    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: %s', row)
+        old_record_path = _parse_record_path(row[0])
+        new_record_path = installed.pop(old_record_path, old_record_path)
+        if new_record_path in changed:
+            digest, length = rehash(_record_to_fs_path(new_record_path))
+        else:
+            digest = row[1] if len(row) > 1 else ''
+            length = row[2] if len(row) > 2 else ''
+        installed_rows.append((new_record_path, digest, length))
+    for f in generated:
+        path = _fs_to_record_path(f, lib_dir)
+        digest, length = rehash(f)
+        installed_rows.append((path, digest, length))
+    for installed_record_path in itervalues(installed):
+        installed_rows.append((installed_record_path, '', ''))
+    return installed_rows
+
+
+def get_console_script_specs(console):
+    # type: (Dict[str, str]) -> List[str]
+    """
+    Given the mapping from entrypoint name to callable, return the relevant
+    console script specs.
+    """
+    # Don't mutate caller's version
+    console = console.copy()
+
+    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{} = {}'.format(sys.version_info[0], pip_script)
+            )
+
+        scripts_to_generate.append(
+            'pip{} = {}'.format(get_major_minor_version(), pip_script)
+        )
+        # Delete any other versioned pip entry points
+        pip_ep = [k for k in console if re.match(r'pip(\d(\.\d)?)?$', k)]
+        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-{} = {}'.format(
+                get_major_minor_version(), easy_install_script
+            )
+        )
+        # Delete any other versioned easy_install entry points
+        easy_install_ep = [
+            k for k in console if re.match(r'easy_install(-\d\.\d)?$', k)
+        ]
+        for k in easy_install_ep:
+            del console[k]
+
+    # Generate the console entry points specified in the wheel
+    scripts_to_generate.extend(starmap('{} = {}'.format, console.items()))
+
+    return scripts_to_generate
+
+
+class ZipBackedFile(object):
+    def __init__(self, src_record_path, dest_path, zip_file):
+        # type: (RecordPath, text_type, ZipFile) -> None
+        self.src_record_path = src_record_path
+        self.dest_path = dest_path
+        self._zip_file = zip_file
+        self.changed = False
+
+    def _getinfo(self):
+        # type: () -> ZipInfo
+        if not PY2:
+            return self._zip_file.getinfo(self.src_record_path)
+        # Python 2 does not expose a way to detect a ZIP's encoding, but the
+        # wheel specification (PEP 427) explicitly mandates that paths should
+        # use UTF-8, so we assume it is true.
+        return self._zip_file.getinfo(self.src_record_path.encode("utf-8"))
+
+    def save(self):
+        # type: () -> None
+        # directory creation is lazy and after file filtering
+        # to ensure we don't install empty dirs; empty dirs can't be
+        # uninstalled.
+        parent_dir = os.path.dirname(self.dest_path)
+        ensure_dir(parent_dir)
+
+        # When we open the output file below, any existing file is truncated
+        # before we start writing 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(self.dest_path):
+            os.unlink(self.dest_path)
+
+        zipinfo = self._getinfo()
+
+        with self._zip_file.open(zipinfo) as f:
+            with open(self.dest_path, "wb") as dest:
+                shutil.copyfileobj(f, dest)
+
+        if zip_item_is_executable(zipinfo):
+            set_extracted_file_to_default_mode_plus_executable(self.dest_path)
+
+
+class ScriptFile(object):
+    def __init__(self, file):
+        # type: (File) -> None
+        self._file = file
+        self.src_record_path = self._file.src_record_path
+        self.dest_path = self._file.dest_path
+        self.changed = False
+
+    def save(self):
+        # type: () -> None
+        self._file.save()
+        self.changed = fix_script(self.dest_path)
+
+
+class MissingCallableSuffix(InstallationError):
+    def __init__(self, entry_point):
+        # type: (str) -> None
+        super(MissingCallableSuffix, self).__init__(
+            "Invalid script entry point: {} - A callable "
+            "suffix is required. Cf https://packaging.python.org/"
+            "specifications/entry-points/#use-for-scripts for more "
+            "information.".format(entry_point)
+        )
+
+
+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_wheel(
+    name,  # type: str
+    wheel_zip,  # type: ZipFile
+    wheel_path,  # type: str
+    scheme,  # type: Scheme
+    pycompile=True,  # type: bool
+    warn_script_location=True,  # type: bool
+    direct_url=None,  # type: Optional[DirectUrl]
+    requested=False,  # type: bool
+):
+    # type: (...) -> None
+    """Install a wheel.
+
+    :param name: Name of the project to install
+    :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
+    """
+    info_dir, metadata = parse_wheel(wheel_zip, name)
+
+    if wheel_root_is_purelib(metadata):
+        lib_dir = scheme.purelib
+    else:
+        lib_dir = scheme.platlib
+
+    # 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[RecordPath, RecordPath]
+    changed = set()  # type: Set[RecordPath]
+    generated = []  # type: List[str]
+
+    def record_installed(srcfile, destfile, modified=False):
+        # type: (RecordPath, text_type, bool) -> None
+        """Map archive RECORD paths to installation RECORD paths."""
+        newpath = _fs_to_record_path(destfile, lib_dir)
+        installed[srcfile] = newpath
+        if modified:
+            changed.add(_fs_to_record_path(destfile))
+
+    def all_paths():
+        # type: () -> Iterable[RecordPath]
+        names = wheel_zip.namelist()
+        # If a flag is set, names may be unicode in Python 2. We convert to
+        # text explicitly so these are valid for lookup in RECORD.
+        decoded_names = map(ensure_text, names)
+        for name in decoded_names:
+            yield cast("RecordPath", name)
+
+    def is_dir_path(path):
+        # type: (RecordPath) -> bool
+        return path.endswith("/")
+
+    def assert_no_path_traversal(dest_dir_path, target_path):
+        # type: (text_type, text_type) -> None
+        if not is_within_directory(dest_dir_path, target_path):
+            message = (
+                "The wheel {!r} has a file {!r} trying to install"
+                " outside the target directory {!r}"
+            )
+            raise InstallationError(
+                message.format(wheel_path, target_path, dest_dir_path)
+            )
+
+    def root_scheme_file_maker(zip_file, dest):
+        # type: (ZipFile, text_type) -> Callable[[RecordPath], File]
+        def make_root_scheme_file(record_path):
+            # type: (RecordPath) -> File
+            normed_path = os.path.normpath(record_path)
+            dest_path = os.path.join(dest, normed_path)
+            assert_no_path_traversal(dest, dest_path)
+            return ZipBackedFile(record_path, dest_path, zip_file)
+
+        return make_root_scheme_file
+
+    def data_scheme_file_maker(zip_file, scheme):
+        # type: (ZipFile, Scheme) -> Callable[[RecordPath], File]
+        scheme_paths = {}
+        for key in SCHEME_KEYS:
+            encoded_key = ensure_text(key)
+            scheme_paths[encoded_key] = ensure_text(
+                getattr(scheme, key), encoding=sys.getfilesystemencoding()
+            )
+
+        def make_data_scheme_file(record_path):
+            # type: (RecordPath) -> File
+            normed_path = os.path.normpath(record_path)
+            try:
+                _, scheme_key, dest_subpath = normed_path.split(os.path.sep, 2)
+            except ValueError:
+                message = (
+                    "Unexpected file in {}: {!r}. .data directory contents"
+                    " should be named like: '<scheme key>/<path>'."
+                ).format(wheel_path, record_path)
+                raise InstallationError(message)
+
+            try:
+                scheme_path = scheme_paths[scheme_key]
+            except KeyError:
+                valid_scheme_keys = ", ".join(sorted(scheme_paths))
+                message = (
+                    "Unknown scheme key used in {}: {} (for file {!r}). .data"
+                    " directory contents should be in subdirectories named"
+                    " with a valid scheme key ({})"
+                ).format(
+                    wheel_path, scheme_key, record_path, valid_scheme_keys
+                )
+                raise InstallationError(message)
+
+            dest_path = os.path.join(scheme_path, dest_subpath)
+            assert_no_path_traversal(scheme_path, dest_path)
+            return ZipBackedFile(record_path, dest_path, zip_file)
+
+        return make_data_scheme_file
+
+    def is_data_scheme_path(path):
+        # type: (RecordPath) -> bool
+        return path.split("/", 1)[0].endswith(".data")
+
+    paths = all_paths()
+    file_paths = filterfalse(is_dir_path, paths)
+    root_scheme_paths, data_scheme_paths = partition(
+        is_data_scheme_path, file_paths
+    )
+
+    make_root_scheme_file = root_scheme_file_maker(
+        wheel_zip,
+        ensure_text(lib_dir, encoding=sys.getfilesystemencoding()),
+    )
+    files = map(make_root_scheme_file, root_scheme_paths)
+
+    def is_script_scheme_path(path):
+        # type: (RecordPath) -> bool
+        parts = path.split("/", 2)
+        return (
+            len(parts) > 2 and
+            parts[0].endswith(".data") and
+            parts[1] == "scripts"
+        )
+
+    other_scheme_paths, script_scheme_paths = partition(
+        is_script_scheme_path, data_scheme_paths
+    )
+
+    make_data_scheme_file = data_scheme_file_maker(wheel_zip, scheme)
+    other_scheme_files = map(make_data_scheme_file, other_scheme_paths)
+    files = chain(files, other_scheme_files)
+
+    # Get the defined entry points
+    distribution = pkg_resources_distribution_for_wheel(
+        wheel_zip, name, wheel_path
+    )
+    console, gui = get_entrypoints(distribution)
+
+    def is_entrypoint_wrapper(file):
+        # type: (File) -> bool
+        # EP, EP.exe and EP-script.py are scripts generated for
+        # entry point EP by setuptools
+        path = file.dest_path
+        name = os.path.basename(path)
+        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)
+
+    script_scheme_files = map(make_data_scheme_file, script_scheme_paths)
+    script_scheme_files = filterfalse(
+        is_entrypoint_wrapper, script_scheme_files
+    )
+    script_scheme_files = map(ScriptFile, script_scheme_files)
+    files = chain(files, script_scheme_files)
+
+    for file in files:
+        file.save()
+        record_installed(file.src_record_path, file.dest_path, file.changed)
+
+    def pyc_source_file_paths():
+        # type: () -> Iterator[text_type]
+        # We de-duplicate installation paths, since there can be overlap (e.g.
+        # file in .data maps to same location as file in wheel root).
+        # Sorting installation paths makes it easier to reproduce and debug
+        # issues related to permissions on existing files.
+        for installed_path in sorted(set(installed.values())):
+            full_installed_path = os.path.join(lib_dir, installed_path)
+            if not os.path.isfile(full_installed_path):
+                continue
+            if not full_installed_path.endswith('.py'):
+                continue
+            yield full_installed_path
+
+    def pyc_output_path(path):
+        # type: (text_type) -> text_type
+        """Return the path the pyc file would have been written to.
+        """
+        if PY2:
+            if sys.flags.optimize:
+                return path + 'o'
+            else:
+                return path + 'c'
+        else:
+            return importlib.util.cache_from_source(path)
+
+    # Compile all of the pyc files for the installed files
+    if pycompile:
+        with captured_stdout() as stdout:
+            with warnings.catch_warnings():
+                warnings.filterwarnings('ignore')
+                for path in pyc_source_file_paths():
+                    # Python 2's `compileall.compile_file` requires a str in
+                    # error cases, so we must convert to the native type.
+                    path_arg = ensure_str(
+                        path, encoding=sys.getfilesystemencoding()
+                    )
+                    success = compileall.compile_file(
+                        path_arg, force=True, quiet=True
+                    )
+                    if success:
+                        pyc_path = pyc_output_path(path)
+                        assert os.path.exists(pyc_path)
+                        pyc_record_path = cast(
+                            "RecordPath", pyc_path.replace(os.path.sep, "/")
+                        )
+                        record_installed(pyc_record_path, pyc_path)
+        logger.debug(stdout.getvalue())
+
+    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
+
+    # Generate the console and GUI entry points specified in the wheel
+    scripts_to_generate = get_console_script_specs(console)
+
+    gui_scripts_to_generate = list(starmap('{} = {}'.format, gui.items()))
+
+    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})
+    )
+
+    if warn_script_location:
+        msg = message_about_scripts_not_on_PATH(generated_console_scripts)
+        if msg is not None:
+            logger.warning(msg)
+
+    generated_file_mode = 0o666 & ~current_umask()
+
+    @contextlib.contextmanager
+    def _generate_file(path, **kwargs):
+        # type: (str, **Any) -> Iterator[NamedTemporaryFileResult]
+        with adjacent_tmp_file(path, **kwargs) as f:
+            yield f
+        os.chmod(f.name, generated_file_mode)
+        replace(f.name, path)
+
+    dest_info_dir = os.path.join(lib_dir, info_dir)
+
+    # Record pip as the installer
+    installer_path = os.path.join(dest_info_dir, 'INSTALLER')
+    with _generate_file(installer_path) as installer_file:
+        installer_file.write(b'pip\n')
+    generated.append(installer_path)
+
+    # Record the PEP 610 direct URL reference
+    if direct_url is not None:
+        direct_url_path = os.path.join(dest_info_dir, DIRECT_URL_METADATA_NAME)
+        with _generate_file(direct_url_path) as direct_url_file:
+            direct_url_file.write(direct_url.to_json().encode("utf-8"))
+        generated.append(direct_url_path)
+
+    # Record the REQUESTED file
+    if requested:
+        requested_path = os.path.join(dest_info_dir, 'REQUESTED')
+        with open(requested_path, "w"):
+            pass
+        generated.append(requested_path)
+
+    record_text = distribution.get_metadata('RECORD')
+    record_rows = list(csv.reader(record_text.splitlines()))
+
+    rows = get_csv_rows_for_installed(
+        record_rows,
+        installed=installed,
+        changed=changed,
+        generated=generated,
+        lib_dir=lib_dir)
+
+    # Record details of all files installed
+    record_path = os.path.join(dest_info_dir, 'RECORD')
+
+    with _generate_file(record_path, **csv_io_kwargs('w')) as record_file:
+        # The type mypy infers for record_file is different for Python 3
+        # (typing.IO[Any]) and Python 2 (typing.BinaryIO). We explicitly
+        # cast to typing.IO[str] as a workaround.
+        writer = csv.writer(cast('IO[str]', record_file))
+        writer.writerows(_normalized_outrows(rows))
+
+
+@contextlib.contextmanager
+def req_error_context(req_description):
+    # type: (str) -> Iterator[None]
+    try:
+        yield
+    except InstallationError as e:
+        message = "For req: {}. {}".format(req_description, e.args[0])
+        reraise(
+            InstallationError, InstallationError(message), sys.exc_info()[2]
+        )
+
+
+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
+    direct_url=None,  # type: Optional[DirectUrl]
+    requested=False,  # type: bool
+):
+    # type: (...) -> None
+    with ZipFile(wheel_path, allowZip64=True) as z:
+        with req_error_context(req_description):
+            _install_wheel(
+                name=name,
+                wheel_zip=z,
+                wheel_path=wheel_path,
+                scheme=scheme,
+                pycompile=pycompile,
+                warn_script_location=warn_script_location,
+                direct_url=direct_url,
+                requested=requested,
+            )
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/prepare.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/prepare.py
new file mode 100644
index 0000000000000000000000000000000000000000..13b2c0beee1223629eb579d021b0c894222eec1a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/operations/prepare.py
@@ -0,0 +1,608 @@
+"""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
+
+from pip._vendor.packaging.utils import canonicalize_name
+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,
+    NetworkConnectionError,
+    PreviousBuildDirError,
+    VcsHashUnsupported,
+)
+from pip._internal.models.wheel import Wheel
+from pip._internal.network.download import BatchDownloader, Downloader
+from pip._internal.network.lazy_wheel import (
+    HTTPRangeRequestUnsupported,
+    dist_from_wheel_url,
+)
+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.misc import 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, Dict, Iterable, List, Optional, Tuple
+
+    from mypy_extensions import TypedDict
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.index.package_finder import PackageFinder
+    from pip._internal.models.link import Link
+    from pip._internal.network.session import PipSession
+    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: (...) -> Distribution
+    """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.get_pkg_resources_distribution()
+
+
+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))
+
+
+class File(object):
+
+    def __init__(self, path, content_type):
+        # type: (str, Optional[str]) -> None
+        self.path = path
+        if content_type is None:
+            self.content_type = mimetypes.guess_type(path)[0]
+        else:
+            self.content_type = content_type
+
+
+def get_http_url(
+    link,  # type: Link
+    download,  # type: Downloader
+    download_dir=None,  # type: Optional[str]
+    hashes=None,  # type: Optional[Hashes]
+):
+    # type: (...) -> File
+    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 = None
+    else:
+        # let's download to a tmp dir
+        from_path, content_type = download(link, temp_dir.path)
+        if hashes:
+            hashes.check_against_path(from_path)
+
+    return File(from_path, content_type)
+
+
+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
+    target_abspath = os.path.abspath(target)
+    target_basename = os.path.basename(target_abspath)
+    target_dirname = os.path.dirname(target_abspath)
+
+    def ignore(d, names):
+        # type: (str, List[str]) -> List[str]
+        skipped = []  # type: List[str]
+        if d == source:
+            # 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
+            skipped += ['.tox', '.nox']
+        if os.path.abspath(d) == target_dirname:
+            # Prevent an infinite recursion if the target is in source.
+            # This can happen when TMPDIR is set to ${PWD}/...
+            # and we copy PWD to TMPDIR.
+            skipped += [target_basename]
+        return skipped
+
+    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 get_file_url(
+    link,  # type: Link
+    download_dir=None,  # type: Optional[str]
+    hashes=None  # type: Optional[Hashes]
+):
+    # type: (...) -> File
+    """Get file and optionally check its hash.
+    """
+    # If a download dir is specified, is the file already there and valid?
+    already_downloaded_path = None
+    if download_dir:
+        already_downloaded_path = _check_download_dir(
+            link, download_dir, hashes
+        )
+
+    if already_downloaded_path:
+        from_path = already_downloaded_path
+    else:
+        from_path = link.file_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)
+    return File(from_path, None)
+
+
+def unpack_url(
+    link,  # type: Link
+    location,  # type: str
+    download,  # type: Downloader
+    download_dir=None,  # type: Optional[str]
+    hashes=None,  # type: Optional[Hashes]
+):
+    # type: (...) -> Optional[File]
+    """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
+
+    # 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.file_path, location)
+        return None
+
+    # file urls
+    if link.is_file:
+        file = get_file_url(link, download_dir, hashes=hashes)
+
+    # http urls
+    else:
+        file = get_http_url(
+            link,
+            download,
+            download_dir,
+            hashes=hashes,
+        )
+
+    # unpack the archive to the build dir location. even when only downloading
+    # archives, they have to be unpacked to parse dependencies, except wheels
+    if not link.is_wheel:
+        unpack_file(file.path, location, file.content_type)
+
+    return file
+
+
+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
+        build_isolation,  # type: bool
+        req_tracker,  # type: RequirementTracker
+        session,  # type: PipSession
+        progress_bar,  # type: str
+        finder,  # type: PackageFinder
+        require_hashes,  # type: bool
+        use_user_site,  # type: bool
+        lazy_wheel,  # type: bool
+    ):
+        # type: (...) -> None
+        super(RequirementPreparer, self).__init__()
+
+        self.src_dir = src_dir
+        self.build_dir = build_dir
+        self.req_tracker = req_tracker
+        self._session = session
+        self._download = Downloader(session, progress_bar)
+        self._batch_download = BatchDownloader(session, progress_bar)
+        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
+
+        # 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
+
+        # Should wheels be downloaded lazily?
+        self.use_lazy_wheel = lazy_wheel
+
+        # Memoized downloaded files, as mapping of url: (path, mime type)
+        self._downloaded = {}  # type: Dict[str, Tuple[str, str]]
+
+        # Previous "header" printed for a link-based InstallRequirement
+        self._previous_requirement_header = ("", "")
+
+    def _log_preparing_link(self, req):
+        # type: (InstallRequirement) -> None
+        """Provide context for the requirement being prepared."""
+        if req.link.is_file and not req.original_link_is_in_wheel_cache:
+            message = "Processing %s"
+            information = str(display_path(req.link.file_path))
+        else:
+            message = "Collecting %s"
+            information = str(req.req or req)
+
+        if (message, information) != self._previous_requirement_header:
+            self._previous_requirement_header = (message, information)
+            logger.info(message, information)
+
+        if req.original_link_is_in_wheel_cache:
+            with indent_log():
+                logger.info("Using cached %s", req.link.filename)
+
+    def _ensure_link_req_src_dir(self, req, parallel_builds):
+        # type: (InstallRequirement, bool) -> None
+        """Ensure source_dir of a linked InstallRequirement."""
+        # Since source_dir is only set for editable requirements.
+        if req.link.is_wheel:
+            # We don't need to unpack wheels, so no need for a source
+            # directory.
+            return
+        assert req.source_dir is None
+        # We always delete unpacked sdists after pip runs.
+        req.ensure_has_source_dir(
+            self.build_dir,
+            autodelete=True,
+            parallel_builds=parallel_builds,
+        )
+
+        # 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)
+            )
+
+    def _get_linked_req_hashes(self, req):
+        # type: (InstallRequirement) -> Hashes
+        # By the time this is called, the requirement's link should have
+        # been checked so we can tell what kind of requirements req is
+        # and raise some more informative errors than otherwise.
+        # (For example, we can raise VcsHashUnsupported for a VCS URL
+        # rather than HashMissing.)
+        if not self.require_hashes:
+            return req.hashes(trust_internet=True)
+
+        # 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 req.link.is_vcs:
+            raise VcsHashUnsupported()
+        if req.link.is_existing_dir():
+            raise DirectoryUrlHashUnsupported()
+
+        # 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.
+        if req.original_link is None and not req.is_pinned:
+            raise HashUnpinned()
+
+        # If known-good hashes are missing for this requirement,
+        # 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.
+        return req.hashes(trust_internet=False) or MissingHashes()
+
+    def _fetch_metadata_using_lazy_wheel(self, link):
+        # type: (Link) -> Optional[Distribution]
+        """Fetch metadata using lazy wheel, if possible."""
+        if not self.use_lazy_wheel:
+            return None
+        if self.require_hashes:
+            logger.debug('Lazy wheel is not used as hash checking is required')
+            return None
+        if link.is_file or not link.is_wheel:
+            logger.debug(
+                'Lazy wheel is not used as '
+                '%r does not points to a remote wheel',
+                link,
+            )
+            return None
+
+        wheel = Wheel(link.filename)
+        name = canonicalize_name(wheel.name)
+        logger.info(
+            'Obtaining dependency information from %s %s',
+            name, wheel.version,
+        )
+        url = link.url.split('#', 1)[0]
+        try:
+            return dist_from_wheel_url(name, url, self._session)
+        except HTTPRangeRequestUnsupported:
+            logger.debug('%s does not support range requests', url)
+            return None
+
+    def prepare_linked_requirement(self, req, parallel_builds=False):
+        # type: (InstallRequirement, bool) -> Distribution
+        """Prepare a requirement to be obtained from req.link."""
+        assert req.link
+        link = req.link
+        self._log_preparing_link(req)
+        with indent_log():
+            # Check if the relevant file is already available
+            # in the download directory
+            file_path = None
+            if self.download_dir is not None and link.is_wheel:
+                hashes = self._get_linked_req_hashes(req)
+                file_path = _check_download_dir(req.link, self.download_dir, hashes)
+
+            if file_path is not None:
+                # The file is already available, so mark it as downloaded
+                self._downloaded[req.link.url] = file_path, None
+            else:
+                # The file is not available, attempt to fetch only metadata
+                wheel_dist = self._fetch_metadata_using_lazy_wheel(link)
+                if wheel_dist is not None:
+                    req.needs_more_preparation = True
+                    return wheel_dist
+
+            # None of the optimizations worked, fully prepare the requirement
+            return self._prepare_linked_requirement(req, parallel_builds)
+
+    def prepare_linked_requirements_more(self, reqs, parallel_builds=False):
+        # type: (Iterable[InstallRequirement], bool) -> None
+        """Prepare a linked requirement more, if needed."""
+        reqs = [req for req in reqs if req.needs_more_preparation]
+        links = [req.link for req in reqs]
+
+        # Let's download to a temporary directory.
+        tmpdir = TempDirectory(kind="unpack", globally_managed=True).path
+        self._downloaded.update(self._batch_download(links, tmpdir))
+        for req in reqs:
+            self._prepare_linked_requirement(req, parallel_builds)
+
+    def _prepare_linked_requirement(self, req, parallel_builds):
+        # type: (InstallRequirement, bool) -> Distribution
+        assert req.link
+        link = req.link
+
+        self._ensure_link_req_src_dir(req, parallel_builds)
+        hashes = self._get_linked_req_hashes(req)
+        if link.url not in self._downloaded:
+            try:
+                local_file = unpack_url(
+                    link, req.source_dir, self._download,
+                    self.download_dir, hashes,
+                )
+            except NetworkConnectionError as exc:
+                raise InstallationError(
+                    'Could not install requirement {} because of HTTP '
+                    'error {} for URL {}'.format(req, exc, link)
+                )
+        else:
+            file_path, content_type = self._downloaded[link.url]
+            if hashes:
+                hashes.check_against_path(file_path)
+            local_file = File(file_path, content_type)
+
+        # For use in later processing,
+        # preserve the file path on the requirement.
+        if local_file:
+            req.local_file_path = local_file.path
+
+        dist = _get_prepared_distribution(
+            req, self.req_tracker, self.finder, self.build_isolation,
+        )
+        return dist
+
+    def save_linked_requirement(self, req):
+        # type: (InstallRequirement) -> None
+        assert self.download_dir is not None
+        assert req.link is not None
+        link = req.link
+        if link.is_vcs or (link.is_existing_dir() and req.editable):
+            # Make a .zip of the source_dir we already created.
+            req.archive(self.download_dir)
+            return
+
+        if link.is_existing_dir():
+            logger.debug(
+                'Not copying link to destination directory '
+                'since it is a directory: %s', link,
+            )
+            return
+        if req.local_file_path is None:
+            # No distribution was downloaded for this requirement.
+            return
+
+        download_location = os.path.join(self.download_dir, link.filename)
+        if not os.path.exists(download_location):
+            shutil.copy(req.local_file_path, download_location)
+            download_path = display_path(download_location)
+            logger.info('Saved %s', download_path)
+
+    def prepare_editable_requirement(
+        self,
+        req,  # type: InstallRequirement
+    ):
+        # type: (...) -> Distribution
+        """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(self.download_dir is None)
+
+            dist = _get_prepared_distribution(
+                req, self.req_tracker, self.finder, self.build_isolation,
+            )
+
+            req.check_if_exists(self.use_user_site)
+
+        return dist
+
+    def prepare_installed_requirement(
+        self,
+        req,  # type: InstallRequirement
+        skip_reason  # type: str
+    ):
+        # type: (...) -> Distribution
+        """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.'
+                )
+            return InstalledDistribution(req).get_pkg_resources_distribution()
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/pyproject.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/pyproject.py
new file mode 100644
index 0000000000000000000000000000000000000000..4144a9ed60bf09e3297e3fbecfe65fef88739166
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/pyproject.py
@@ -0,0 +1,196 @@
+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, List, Optional
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..8568d3f8b6e50a3a9e2c152705468bbb8a18437f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__init__.py
@@ -0,0 +1,103 @@
+from __future__ import absolute_import
+
+import collections
+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 Iterator, List, Optional, Sequence, Tuple
+
+__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 _validate_requirements(
+    requirements,  # type: List[InstallRequirement]
+):
+    # type: (...) -> Iterator[Tuple[str, InstallRequirement]]
+    for req in requirements:
+        assert req.name, "invalid to-be-installed requirement: {}".format(req)
+        yield req.name, req
+
+
+def install_given_reqs(
+    requirements,  # type: List[InstallRequirement]
+    install_options,  # type: List[str]
+    global_options,  # type: Sequence[str]
+    root,  # type: Optional[str]
+    home,  # type: Optional[str]
+    prefix,  # type: Optional[str]
+    warn_script_location,  # type: bool
+    use_user_site,  # type: bool
+    pycompile,  # type: bool
+):
+    # type: (...) -> List[InstallationResult]
+    """
+    Install everything in the given list.
+
+    (to be called after having downloaded and unpacked the packages)
+    """
+    to_install = collections.OrderedDict(_validate_requirements(requirements))
+
+    if to_install:
+        logger.info(
+            'Installing collected packages: %s',
+            ', '.join(to_install.keys()),
+        )
+
+    installed = []
+
+    with indent_log():
+        for req_name, requirement in to_install.items():
+            if requirement.should_reinstall:
+                logger.info('Attempting uninstall: %s', req_name)
+                with indent_log():
+                    uninstalled_pathset = requirement.uninstall(
+                        auto_confirm=True
+                    )
+            else:
+                uninstalled_pathset = None
+
+            try:
+                requirement.install(
+                    install_options,
+                    global_options,
+                    root=root,
+                    home=home,
+                    prefix=prefix,
+                    warn_script_location=warn_script_location,
+                    use_user_site=use_user_site,
+                    pycompile=pycompile,
+                )
+            except Exception:
+                # if install did not succeed, rollback previous uninstall
+                if uninstalled_pathset and not requirement.install_succeeded:
+                    uninstalled_pathset.rollback()
+                raise
+            else:
+                if uninstalled_pathset and requirement.install_succeeded:
+                    uninstalled_pathset.commit()
+
+            installed.append(InstallationResult(req_name))
+
+    return installed
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cb0bc165ea32db1a7065ea04ddfc79dac7ee8ad6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7ad45b09ca9308697d1c9369085da6a312efbe8e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/constructors.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bc479be92d00d2c5202e1db9ef5569d38ca1dbce
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_file.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dd1f9bc2006f66e7f5cd6c8115a1fe57f35f2cfb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_install.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ec790e83862320fa8e8309f36981488871ef0c98
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_set.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5394513edef2d72af0e15e21605ffb448ccd5872
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_tracker.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..52fc2d3644ece1fb430ab3a6021fe6195fd2b77b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/__pycache__/req_uninstall.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/constructors.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/constructors.py
new file mode 100644
index 0000000000000000000000000000000000000000..2245cb826ff32fb2842d4e15b69045f7731d89c9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/constructors.py
@@ -0,0 +1,476 @@
+"""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.
+"""
+
+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.deprecation import deprecated
+from pip._internal.utils.filetypes import is_archive_file
+from pip._internal.utils.misc import is_installable_dir
+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.req.req_file import ParsedRequirement
+
+
+__all__ = [
+    "install_req_from_editable", "install_req_from_line",
+    "parse_editable"
+]
+
+logger = logging.getLogger(__name__)
+operators = Specifier._operators.keys()
+
+
+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, 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, set()
+
+    for version_control in vcs:
+        if url.lower().startswith('{}:'.format(version_control)):
+            url = '{}+{}'.format(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):
+        backends = ", ".join([bends.name + '+URL' for bends in vcs.backends])
+        error_message = "For --editable={}, " \
+                        "only {} are currently supported".format(
+                            editable_req, backends)
+        raise InstallationError(error_message)
+
+    package_name = Link(url).egg_fragment
+    if not package_name:
+        raise InstallationError(
+            "Could not detect requirement name for '{}', please specify one "
+            "with #egg=your_package_name".format(editable_req)
+        )
+    return package_name, url, set()
+
+
+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 = " The path 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 "
+                    "({}) appears to be a"
+                    " requirements file. If that is the"
+                    " case, use the '-r' flag to install"
+                    " the packages specified within it."
+                ).format(req)
+        except RequirementParseError:
+            logger.debug(
+                "Cannot parse '%s' as requirements file", req, exc_info=True
+            )
+    else:
+        msg += " File '{}' does not exist.".format(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: '{}'".format(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[Union[InstallRequirement, str]]
+    use_pep517=None,  # type: Optional[bool]
+    isolated=False,  # type: bool
+    options=None,  # type: Optional[Dict[str, Any]]
+    constraint=False,  # type: bool
+    user_supplied=False,  # type: bool
+):
+    # type: (...) -> InstallRequirement
+
+    parts = parse_req_from_editable(editable_req)
+
+    return InstallRequirement(
+        parts.requirement,
+        comes_from=comes_from,
+        user_supplied=user_supplied,
+        editable=True,
+        link=parts.link,
+        constraint=constraint,
+        use_pep517=use_pep517,
+        isolated=isolated,
+        install_options=options.get("install_options", []) if options else [],
+        global_options=options.get("global_options", []) if options else [],
+        hash_options=options.get("hashes", {}) if options else {},
+        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) -> Optional[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 {name!r} is not installable. Neither 'setup.py' "
+            "nor 'pyproject.toml' found.".format(**locals())
+        )
+    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 = "{wheel.name}=={wheel.version}".format(**locals())
+        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:
+            # Deprecate extras after specifiers: "name>=1.0[extras]"
+            # This currently works by accident because _strip_extras() parses
+            # any extras in the end of the string and those are saved in
+            # RequirementParts
+            for spec in req.specifier:
+                spec_str = str(spec)
+                if spec_str.endswith(']'):
+                    msg = "Extras after version '{}'.".format(spec_str)
+                    replace = "moving the extras before version specifiers"
+                    deprecated(msg, replacement=replace, gone_in="21.0")
+    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]]
+    constraint=False,  # type: bool
+    line_source=None,  # type: Optional[str]
+    user_supplied=False,  # type: bool
+):
+    # 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,
+        install_options=options.get("install_options", []) if options else [],
+        global_options=options.get("global_options", []) if options else [],
+        hash_options=options.get("hashes", {}) if options else {},
+        constraint=constraint,
+        extras=parts.extras,
+        user_supplied=user_supplied,
+    )
+
+
+def install_req_from_req_string(
+    req_string,  # type: str
+    comes_from=None,  # type: Optional[InstallRequirement]
+    isolated=False,  # type: bool
+    use_pep517=None,  # type: Optional[bool]
+    user_supplied=False,  # type: bool
+):
+    # type: (...) -> InstallRequirement
+    try:
+        req = Requirement(req_string)
+    except InvalidRequirement:
+        raise InstallationError("Invalid requirement: '{}'".format(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"
+            "{} depends on {} ".format(comes_from.name, req)
+        )
+
+    return InstallRequirement(
+        req,
+        comes_from,
+        isolated=isolated,
+        use_pep517=use_pep517,
+        user_supplied=user_supplied,
+    )
+
+
+def install_req_from_parsed_requirement(
+    parsed_req,  # type: ParsedRequirement
+    isolated=False,  # type: bool
+    use_pep517=None,  # type: Optional[bool]
+    user_supplied=False,  # type: bool
+):
+    # type: (...) -> InstallRequirement
+    if parsed_req.is_editable:
+        req = install_req_from_editable(
+            parsed_req.requirement,
+            comes_from=parsed_req.comes_from,
+            use_pep517=use_pep517,
+            constraint=parsed_req.constraint,
+            isolated=isolated,
+            user_supplied=user_supplied,
+        )
+
+    else:
+        req = install_req_from_line(
+            parsed_req.requirement,
+            comes_from=parsed_req.comes_from,
+            use_pep517=use_pep517,
+            isolated=isolated,
+            options=parsed_req.options,
+            constraint=parsed_req.constraint,
+            line_source=parsed_req.line_source,
+            user_supplied=user_supplied,
+        )
+    return req
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_file.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_file.py
new file mode 100644
index 0000000000000000000000000000000000000000..0af60fa05699baa5b4b9a1417e30b9ff25478256
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_file.py
@@ -0,0 +1,574 @@
+"""
+Requirements file parsing
+"""
+
+from __future__ import absolute_import
+
+import optparse
+import os
+import re
+import shlex
+import sys
+
+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.network.utils import raise_for_status
+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, url_to_path
+
+if MYPY_CHECK_RUNNING:
+    from optparse import Values
+    from typing import (
+        Any,
+        Callable,
+        Dict,
+        Iterator,
+        List,
+        NoReturn,
+        Optional,
+        Text,
+        Tuple,
+    )
+
+    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<var>\$\{(?P<name>[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.prefer_binary,
+    cmdoptions.require_hashes,
+    cmdoptions.pre,
+    cmdoptions.trusted_host,
+    cmdoptions.use_new_feature,
+]  # 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 ParsedRequirement(object):
+    def __init__(
+        self,
+        requirement,  # type:str
+        is_editable,  # type: bool
+        comes_from,  # type: str
+        constraint,  # type: bool
+        options=None,  # type: Optional[Dict[str, Any]]
+        line_source=None,  # type: Optional[str]
+    ):
+        # type: (...) -> None
+        self.requirement = requirement
+        self.is_editable = is_editable
+        self.comes_from = comes_from
+        self.options = options
+        self.constraint = constraint
+        self.line_source = line_source
+
+
+class ParsedLine(object):
+    def __init__(
+        self,
+        filename,  # type: str
+        lineno,  # type: int
+        args,  # type: str
+        opts,  # type: Values
+        constraint,  # type: bool
+    ):
+        # type: (...) -> None
+        self.filename = filename
+        self.lineno = lineno
+        self.opts = opts
+        self.constraint = constraint
+
+        if args:
+            self.is_requirement = True
+            self.is_editable = False
+            self.requirement = args
+        elif opts.editables:
+            self.is_requirement = True
+            self.is_editable = True
+            # We don't support multiple -e on one line
+            self.requirement = opts.editables[0]
+        else:
+            self.is_requirement = False
+
+
+def parse_requirements(
+    filename,  # type: str
+    session,  # type: PipSession
+    finder=None,  # type: Optional[PackageFinder]
+    options=None,  # type: Optional[optparse.Values]
+    constraint=False,  # type: bool
+):
+    # type: (...) -> Iterator[ParsedRequirement]
+    """Parse a requirements file and yield ParsedRequirement instances.
+
+    :param filename:    Path or url of requirements file.
+    :param session:     PipSession instance.
+    :param finder:      Instance of pip.index.PackageFinder.
+    :param options:     cli options.
+    :param constraint:  If true, parsing a constraint file rather than
+        requirements file.
+    """
+    line_parser = get_line_parser(finder)
+    parser = RequirementsFileParser(session, line_parser)
+
+    for parsed_line in parser.parse(filename, constraint):
+        parsed_req = handle_line(
+            parsed_line,
+            options=options,
+            finder=finder,
+            session=session
+        )
+        if parsed_req is not None:
+            yield parsed_req
+
+
+def preprocess(content):
+    # type: (Text) -> ReqFileLines
+    """Split, filter, and join lines, and return a line iterator
+
+    :param content: the content of the requirements file
+    """
+    lines_enum = enumerate(content.splitlines(), start=1)  # type: ReqFileLines
+    lines_enum = join_lines(lines_enum)
+    lines_enum = ignore_comments(lines_enum)
+    lines_enum = expand_env_variables(lines_enum)
+    return lines_enum
+
+
+def handle_requirement_line(
+    line,  # type: ParsedLine
+    options=None,  # type: Optional[optparse.Values]
+):
+    # type: (...) -> ParsedRequirement
+
+    # preserve for the nested code path
+    line_comes_from = '{} {} (line {})'.format(
+        '-c' if line.constraint else '-r', line.filename, line.lineno,
+    )
+
+    assert line.is_requirement
+
+    if line.is_editable:
+        # For editable requirements, we don't support per-requirement
+        # options, so just return the parsed requirement.
+        return ParsedRequirement(
+            requirement=line.requirement,
+            is_editable=line.is_editable,
+            comes_from=line_comes_from,
+            constraint=line.constraint,
+        )
+    else:
+        if options:
+            # Disable wheels if the user has specified build 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 ParsedRequirement(
+            requirement=line.requirement,
+            is_editable=line.is_editable,
+            comes_from=line_comes_from,
+            constraint=line.constraint,
+            options=req_options,
+            line_source=line_source,
+        )
+
+
+def handle_option_line(
+    opts,  # type: Values
+    filename,  # type: str
+    lineno,  # type: int
+    finder=None,  # type: Optional[PackageFinder]
+    options=None,  # type: Optional[optparse.Values]
+    session=None,  # type: Optional[PipSession]
+):
+    # type:  (...) -> None
+
+    if options:
+        # percolate options upward
+        if opts.require_hashes:
+            options.require_hashes = opts.require_hashes
+        if opts.features_enabled:
+            options.features_enabled.extend(
+                f for f in opts.features_enabled
+                if f not in options.features_enabled
+            )
+
+    # set finder options
+    if finder:
+        find_links = finder.find_links
+        index_urls = finder.index_urls
+        if opts.index_url:
+            index_urls = [opts.index_url]
+        if opts.no_index is True:
+            index_urls = []
+        if opts.extra_index_urls:
+            index_urls.extend(opts.extra_index_urls)
+        if 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 = opts.find_links[0]
+            req_dir = os.path.dirname(os.path.abspath(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)
+
+        if session:
+            # We need to update the auth urls in session
+            session.update_index_urls(index_urls)
+
+        search_scope = SearchScope(
+            find_links=find_links,
+            index_urls=index_urls,
+        )
+        finder.search_scope = search_scope
+
+        if opts.pre:
+            finder.set_allow_all_prereleases()
+
+        if opts.prefer_binary:
+            finder.set_prefer_binary()
+
+        if session:
+            for host in opts.trusted_hosts or []:
+                source = 'line {} of {}'.format(lineno, filename)
+                session.add_trusted_host(host, source=source)
+
+
+def handle_line(
+    line,  # type: ParsedLine
+    options=None,  # type: Optional[optparse.Values]
+    finder=None,  # type: Optional[PackageFinder]
+    session=None,  # type: Optional[PipSession]
+):
+    # type: (...) -> Optional[ParsedRequirement]
+    """Handle a single parsed requirements line; This can result in
+    creating/yielding requirements, or updating the finder.
+
+    :param line:        The parsed line to be processed.
+    :param options:     CLI options.
+    :param finder:      The finder - updated by non-requirement lines.
+    :param session:     The session - updated by non-requirement lines.
+
+    Returns a ParsedRequirement object if the line is a requirement line,
+    otherwise returns None.
+
+    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.
+    """
+
+    if line.is_requirement:
+        parsed_req = handle_requirement_line(line, options)
+        return parsed_req
+    else:
+        handle_option_line(
+            line.opts,
+            line.filename,
+            line.lineno,
+            finder,
+            options,
+            session,
+        )
+        return None
+
+
+class RequirementsFileParser(object):
+    def __init__(
+        self,
+        session,  # type: PipSession
+        line_parser,  # type: LineParser
+    ):
+        # type: (...) -> None
+        self._session = session
+        self._line_parser = line_parser
+
+    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.is_requirement 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)
+
+        lines_enum = preprocess(content)
+
+        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: {}\n{}'.format(line, e.msg)
+                raise RequirementsFileParseError(msg)
+
+            yield ParsedLine(
+                filename,
+                line_number,
+                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)
+                assert primary_line_number is not None
+                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:
+        assert primary_line_number is not None
+        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 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 <https://github.com/pypa/pip/pull/3514>`_.
+
+    Valid characters in variable names follow the `POSIX standard
+    <http://pubs.opengroup.org/onlinepubs/9699919799/>`_ 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):
+    # type: (str, PipSession) -> 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.
+    """
+    scheme = get_url_scheme(url)
+
+    if scheme in ['http', 'https']:
+        # FIXME: catch some errors
+        resp = session.get(url)
+        raise_for_status(resp)
+        return resp.url, resp.text
+
+    elif scheme == 'file':
+        url = url_to_path(url)
+
+    try:
+        with open(url, 'rb') as f:
+            content = auto_decode(f.read())
+    except IOError as exc:
+        raise InstallationError(
+            'Could not open requirements file: {}'.format(exc)
+        )
+    return url, content
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_install.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_install.py
new file mode 100644
index 0000000000000000000000000000000000000000..548c00db4bbe2c50b0acf2cc31e228a69a64a227
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_install.py
@@ -0,0 +1,915 @@
+# 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 uuid
+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.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 LegacyInstallFailure
+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.direct_url_helpers import direct_url_from_link
+from pip._internal.utils.hashes import Hashes
+from pip._internal.utils.logging import indent_log
+from pip._internal.utils.misc import (
+    ask_path_exists,
+    backup_dir,
+    display_path,
+    dist_in_site_packages,
+    dist_in_usersite,
+    get_distribution,
+    get_installed_version,
+    hide_url,
+    redact_auth_from_url,
+)
+from pip._internal.utils.packaging import get_metadata
+from pip._internal.utils.temp_dir import TempDirectory, tempdir_kinds
+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._vendor.packaging.markers import Marker
+    from pip._vendor.packaging.specifiers import SpecifierSet
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.build_env import BuildEnvironment
+
+
+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)
+
+    # Build a PathMetadata object, from path to metadata. :wink:
+    base_dir, dist_dir_name = os.path.split(dist_dir)
+    metadata = pkg_resources.PathMetadata(base_dir, dist_dir)
+
+    # Determine the correct Distribution object type.
+    if dist_dir.endswith(".egg-info"):
+        dist_cls = pkg_resources.Distribution
+        dist_name = os.path.splitext(dist_dir_name)[0]
+    else:
+        assert dist_dir.endswith(".dist-info")
+        dist_cls = pkg_resources.DistInfoDistribution
+        dist_name = os.path.splitext(dist_dir_name)[0].split("-")[0]
+
+    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]]
+        editable=False,  # type: bool
+        link=None,  # type: Optional[Link]
+        markers=None,  # type: Optional[Marker]
+        use_pep517=None,  # type: Optional[bool]
+        isolated=False,  # type: bool
+        install_options=None,  # type: Optional[List[str]]
+        global_options=None,  # type: Optional[List[str]]
+        hash_options=None,  # type: Optional[Dict[str, List[str]]]
+        constraint=False,  # type: bool
+        extras=(),  # type: Iterable[str]
+        user_supplied=False,  # type: bool
+    ):
+        # type: (...) -> None
+        assert req is None or isinstance(req, Requirement), req
+        self.req = req
+        self.comes_from = comes_from
+        self.constraint = constraint
+        self.editable = editable
+        self.legacy_install_reason = None  # type: Optional[int]
+
+        # source_dir is the local directory where the linked requirement is
+        # located, or unpacked. In case unpacking is needed, creating and
+        # populating source_dir is done by the RequirementPreparer. Note this
+        # is not necessarily the directory where pyproject.toml or setup.py is
+        # located - that one is obtained via unpacked_source_directory.
+        self.source_dir = None  # type: Optional[str]
+        if self.editable:
+            assert link
+            if link.is_file:
+                self.source_dir = os.path.normpath(
+                    os.path.abspath(link.file_path)
+                )
+
+        if link is None and req and req.url:
+            # PEP 508 URL requirement
+            link = Link(req.url)
+        self.link = self.original_link = link
+        self.original_link_is_in_wheel_cache = False
+
+        # 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]
+        # Supplied options
+        self.install_options = install_options if install_options else []
+        self.global_options = global_options if global_options else []
+        self.hash_options = hash_options if hash_options else {}
+        # Set to True after successful preparation of this requirement
+        self.prepared = False
+        # User supplied requirement are explicitly requested for installation
+        # by the user via CLI arguments or requirements files, as opposed to,
+        # e.g. dependencies, extras or constraints.
+        self.user_supplied = user_supplied
+
+        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
+
+        # This requirement needs more preparation before it can be built
+        self.needs_more_preparation = False
+
+    def __str__(self):
+        # type: () -> str
+        if self.req:
+            s = str(self.req)
+            if self.link:
+                s += ' from {}'.format(redact_auth_from_url(self.link.url))
+        elif self.link:
+            s = redact_auth_from_url(self.link.url)
+        else:
+            s = '<InstallRequirement>'
+        if self.satisfied_by is not None:
+            s += ' in {}'.format(display_path(self.satisfied_by.location))
+        if self.comes_from:
+            if isinstance(self.comes_from, six.string_types):
+                comes_from = self.comes_from  # type: Optional[str]
+            else:
+                comes_from = self.comes_from.from_path()
+            if comes_from:
+                s += ' (from {})'.format(comes_from)
+        return s
+
+    def __repr__(self):
+        # type: () -> str
+        return '<{} object: {} editable={!r}>'.format(
+            self.__class__.__name__, str(self), self.editable)
+
+    def format_debug(self):
+        # type: () -> str
+        """An un-tested helper for getting state, for debugging.
+        """
+        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),
+        )
+
+    # 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.hash_options)
+
+    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.hash_options.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, autodelete, parallel_builds):
+        # type: (str, bool, bool) -> 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=tempdir_kinds.REQ_BUILD, globally_managed=True
+            )
+
+            return self._temp_build_dir.path
+
+        # This is the only remaining place where we manually determine the path
+        # for the temporary directory. It is only needed for editables where
+        # it is the value of the --src option.
+
+        # When parallel builds are enabled, add a UUID to the build directory
+        # name so multiple builds do not interfere with each other.
+        dir_name = canonicalize_name(self.name)
+        if parallel_builds:
+            dir_name = "{}_{}".format(dir_name, uuid.uuid4().hex)
+
+        # 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)
+        actual_build_dir = os.path.join(build_dir, dir_name)
+        # `None` indicates that we respect the globally-configured deletion
+        # settings, which is what we actually want when auto-deleting.
+        delete_arg = None if autodelete else False
+        return TempDirectory(
+            path=actual_build_dir,
+            delete=delete_arg,
+            kind=tempdir_kinds.REQ_BUILD,
+            globally_managed=True,
+        ).path
+
+    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 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
+        existing_dist = get_distribution(self.req.name)
+        if not existing_dist:
+            return
+
+        # pkg_resouces may contain a different copy of packaging.version from
+        # pip in if the downstream distributor does a poor job debundling pip.
+        # We avoid existing_dist.parsed_version and let SpecifierSet.contains
+        # parses the version instead.
+        existing_version = existing_dist.version
+        version_compatible = (
+            existing_version is not None and
+            self.req.specifier.contains(existing_version, prereleases=True)
+        )
+        if not version_compatible:
+            self.satisfied_by = None
+            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 {} in {}".format(
+                            existing_dist.project_name, existing_dist.location)
+                    )
+            else:
+                self.should_reinstall = True
+        else:
+            if self.editable:
+                self.should_reinstall = True
+                # when installing editables, nothing pre-existing should ever
+                # satisfy
+                self.satisfied_by = None
+            else:
+                self.satisfied_by = existing_dist
+
+    # 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 {}".format(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 {}".format(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,
+                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,
+        autodelete=False,
+        parallel_builds=False,
+    ):
+        # type: (str, bool, bool) -> 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,
+                autodelete=autodelete,
+                parallel_builds=parallel_builds,
+            )
+
+    # 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: {self.link.url!r}".format(**locals())
+        vc_type, url = self.link.url.split('+', 1)
+        vcs_backend = vcs.get_backend(vc_type)
+        if vcs_backend:
+            if not self.link.is_vcs:
+                reason = (
+                    "This form of VCS requirement is being deprecated: {}."
+                ).format(
+                    self.link.url
+                )
+                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 {}): {}'.format(
+                    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
+        dist = get_distribution(self.req.name)
+        if not dist:
+            logger.warning("Skipping %s as it is not installed.", self.name)
+            return None
+        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 {name!r} doesn't start with prefix {prefix!r}"
+                .format(**locals())
+            )
+            name = name[len(prefix) + 1:]
+            name = name.replace(os.path.sep, '/')
+            return name
+
+        path = os.path.join(parentdir, path)
+        name = _clean_zip_name(path, rootdir)
+        return self.name + '/' + name
+
+    def archive(self, build_dir):
+        # type: (Optional[str]) -> None
+        """Saves archive to provided build_dir.
+
+        Used for saving downloaded VCS requirements as part of `pip download`.
+        """
+        assert self.source_dir
+        if build_dir is None:
+            return
+
+        create_archive = True
+        archive_name = '{}-{}.zip'.format(self.name, self.metadata["version"])
+        archive_path = os.path.join(build_dir, archive_name)
+
+        if os.path.exists(archive_path):
+            response = ask_path_exists(
+                'The file {} exists. (i)gnore, (w)ipe, '
+                '(b)ackup, (a)bort '.format(
+                    display_path(archive_path)),
+                ('i', 'w', 'b', 'a'))
+            if response == 'i':
+                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):
+                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:
+                    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
+            direct_url = None
+            if self.original_link:
+                direct_url = direct_url_from_link(
+                    self.original_link,
+                    self.source_dir,
+                    self.original_link_is_in_wheel_cache,
+                )
+            install_wheel(
+                self.name,
+                self.local_file_path,
+                scheme=scheme,
+                req_description=str(self.req),
+                pycompile=pycompile,
+                warn_script_location=warn_script_location,
+                direct_url=direct_url,
+                requested=self.user_supplied,
+            )
+            self.install_succeeded = True
+            return
+
+        # TODO: Why don't we do this for editable installs?
+
+        # 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) + self.global_options
+        install_options = list(install_options) + self.install_options
+
+        try:
+            success = install_legacy(
+                install_options=install_options,
+                global_options=global_options,
+                root=root,
+                home=home,
+                prefix=prefix,
+                use_user_site=use_user_site,
+                pycompile=pycompile,
+                scheme=scheme,
+                setup_py_path=self.setup_py_path,
+                isolated=self.isolated,
+                req_name=self.name,
+                build_env=self.build_env,
+                unpacked_source_directory=self.unpacked_source_directory,
+                req_description=str(self.req),
+            )
+        except LegacyInstallFailure as exc:
+            self.install_succeeded = False
+            six.reraise(*exc.parent)
+        except Exception:
+            self.install_succeeded = True
+            raise
+
+        self.install_succeeded = success
+
+        if success and self.legacy_install_reason == 8368:
+            deprecated(
+                reason=(
+                    "{} was installed using the legacy 'setup.py install' "
+                    "method, because a wheel could not be built for it.".
+                    format(self.name)
+                ),
+                replacement="to fix the wheel build issue reported above",
+                gone_in="21.0",
+                issue=8368,
+            )
+
+
+def check_invalid_constraint_type(req):
+    # type: (InstallRequirement) -> str
+
+    # Check for unsupported forms
+    problem = ""
+    if not req.name:
+        problem = "Unnamed requirements are not allowed as constraints"
+    elif req.link:
+        problem = "Links are not allowed as constraints"
+    elif req.extras:
+        problem = "Constraints cannot have extras"
+
+    if problem:
+        deprecated(
+            reason=(
+                "Constraints are only allowed to take the form of a package "
+                "name and a version specifier. Other forms were originally "
+                "permitted as an accident of the implementation, but were "
+                "undocumented. The new implementation of the resolver no "
+                "longer supports these forms."
+            ),
+            replacement=(
+                "replacing the constraint with a requirement."
+            ),
+            # No plan yet for when the new resolver becomes default
+            gone_in=None,
+            issue=8210
+        )
+
+    return problem
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_set.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_set.py
new file mode 100644
index 0000000000000000000000000000000000000000..c9ea3be5dddc23b1c5f5f841461a95627d88a503
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_set.py
@@ -0,0 +1,204 @@
+from __future__ import absolute_import
+
+import logging
+from collections import OrderedDict
+
+from pip._vendor.packaging.utils import canonicalize_name
+
+from pip._internal.exceptions import InstallationError
+from pip._internal.models.wheel import Wheel
+from pip._internal.utils import compatibility_tags
+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]
+
+    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 = compatibility_tags.get_supported()
+            if (self.check_supported_wheels and not wheel.supported(tags)):
+                raise InstallationError(
+                    "{} is not a supported wheel on this platform.".format(
+                        wheel.filename)
+                )
+
+        # This next bit is really a sanity check.
+        assert not install_req.user_supplied or parent_req_name is None, (
+            "a user supplied req shouldn't 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)  # type: Optional[InstallRequirement]
+        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: {} (already in {}, name={!r})"
+                .format(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:
+            raise InstallationError(
+                "Could not satisfy constraints for '{}': "
+                "installation from path or url cannot be "
+                "constrained to a version".format(install_req.name)
+            )
+        # If we're now installing a constraint, mark the existing
+        # object for real installation.
+        existing_req.constraint = False
+        # If we're now installing a user supplied requirement,
+        # mark the existing object as such.
+        if install_req.user_supplied:
+            existing_req.user_supplied = True
+        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 {name!r}".format(**locals()))
+
+    @property
+    def all_requirements(self):
+        # type: () -> List[InstallRequirement]
+        return self.unnamed_requirements + list(self.requirements.values())
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_tracker.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_tracker.py
new file mode 100644
index 0000000000000000000000000000000000000000..7379c307b315a24045af7573acae74401fdeede6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_tracker.py
@@ -0,0 +1,151 @@
+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.models.link import Link
+    from pip._internal.req.req_install import InstallRequirement
+
+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.
+        """
+
+        assert req.link
+        # 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 = '{} is already being built: {}'.format(
+                req.link, contents)
+            raise LookupError(message)
+
+        # If we're here, req should really not be building already.
+        assert req not in self._entries
+
+        # Start tracking this requirement.
+        with open(entry_path, 'w') as fp:
+            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.
+        """
+
+        assert req.link
+        # 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py
new file mode 100644
index 0000000000000000000000000000000000000000..2e7dfcc73693be1154f12fc1ff90f4741c51479d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/req/req_uninstall.py
@@ -0,0 +1,657 @@
+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 {} does not match installed location of {} '
+                '(at {})'.format(
+                    link_pointer, dist.project_name, dist.location)
+            )
+            paths_to_remove.add(develop_egg_link)
+            easy_install_pth = os.path.join(os.path.dirname(develop_egg_link),
+                                            'easy-install.pth')
+            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
+        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)
+
+        # If the file doesn't exist, log a warning and return
+        if not os.path.isfile(self.file):
+            logger.warning(
+                "Cannot remove entries from nonexistent file %s", self.file
+            )
+            return
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2c5e86f960bb80e2345fe99247a758a34eb8de36
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7017e3c9b347e61fa85663210d3e18e6b55f3aac
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/base.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..6d50555e5312d04931f831b77fb4dad4db5bf9f5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/base.py
@@ -0,0 +1,21 @@
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Callable, List
+
+    from pip._internal.req.req_install import InstallRequirement
+    from pip._internal.req.req_set import RequirementSet
+
+    InstallRequirementProvider = Callable[
+        [str, InstallRequirement], InstallRequirement
+    ]
+
+
+class BaseResolver(object):
+    def resolve(self, root_reqs, check_supported_wheels):
+        # type: (List[InstallRequirement], bool) -> RequirementSet
+        raise NotImplementedError()
+
+    def get_installation_order(self, req_set):
+        # type: (RequirementSet) -> List[InstallRequirement]
+        raise NotImplementedError()
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a667f099022af8e9da6b11469cf58bb066801d93
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c8be11f6cfab2fb5902f9fecf48bda767cda5c8d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/__pycache__/resolver.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/resolver.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/resolver.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0fc1a7b3161d96d377bbf581d708be4148d94a7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/legacy/resolver.py
@@ -0,0 +1,473 @@
+"""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.req.req_install import check_invalid_constraint_type
+from pip._internal.req.req_set import RequirementSet
+from pip._internal.resolution.base import BaseResolver
+from pip._internal.utils.compatibility_tags import get_supported
+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 DefaultDict, List, Optional, Set, Tuple
+
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.cache import WheelCache
+    from pip._internal.index.package_finder import PackageFinder
+    from pip._internal.models.link import Link
+    from pip._internal.operations.prepare import RequirementPreparer
+    from pip._internal.req.req_install import InstallRequirement
+    from pip._internal.resolution.base import InstallRequirementProvider
+
+    DiscoveredDependencies = DefaultDict[str, List[InstallRequirement]]
+
+logger = logging.getLogger(__name__)
+
+
+def _check_dist_requires_python(
+    dist,  # type: 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(BaseResolver):
+    """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
+        wheel_cache,  # type: Optional[WheelCache]
+        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.wheel_cache = wheel_cache
+
+        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, root_reqs, check_supported_wheels):
+        # type: (List[InstallRequirement], bool) -> RequirementSet
+        """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.
+        """
+        requirement_set = RequirementSet(
+            check_supported_wheels=check_supported_wheels
+        )
+        for req in root_reqs:
+            if req.constraint:
+                check_invalid_constraint_type(req)
+            requirement_set.add_requirement(req)
+
+        # Actually prepare the files, and collect any exceptions. Most hash
+        # exceptions cannot be checked ahead of time, because
+        # _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(requirement_set.all_requirements, 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
+
+        return requirement_set
+
+    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.user_supplied or req.constraint
+
+    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 _find_requirement_link(self, req):
+        # type: (InstallRequirement) -> Optional[Link]
+        upgrade = self._is_upgrade_allowed(req)
+        best_candidate = self.finder.find_requirement(req, upgrade)
+        if not best_candidate:
+            return None
+
+        # Log a warning per PEP 592 if necessary before returning.
+        link = best_candidate.link
+        if link.is_yanked:
+            reason = link.yanked_reason or '<none given>'
+            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 link
+
+    def _populate_link(self, req):
+        # type: (InstallRequirement) -> None
+        """Ensure that if a link can be found for this, that it is found.
+
+        Note that req.link may still be None - if the requirement is already
+        installed and not needed to be upgraded based on the return value of
+        _is_upgrade_allowed().
+
+        If preparer.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 req.link is None:
+            req.link = self._find_requirement_link(req)
+
+        if self.wheel_cache is None or self.preparer.require_hashes:
+            return
+        cache_entry = self.wheel_cache.get_cache_entry(
+            link=req.link,
+            package_name=req.name,
+            supported_tags=get_supported(),
+        )
+        if cache_entry is not None:
+            logger.debug('Using cached wheel link: %s', cache_entry.link)
+            if req.link is req.original_link and cache_entry.persistent:
+                req.original_link_is_in_wheel_cache = True
+            req.link = cache_entry.link
+
+    def _get_dist_for(self, req):
+        # type: (InstallRequirement) -> Distribution
+        """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
+            )
+
+        # We eagerly populate the link, since that's our "legacy" behavior.
+        self._populate_link(req)
+        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 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
+
+        # Parse and return dependencies
+        dist = self._get_dist_for(req_to_install)
+        # 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.user_supplied
+                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)
+
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4cdaef477ef3b8fbd9cba9a5b2568dc806595513
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a9b43a8b7856daea64490d77c9495906fa46f1f9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/base.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..266fa23f56f5e720b9ffa46c085e38d5ae23ed0c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/candidates.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c7b4aace9106c3714edcd8703e25fb389048113c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/factory.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..344ea84920840a72b6dd72348470378018fb7079
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/found_candidates.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..352e626e5b2c9e0fe51fb6e30671d0aaeea64660
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/provider.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b03d84c6bda49090a73ea23ba20f458c69436939
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/reporter.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4b04dc9520fbf243b3ce8678d57b7180df0a6afb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/requirements.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..27adcfae6e992618dde37a87fe37235bb149aabe
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/__pycache__/resolver.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py
new file mode 100644
index 0000000000000000000000000000000000000000..7eb8a178eb93e819a142e1310c8b6f8a557ac3c5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/base.py
@@ -0,0 +1,156 @@
+from pip._vendor.packaging.specifiers import SpecifierSet
+from pip._vendor.packaging.utils import canonicalize_name
+
+from pip._internal.req.req_install import InstallRequirement
+from pip._internal.utils.hashes import Hashes
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import FrozenSet, Iterable, Optional, Tuple
+
+    from pip._vendor.packaging.version import _BaseVersion
+
+    from pip._internal.models.link import Link
+
+    CandidateLookup = Tuple[
+        Optional["Candidate"],
+        Optional[InstallRequirement],
+    ]
+
+
+def format_name(project, extras):
+    # type: (str, FrozenSet[str]) -> str
+    if not extras:
+        return project
+    canonical_extras = sorted(canonicalize_name(e) for e in extras)
+    return "{}[{}]".format(project, ",".join(canonical_extras))
+
+
+class Constraint(object):
+    def __init__(self, specifier, hashes):
+        # type: (SpecifierSet, Hashes) -> None
+        self.specifier = specifier
+        self.hashes = hashes
+
+    @classmethod
+    def empty(cls):
+        # type: () -> Constraint
+        return Constraint(SpecifierSet(), Hashes())
+
+    @classmethod
+    def from_ireq(cls, ireq):
+        # type: (InstallRequirement) -> Constraint
+        return Constraint(ireq.specifier, ireq.hashes(trust_internet=False))
+
+    def __nonzero__(self):
+        # type: () -> bool
+        return bool(self.specifier) or bool(self.hashes)
+
+    def __bool__(self):
+        # type: () -> bool
+        return self.__nonzero__()
+
+    def __and__(self, other):
+        # type: (InstallRequirement) -> Constraint
+        if not isinstance(other, InstallRequirement):
+            return NotImplemented
+        specifier = self.specifier & other.specifier
+        hashes = self.hashes & other.hashes(trust_internet=False)
+        return Constraint(specifier, hashes)
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        # We can safely always allow prereleases here since PackageFinder
+        # already implements the prerelease logic, and would have filtered out
+        # prerelease candidates if the user does not expect them.
+        return self.specifier.contains(candidate.version, prereleases=True)
+
+
+class Requirement(object):
+    @property
+    def project_name(self):
+        # type: () -> str
+        """The "project name" of a requirement.
+
+        This is different from ``name`` if this requirement contains extras,
+        in which case ``name`` would contain the ``[...]`` part, while this
+        refers to the name of the project.
+        """
+        raise NotImplementedError("Subclass should override")
+
+    @property
+    def name(self):
+        # type: () -> str
+        """The name identifying this requirement in the resolver.
+
+        This is different from ``project_name`` if this requirement contains
+        extras, where ``project_name`` would not contain the ``[...]`` part.
+        """
+        raise NotImplementedError("Subclass should override")
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        return False
+
+    def get_candidate_lookup(self):
+        # type: () -> CandidateLookup
+        raise NotImplementedError("Subclass should override")
+
+    def format_for_error(self):
+        # type: () -> str
+        raise NotImplementedError("Subclass should override")
+
+
+class Candidate(object):
+    @property
+    def project_name(self):
+        # type: () -> str
+        """The "project name" of the candidate.
+
+        This is different from ``name`` if this candidate contains extras,
+        in which case ``name`` would contain the ``[...]`` part, while this
+        refers to the name of the project.
+        """
+        raise NotImplementedError("Override in subclass")
+
+    @property
+    def name(self):
+        # type: () -> str
+        """The name identifying this candidate in the resolver.
+
+        This is different from ``project_name`` if this candidate contains
+        extras, where ``project_name`` would not contain the ``[...]`` part.
+        """
+        raise NotImplementedError("Override in subclass")
+
+    @property
+    def version(self):
+        # type: () -> _BaseVersion
+        raise NotImplementedError("Override in subclass")
+
+    @property
+    def is_installed(self):
+        # type: () -> bool
+        raise NotImplementedError("Override in subclass")
+
+    @property
+    def is_editable(self):
+        # type: () -> bool
+        raise NotImplementedError("Override in subclass")
+
+    @property
+    def source_link(self):
+        # type: () -> Optional[Link]
+        raise NotImplementedError("Override in subclass")
+
+    def iter_dependencies(self, with_requires):
+        # type: (bool) -> Iterable[Optional[Requirement]]
+        raise NotImplementedError("Override in subclass")
+
+    def get_install_requirement(self):
+        # type: () -> Optional[InstallRequirement]
+        raise NotImplementedError("Override in subclass")
+
+    def format_for_error(self):
+        # type: () -> str
+        raise NotImplementedError("Subclass should override")
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py
new file mode 100644
index 0000000000000000000000000000000000000000..5211a17113fb075314ddcfd875630346eebd6f0f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/candidates.py
@@ -0,0 +1,604 @@
+import logging
+import sys
+
+from pip._vendor.packaging.specifiers import InvalidSpecifier, SpecifierSet
+from pip._vendor.packaging.utils import canonicalize_name
+from pip._vendor.packaging.version import Version, parse as parse_version
+
+from pip._internal.exceptions import HashError, MetadataInconsistent
+from pip._internal.models.wheel import Wheel
+from pip._internal.req.constructors import (
+    install_req_from_editable,
+    install_req_from_line,
+)
+from pip._internal.req.req_install import InstallRequirement
+from pip._internal.utils.misc import dist_is_editable, normalize_version_info
+from pip._internal.utils.packaging import get_requires_python
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+from .base import Candidate, format_name
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, FrozenSet, Iterable, Optional, Tuple, Union
+
+    from pip._vendor.packaging.version import _BaseVersion
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.models.link import Link
+
+    from .base import Requirement
+    from .factory import Factory
+
+    BaseCandidate = Union[
+        "AlreadyInstalledCandidate",
+        "EditableCandidate",
+        "LinkCandidate",
+    ]
+
+
+logger = logging.getLogger(__name__)
+
+
+def make_install_req_from_link(link, template):
+    # type: (Link, InstallRequirement) -> InstallRequirement
+    assert not template.editable, "template is editable"
+    if template.req:
+        line = str(template.req)
+    else:
+        line = link.url
+    ireq = install_req_from_line(
+        line,
+        user_supplied=template.user_supplied,
+        comes_from=template.comes_from,
+        use_pep517=template.use_pep517,
+        isolated=template.isolated,
+        constraint=template.constraint,
+        options=dict(
+            install_options=template.install_options,
+            global_options=template.global_options,
+            hashes=template.hash_options
+        ),
+    )
+    ireq.original_link = template.original_link
+    ireq.link = link
+    return ireq
+
+
+def make_install_req_from_editable(link, template):
+    # type: (Link, InstallRequirement) -> InstallRequirement
+    assert template.editable, "template not editable"
+    return install_req_from_editable(
+        link.url,
+        user_supplied=template.user_supplied,
+        comes_from=template.comes_from,
+        use_pep517=template.use_pep517,
+        isolated=template.isolated,
+        constraint=template.constraint,
+        options=dict(
+            install_options=template.install_options,
+            global_options=template.global_options,
+            hashes=template.hash_options
+        ),
+    )
+
+
+def make_install_req_from_dist(dist, template):
+    # type: (Distribution, InstallRequirement) -> InstallRequirement
+    project_name = canonicalize_name(dist.project_name)
+    if template.req:
+        line = str(template.req)
+    elif template.link:
+        line = "{} @ {}".format(project_name, template.link.url)
+    else:
+        line = "{}=={}".format(project_name, dist.parsed_version)
+    ireq = install_req_from_line(
+        line,
+        user_supplied=template.user_supplied,
+        comes_from=template.comes_from,
+        use_pep517=template.use_pep517,
+        isolated=template.isolated,
+        constraint=template.constraint,
+        options=dict(
+            install_options=template.install_options,
+            global_options=template.global_options,
+            hashes=template.hash_options
+        ),
+    )
+    ireq.satisfied_by = dist
+    return ireq
+
+
+class _InstallRequirementBackedCandidate(Candidate):
+    """A candidate backed by an ``InstallRequirement``.
+
+    This represents a package request with the target not being already
+    in the environment, and needs to be fetched and installed. The backing
+    ``InstallRequirement`` is responsible for most of the leg work; this
+    class exposes appropriate information to the resolver.
+
+    :param link: The link passed to the ``InstallRequirement``. The backing
+        ``InstallRequirement`` will use this link to fetch the distribution.
+    :param source_link: The link this candidate "originates" from. This is
+        different from ``link`` when the link is found in the wheel cache.
+        ``link`` would point to the wheel cache, while this points to the
+        found remote link (e.g. from pypi.org).
+    """
+    is_installed = False
+
+    def __init__(
+        self,
+        link,          # type: Link
+        source_link,   # type: Link
+        ireq,          # type: InstallRequirement
+        factory,       # type: Factory
+        name=None,     # type: Optional[str]
+        version=None,  # type: Optional[_BaseVersion]
+    ):
+        # type: (...) -> None
+        self._link = link
+        self._source_link = source_link
+        self._factory = factory
+        self._ireq = ireq
+        self._name = name
+        self._version = version
+        self.dist = self._prepare()
+
+    def __str__(self):
+        # type: () -> str
+        return "{} {}".format(self.name, self.version)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({link!r})".format(
+            class_name=self.__class__.__name__,
+            link=str(self._link),
+        )
+
+    def __hash__(self):
+        # type: () -> int
+        return hash((self.__class__, self._link))
+
+    def __eq__(self, other):
+        # type: (Any) -> bool
+        if isinstance(other, self.__class__):
+            return self._link == other._link
+        return False
+
+    # Needed for Python 2, which does not implement this by default
+    def __ne__(self, other):
+        # type: (Any) -> bool
+        return not self.__eq__(other)
+
+    @property
+    def source_link(self):
+        # type: () -> Optional[Link]
+        return self._source_link
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        """The normalised name of the project the candidate refers to"""
+        if self._name is None:
+            self._name = canonicalize_name(self.dist.project_name)
+        return self._name
+
+    @property
+    def name(self):
+        # type: () -> str
+        return self.project_name
+
+    @property
+    def version(self):
+        # type: () -> _BaseVersion
+        if self._version is None:
+            self._version = parse_version(self.dist.version)
+        return self._version
+
+    def format_for_error(self):
+        # type: () -> str
+        return "{} {} (from {})".format(
+            self.name,
+            self.version,
+            self._link.file_path if self._link.is_file else self._link
+        )
+
+    def _prepare_distribution(self):
+        # type: () -> Distribution
+        raise NotImplementedError("Override in subclass")
+
+    def _check_metadata_consistency(self, dist):
+        # type: (Distribution) -> None
+        """Check for consistency of project name and version of dist."""
+        name = canonicalize_name(dist.project_name)
+        if self._name is not None and self._name != name:
+            raise MetadataInconsistent(self._ireq, "name", dist.project_name)
+        version = parse_version(dist.version)
+        if self._version is not None and self._version != version:
+            raise MetadataInconsistent(self._ireq, "version", dist.version)
+
+    def _prepare(self):
+        # type: () -> Distribution
+        try:
+            dist = self._prepare_distribution()
+        except HashError as e:
+            # Provide HashError the underlying ireq that caused it. This
+            # provides context for the resulting error message to show the
+            # offending line to the user.
+            e.req = self._ireq
+            raise
+        self._check_metadata_consistency(dist)
+        return dist
+
+    def _get_requires_python_dependency(self):
+        # type: () -> Optional[Requirement]
+        requires_python = get_requires_python(self.dist)
+        if requires_python is None:
+            return None
+        try:
+            spec = SpecifierSet(requires_python)
+        except InvalidSpecifier as e:
+            message = "Package %r has an invalid Requires-Python: %s"
+            logger.warning(message, self.name, e)
+            return None
+        return self._factory.make_requires_python_requirement(spec)
+
+    def iter_dependencies(self, with_requires):
+        # type: (bool) -> Iterable[Optional[Requirement]]
+        requires = self.dist.requires() if with_requires else ()
+        for r in requires:
+            yield self._factory.make_requirement_from_spec(str(r), self._ireq)
+        yield self._get_requires_python_dependency()
+
+    def get_install_requirement(self):
+        # type: () -> Optional[InstallRequirement]
+        return self._ireq
+
+
+class LinkCandidate(_InstallRequirementBackedCandidate):
+    is_editable = False
+
+    def __init__(
+        self,
+        link,          # type: Link
+        template,        # type: InstallRequirement
+        factory,       # type: Factory
+        name=None,     # type: Optional[str]
+        version=None,  # type: Optional[_BaseVersion]
+    ):
+        # type: (...) -> None
+        source_link = link
+        cache_entry = factory.get_wheel_cache_entry(link, name)
+        if cache_entry is not None:
+            logger.debug("Using cached wheel link: %s", cache_entry.link)
+            link = cache_entry.link
+        ireq = make_install_req_from_link(link, template)
+        assert ireq.link == link
+        if ireq.link.is_wheel and not ireq.link.is_file:
+            wheel = Wheel(ireq.link.filename)
+            wheel_name = canonicalize_name(wheel.name)
+            assert name == wheel_name, (
+                "{!r} != {!r} for wheel".format(name, wheel_name)
+            )
+            # Version may not be present for PEP 508 direct URLs
+            if version is not None:
+                wheel_version = Version(wheel.version)
+                assert version == wheel_version, (
+                    "{!r} != {!r} for wheel {}".format(
+                        version, wheel_version, name
+                    )
+                )
+
+        if (cache_entry is not None and
+                cache_entry.persistent and
+                template.link is template.original_link):
+            ireq.original_link_is_in_wheel_cache = True
+
+        super(LinkCandidate, self).__init__(
+            link=link,
+            source_link=source_link,
+            ireq=ireq,
+            factory=factory,
+            name=name,
+            version=version,
+        )
+
+    def _prepare_distribution(self):
+        # type: () -> Distribution
+        return self._factory.preparer.prepare_linked_requirement(
+            self._ireq, parallel_builds=True,
+        )
+
+
+class EditableCandidate(_InstallRequirementBackedCandidate):
+    is_editable = True
+
+    def __init__(
+        self,
+        link,          # type: Link
+        template,        # type: InstallRequirement
+        factory,       # type: Factory
+        name=None,     # type: Optional[str]
+        version=None,  # type: Optional[_BaseVersion]
+    ):
+        # type: (...) -> None
+        super(EditableCandidate, self).__init__(
+            link=link,
+            source_link=link,
+            ireq=make_install_req_from_editable(link, template),
+            factory=factory,
+            name=name,
+            version=version,
+        )
+
+    def _prepare_distribution(self):
+        # type: () -> Distribution
+        return self._factory.preparer.prepare_editable_requirement(self._ireq)
+
+
+class AlreadyInstalledCandidate(Candidate):
+    is_installed = True
+    source_link = None
+
+    def __init__(
+        self,
+        dist,  # type: Distribution
+        template,  # type: InstallRequirement
+        factory,  # type: Factory
+    ):
+        # type: (...) -> None
+        self.dist = dist
+        self._ireq = make_install_req_from_dist(dist, template)
+        self._factory = factory
+
+        # This is just logging some messages, so we can do it eagerly.
+        # The returned dist would be exactly the same as self.dist because we
+        # set satisfied_by in make_install_req_from_dist.
+        # TODO: Supply reason based on force_reinstall and upgrade_strategy.
+        skip_reason = "already satisfied"
+        factory.preparer.prepare_installed_requirement(self._ireq, skip_reason)
+
+    def __str__(self):
+        # type: () -> str
+        return str(self.dist)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({distribution!r})".format(
+            class_name=self.__class__.__name__,
+            distribution=self.dist,
+        )
+
+    def __hash__(self):
+        # type: () -> int
+        return hash((self.__class__, self.name, self.version))
+
+    def __eq__(self, other):
+        # type: (Any) -> bool
+        if isinstance(other, self.__class__):
+            return self.name == other.name and self.version == other.version
+        return False
+
+    # Needed for Python 2, which does not implement this by default
+    def __ne__(self, other):
+        # type: (Any) -> bool
+        return not self.__eq__(other)
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        return canonicalize_name(self.dist.project_name)
+
+    @property
+    def name(self):
+        # type: () -> str
+        return self.project_name
+
+    @property
+    def version(self):
+        # type: () -> _BaseVersion
+        return parse_version(self.dist.version)
+
+    @property
+    def is_editable(self):
+        # type: () -> bool
+        return dist_is_editable(self.dist)
+
+    def format_for_error(self):
+        # type: () -> str
+        return "{} {} (Installed)".format(self.name, self.version)
+
+    def iter_dependencies(self, with_requires):
+        # type: (bool) -> Iterable[Optional[Requirement]]
+        if not with_requires:
+            return
+        for r in self.dist.requires():
+            yield self._factory.make_requirement_from_spec(str(r), self._ireq)
+
+    def get_install_requirement(self):
+        # type: () -> Optional[InstallRequirement]
+        return None
+
+
+class ExtrasCandidate(Candidate):
+    """A candidate that has 'extras', indicating additional dependencies.
+
+    Requirements can be for a project with dependencies, something like
+    foo[extra].  The extras don't affect the project/version being installed
+    directly, but indicate that we need additional dependencies. We model that
+    by having an artificial ExtrasCandidate that wraps the "base" candidate.
+
+    The ExtrasCandidate differs from the base in the following ways:
+
+    1. It has a unique name, of the form foo[extra]. This causes the resolver
+       to treat it as a separate node in the dependency graph.
+    2. When we're getting the candidate's dependencies,
+       a) We specify that we want the extra dependencies as well.
+       b) We add a dependency on the base candidate.
+          See below for why this is needed.
+    3. We return None for the underlying InstallRequirement, as the base
+       candidate will provide it, and we don't want to end up with duplicates.
+
+    The dependency on the base candidate is needed so that the resolver can't
+    decide that it should recommend foo[extra1] version 1.0 and foo[extra2]
+    version 2.0. Having those candidates depend on foo=1.0 and foo=2.0
+    respectively forces the resolver to recognise that this is a conflict.
+    """
+    def __init__(
+        self,
+        base,  # type: BaseCandidate
+        extras,  # type: FrozenSet[str]
+    ):
+        # type: (...) -> None
+        self.base = base
+        self.extras = extras
+
+    def __str__(self):
+        # type: () -> str
+        name, rest = str(self.base).split(" ", 1)
+        return "{}[{}] {}".format(name, ",".join(self.extras), rest)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}(base={base!r}, extras={extras!r})".format(
+            class_name=self.__class__.__name__,
+            base=self.base,
+            extras=self.extras,
+        )
+
+    def __hash__(self):
+        # type: () -> int
+        return hash((self.base, self.extras))
+
+    def __eq__(self, other):
+        # type: (Any) -> bool
+        if isinstance(other, self.__class__):
+            return self.base == other.base and self.extras == other.extras
+        return False
+
+    # Needed for Python 2, which does not implement this by default
+    def __ne__(self, other):
+        # type: (Any) -> bool
+        return not self.__eq__(other)
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        return self.base.project_name
+
+    @property
+    def name(self):
+        # type: () -> str
+        """The normalised name of the project the candidate refers to"""
+        return format_name(self.base.project_name, self.extras)
+
+    @property
+    def version(self):
+        # type: () -> _BaseVersion
+        return self.base.version
+
+    def format_for_error(self):
+        # type: () -> str
+        return "{} [{}]".format(
+            self.base.format_for_error(),
+            ", ".join(sorted(self.extras))
+        )
+
+    @property
+    def is_installed(self):
+        # type: () -> bool
+        return self.base.is_installed
+
+    @property
+    def is_editable(self):
+        # type: () -> bool
+        return self.base.is_editable
+
+    @property
+    def source_link(self):
+        # type: () -> Optional[Link]
+        return self.base.source_link
+
+    def iter_dependencies(self, with_requires):
+        # type: (bool) -> Iterable[Optional[Requirement]]
+        factory = self.base._factory
+
+        # Add a dependency on the exact base
+        # (See note 2b in the class docstring)
+        yield factory.make_requirement_from_candidate(self.base)
+        if not with_requires:
+            return
+
+        # The user may have specified extras that the candidate doesn't
+        # support. We ignore any unsupported extras here.
+        valid_extras = self.extras.intersection(self.base.dist.extras)
+        invalid_extras = self.extras.difference(self.base.dist.extras)
+        for extra in sorted(invalid_extras):
+            logger.warning(
+                "%s %s does not provide the extra '%s'",
+                self.base.name,
+                self.version,
+                extra
+            )
+
+        for r in self.base.dist.requires(valid_extras):
+            requirement = factory.make_requirement_from_spec(
+                str(r), self.base._ireq, valid_extras,
+            )
+            if requirement:
+                yield requirement
+
+    def get_install_requirement(self):
+        # type: () -> Optional[InstallRequirement]
+        # We don't return anything here, because we always
+        # depend on the base candidate, and we'll get the
+        # install requirement from that.
+        return None
+
+
+class RequiresPythonCandidate(Candidate):
+    is_installed = False
+    source_link = None
+
+    def __init__(self, py_version_info):
+        # type: (Optional[Tuple[int, ...]]) -> None
+        if py_version_info is not None:
+            version_info = normalize_version_info(py_version_info)
+        else:
+            version_info = sys.version_info[:3]
+        self._version = Version(".".join(str(c) for c in version_info))
+
+    # We don't need to implement __eq__() and __ne__() since there is always
+    # only one RequiresPythonCandidate in a resolution, i.e. the host Python.
+    # The built-in object.__eq__() and object.__ne__() do exactly what we want.
+
+    def __str__(self):
+        # type: () -> str
+        return "Python {}".format(self._version)
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        # Avoid conflicting with the PyPI package "Python".
+        return "<Python from Requires-Python>"
+
+    @property
+    def name(self):
+        # type: () -> str
+        return self.project_name
+
+    @property
+    def version(self):
+        # type: () -> _BaseVersion
+        return self._version
+
+    def format_for_error(self):
+        # type: () -> str
+        return "Python {}".format(self.version)
+
+    def iter_dependencies(self, with_requires):
+        # type: (bool) -> Iterable[Optional[Requirement]]
+        return ()
+
+    def get_install_requirement(self):
+        # type: () -> Optional[InstallRequirement]
+        return None
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py
new file mode 100644
index 0000000000000000000000000000000000000000..e81595b8c90bd9ccf2420ecd19f90ad36647b49f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/factory.py
@@ -0,0 +1,504 @@
+import logging
+
+from pip._vendor.packaging.utils import canonicalize_name
+
+from pip._internal.exceptions import (
+    DistributionNotFound,
+    InstallationError,
+    InstallationSubprocessError,
+    MetadataInconsistent,
+    UnsupportedPythonVersion,
+    UnsupportedWheel,
+)
+from pip._internal.models.wheel import Wheel
+from pip._internal.req.req_install import InstallRequirement
+from pip._internal.utils.compatibility_tags import get_supported
+from pip._internal.utils.hashes import Hashes
+from pip._internal.utils.misc import (
+    dist_in_site_packages,
+    dist_in_usersite,
+    get_installed_distributions,
+)
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+from pip._internal.utils.virtualenv import running_under_virtualenv
+
+from .base import Constraint
+from .candidates import (
+    AlreadyInstalledCandidate,
+    EditableCandidate,
+    ExtrasCandidate,
+    LinkCandidate,
+    RequiresPythonCandidate,
+)
+from .found_candidates import FoundCandidates
+from .requirements import (
+    ExplicitRequirement,
+    RequiresPythonRequirement,
+    SpecifierRequirement,
+    UnsatisfiableRequirement,
+)
+
+if MYPY_CHECK_RUNNING:
+    from typing import (
+        Dict,
+        FrozenSet,
+        Iterable,
+        Iterator,
+        List,
+        Optional,
+        Sequence,
+        Set,
+        Tuple,
+        TypeVar,
+    )
+
+    from pip._vendor.packaging.specifiers import SpecifierSet
+    from pip._vendor.packaging.version import _BaseVersion
+    from pip._vendor.pkg_resources import Distribution
+    from pip._vendor.resolvelib import ResolutionImpossible
+
+    from pip._internal.cache import CacheEntry, WheelCache
+    from pip._internal.index.package_finder import PackageFinder
+    from pip._internal.models.link import Link
+    from pip._internal.operations.prepare import RequirementPreparer
+    from pip._internal.resolution.base import InstallRequirementProvider
+
+    from .base import Candidate, Requirement
+    from .candidates import BaseCandidate
+
+    C = TypeVar("C")
+    Cache = Dict[Link, C]
+    VersionCandidates = Dict[_BaseVersion, Candidate]
+
+
+logger = logging.getLogger(__name__)
+
+
+class Factory(object):
+    def __init__(
+        self,
+        finder,  # type: PackageFinder
+        preparer,  # type: RequirementPreparer
+        make_install_req,  # type: InstallRequirementProvider
+        wheel_cache,  # type: Optional[WheelCache]
+        use_user_site,  # type: bool
+        force_reinstall,  # type: bool
+        ignore_installed,  # type: bool
+        ignore_requires_python,  # type: bool
+        py_version_info=None,  # type: Optional[Tuple[int, ...]]
+    ):
+        # type: (...) -> None
+        self._finder = finder
+        self.preparer = preparer
+        self._wheel_cache = wheel_cache
+        self._python_candidate = RequiresPythonCandidate(py_version_info)
+        self._make_install_req_from_spec = make_install_req
+        self._use_user_site = use_user_site
+        self._force_reinstall = force_reinstall
+        self._ignore_requires_python = ignore_requires_python
+
+        self._build_failures = {}  # type: Cache[InstallationError]
+        self._link_candidate_cache = {}  # type: Cache[LinkCandidate]
+        self._editable_candidate_cache = {}  # type: Cache[EditableCandidate]
+        self._installed_candidate_cache = {
+        }  # type: Dict[str, AlreadyInstalledCandidate]
+
+        if not ignore_installed:
+            self._installed_dists = {
+                canonicalize_name(dist.project_name): dist
+                for dist in get_installed_distributions(local_only=False)
+            }
+        else:
+            self._installed_dists = {}
+
+    @property
+    def force_reinstall(self):
+        # type: () -> bool
+        return self._force_reinstall
+
+    def _make_candidate_from_dist(
+        self,
+        dist,  # type: Distribution
+        extras,  # type: FrozenSet[str]
+        template,  # type: InstallRequirement
+    ):
+        # type: (...) -> Candidate
+        try:
+            base = self._installed_candidate_cache[dist.key]
+        except KeyError:
+            base = AlreadyInstalledCandidate(dist, template, factory=self)
+            self._installed_candidate_cache[dist.key] = base
+        if extras:
+            return ExtrasCandidate(base, extras)
+        return base
+
+    def _make_candidate_from_link(
+        self,
+        link,  # type: Link
+        extras,  # type: FrozenSet[str]
+        template,  # type: InstallRequirement
+        name,  # type: Optional[str]
+        version,  # type: Optional[_BaseVersion]
+    ):
+        # type: (...) -> Optional[Candidate]
+        # TODO: Check already installed candidate, and use it if the link and
+        # editable flag match.
+
+        if link in self._build_failures:
+            # We already tried this candidate before, and it does not build.
+            # Don't bother trying again.
+            return None
+
+        if template.editable:
+            if link not in self._editable_candidate_cache:
+                try:
+                    self._editable_candidate_cache[link] = EditableCandidate(
+                        link, template, factory=self,
+                        name=name, version=version,
+                    )
+                except (InstallationSubprocessError, MetadataInconsistent) as e:
+                    logger.warning("Discarding %s. %s", link, e)
+                    self._build_failures[link] = e
+                    return None
+            base = self._editable_candidate_cache[link]  # type: BaseCandidate
+        else:
+            if link not in self._link_candidate_cache:
+                try:
+                    self._link_candidate_cache[link] = LinkCandidate(
+                        link, template, factory=self,
+                        name=name, version=version,
+                    )
+                except (InstallationSubprocessError, MetadataInconsistent) as e:
+                    logger.warning("Discarding %s. %s", link, e)
+                    self._build_failures[link] = e
+                    return None
+            base = self._link_candidate_cache[link]
+
+        if extras:
+            return ExtrasCandidate(base, extras)
+        return base
+
+    def _iter_found_candidates(
+        self,
+        ireqs,  # type: Sequence[InstallRequirement]
+        specifier,  # type: SpecifierSet
+        hashes,  # type: Hashes
+        prefers_installed,  # type: bool
+    ):
+        # type: (...) -> Iterable[Candidate]
+        if not ireqs:
+            return ()
+
+        # The InstallRequirement implementation requires us to give it a
+        # "template". Here we just choose the first requirement to represent
+        # all of them.
+        # Hopefully the Project model can correct this mismatch in the future.
+        template = ireqs[0]
+        name = canonicalize_name(template.req.name)
+
+        extras = frozenset()  # type: FrozenSet[str]
+        for ireq in ireqs:
+            specifier &= ireq.req.specifier
+            hashes &= ireq.hashes(trust_internet=False)
+            extras |= frozenset(ireq.extras)
+
+        # Get the installed version, if it matches, unless the user
+        # specified `--force-reinstall`, when we want the version from
+        # the index instead.
+        installed_candidate = None
+        if not self._force_reinstall and name in self._installed_dists:
+            installed_dist = self._installed_dists[name]
+            if specifier.contains(installed_dist.version, prereleases=True):
+                installed_candidate = self._make_candidate_from_dist(
+                    dist=installed_dist,
+                    extras=extras,
+                    template=template,
+                )
+
+        def iter_index_candidates():
+            # type: () -> Iterator[Candidate]
+            result = self._finder.find_best_candidate(
+                project_name=name,
+                specifier=specifier,
+                hashes=hashes,
+            )
+            icans = list(result.iter_applicable())
+
+            # PEP 592: Yanked releases must be ignored unless only yanked
+            # releases can satisfy the version range. So if this is false,
+            # all yanked icans need to be skipped.
+            all_yanked = all(ican.link.is_yanked for ican in icans)
+
+            # PackageFinder returns earlier versions first, so we reverse.
+            versions_found = set()  # type: Set[_BaseVersion]
+            for ican in reversed(icans):
+                if not all_yanked and ican.link.is_yanked:
+                    continue
+                if ican.version in versions_found:
+                    continue
+                candidate = self._make_candidate_from_link(
+                    link=ican.link,
+                    extras=extras,
+                    template=template,
+                    name=name,
+                    version=ican.version,
+                )
+                if candidate is None:
+                    continue
+                yield candidate
+                versions_found.add(ican.version)
+
+        return FoundCandidates(
+            iter_index_candidates,
+            installed_candidate,
+            prefers_installed,
+        )
+
+    def find_candidates(
+        self,
+        requirements,  # type: Sequence[Requirement]
+        constraint,  # type: Constraint
+        prefers_installed,  # type: bool
+    ):
+        # type: (...) -> Iterable[Candidate]
+        explicit_candidates = set()  # type: Set[Candidate]
+        ireqs = []  # type: List[InstallRequirement]
+        for req in requirements:
+            cand, ireq = req.get_candidate_lookup()
+            if cand is not None:
+                explicit_candidates.add(cand)
+            if ireq is not None:
+                ireqs.append(ireq)
+
+        # If none of the requirements want an explicit candidate, we can ask
+        # the finder for candidates.
+        if not explicit_candidates:
+            return self._iter_found_candidates(
+                ireqs,
+                constraint.specifier,
+                constraint.hashes,
+                prefers_installed,
+            )
+
+        return (
+            c for c in explicit_candidates
+            if constraint.is_satisfied_by(c)
+            and all(req.is_satisfied_by(c) for req in requirements)
+        )
+
+    def make_requirement_from_install_req(self, ireq, requested_extras):
+        # type: (InstallRequirement, Iterable[str]) -> Optional[Requirement]
+        if not ireq.match_markers(requested_extras):
+            logger.info(
+                "Ignoring %s: markers '%s' don't match your environment",
+                ireq.name, ireq.markers,
+            )
+            return None
+        if not ireq.link:
+            return SpecifierRequirement(ireq)
+        if ireq.link.is_wheel:
+            wheel = Wheel(ireq.link.filename)
+            if not wheel.supported(self._finder.target_python.get_tags()):
+                msg = "{} is not a supported wheel on this platform.".format(
+                    wheel.filename,
+                )
+                raise UnsupportedWheel(msg)
+        cand = self._make_candidate_from_link(
+            ireq.link,
+            extras=frozenset(ireq.extras),
+            template=ireq,
+            name=canonicalize_name(ireq.name) if ireq.name else None,
+            version=None,
+        )
+        if cand is None:
+            # There's no way we can satisfy a URL requirement if the underlying
+            # candidate fails to build. An unnamed URL must be user-supplied, so
+            # we fail eagerly. If the URL is named, an unsatisfiable requirement
+            # can make the resolver do the right thing, either backtrack (and
+            # maybe find some other requirement that's buildable) or raise a
+            # ResolutionImpossible eventually.
+            if not ireq.name:
+                raise self._build_failures[ireq.link]
+            return UnsatisfiableRequirement(canonicalize_name(ireq.name))
+        return self.make_requirement_from_candidate(cand)
+
+    def make_requirement_from_candidate(self, candidate):
+        # type: (Candidate) -> ExplicitRequirement
+        return ExplicitRequirement(candidate)
+
+    def make_requirement_from_spec(
+        self,
+        specifier,  # type: str
+        comes_from,  # type: InstallRequirement
+        requested_extras=(),  # type: Iterable[str]
+    ):
+        # type: (...) -> Optional[Requirement]
+        ireq = self._make_install_req_from_spec(specifier, comes_from)
+        return self.make_requirement_from_install_req(ireq, requested_extras)
+
+    def make_requires_python_requirement(self, specifier):
+        # type: (Optional[SpecifierSet]) -> Optional[Requirement]
+        if self._ignore_requires_python or specifier is None:
+            return None
+        return RequiresPythonRequirement(specifier, self._python_candidate)
+
+    def get_wheel_cache_entry(self, link, name):
+        # type: (Link, Optional[str]) -> Optional[CacheEntry]
+        """Look up the link in the wheel cache.
+
+        If ``preparer.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
+        nondeterministic contents due to file modification times.
+        """
+        if self._wheel_cache is None or self.preparer.require_hashes:
+            return None
+        return self._wheel_cache.get_cache_entry(
+            link=link,
+            package_name=name,
+            supported_tags=get_supported(),
+        )
+
+    def get_dist_to_uninstall(self, candidate):
+        # type: (Candidate) -> Optional[Distribution]
+        # TODO: Are there more cases this needs to return True? Editable?
+        dist = self._installed_dists.get(candidate.name)
+        if dist is None:  # Not installed, no uninstallation required.
+            return None
+
+        # We're installing into global site. The current installation must
+        # be uninstalled, no matter it's in global or user site, because the
+        # user site installation has precedence over global.
+        if not self._use_user_site:
+            return dist
+
+        # We're installing into user site. Remove the user site installation.
+        if dist_in_usersite(dist):
+            return dist
+
+        # We're installing into user site, but the installed incompatible
+        # package is in global site. We can't uninstall that, and would let
+        # the new user installation to "shadow" it. But shadowing won't work
+        # in virtual environments, so we error out.
+        if running_under_virtualenv() and dist_in_site_packages(dist):
+            raise InstallationError(
+                "Will not install to the user site because it will "
+                "lack sys.path precedence to {} in {}".format(
+                    dist.project_name, dist.location,
+                )
+            )
+        return None
+
+    def _report_requires_python_error(
+        self,
+        requirement,  # type: RequiresPythonRequirement
+        template,  # type: Candidate
+    ):
+        # type: (...) -> UnsupportedPythonVersion
+        message_format = (
+            "Package {package!r} requires a different Python: "
+            "{version} not in {specifier!r}"
+        )
+        message = message_format.format(
+            package=template.name,
+            version=self._python_candidate.version,
+            specifier=str(requirement.specifier),
+        )
+        return UnsupportedPythonVersion(message)
+
+    def get_installation_error(self, e):
+        # type: (ResolutionImpossible) -> InstallationError
+
+        assert e.causes, "Installation error reported with no cause"
+
+        # If one of the things we can't solve is "we need Python X.Y",
+        # that is what we report.
+        for cause in e.causes:
+            if isinstance(cause.requirement, RequiresPythonRequirement):
+                return self._report_requires_python_error(
+                    cause.requirement,
+                    cause.parent,
+                )
+
+        # Otherwise, we have a set of causes which can't all be satisfied
+        # at once.
+
+        # The simplest case is when we have *one* cause that can't be
+        # satisfied. We just report that case.
+        if len(e.causes) == 1:
+            req, parent = e.causes[0]
+            if parent is None:
+                req_disp = str(req)
+            else:
+                req_disp = '{} (from {})'.format(req, parent.name)
+            logger.critical(
+                "Could not find a version that satisfies the requirement %s",
+                req_disp,
+            )
+            return DistributionNotFound(
+                'No matching distribution found for {}'.format(req)
+            )
+
+        # OK, we now have a list of requirements that can't all be
+        # satisfied at once.
+
+        # A couple of formatting helpers
+        def text_join(parts):
+            # type: (List[str]) -> str
+            if len(parts) == 1:
+                return parts[0]
+
+            return ", ".join(parts[:-1]) + " and " + parts[-1]
+
+        def describe_trigger(parent):
+            # type: (Candidate) -> str
+            ireq = parent.get_install_requirement()
+            if not ireq or not ireq.comes_from:
+                return "{}=={}".format(parent.name, parent.version)
+            if isinstance(ireq.comes_from, InstallRequirement):
+                return str(ireq.comes_from.name)
+            return str(ireq.comes_from)
+
+        triggers = set()
+        for req, parent in e.causes:
+            if parent is None:
+                # This is a root requirement, so we can report it directly
+                trigger = req.format_for_error()
+            else:
+                trigger = describe_trigger(parent)
+            triggers.add(trigger)
+
+        if triggers:
+            info = text_join(sorted(triggers))
+        else:
+            info = "the requested packages"
+
+        msg = "Cannot install {} because these package versions " \
+            "have conflicting dependencies.".format(info)
+        logger.critical(msg)
+        msg = "\nThe conflict is caused by:"
+        for req, parent in e.causes:
+            msg = msg + "\n    "
+            if parent:
+                msg = msg + "{} {} depends on ".format(
+                    parent.name,
+                    parent.version
+                )
+            else:
+                msg = msg + "The user requested "
+            msg = msg + req.format_for_error()
+
+        msg = msg + "\n\n" + \
+            "To fix this you could try to:\n" + \
+            "1. loosen the range of package versions you've specified\n" + \
+            "2. remove package versions to allow pip attempt to solve " + \
+            "the dependency conflict\n"
+
+        logger.info(msg)
+
+        return DistributionNotFound(
+            "ResolutionImpossible: for help visit "
+            "https://pip.pypa.io/en/latest/user_guide/"
+            "#fixing-conflicting-dependencies"
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py
new file mode 100644
index 0000000000000000000000000000000000000000..50359b64fee2d361968f82400fdb96588de6aed4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/found_candidates.py
@@ -0,0 +1,101 @@
+"""Utilities to lazily create and visit candidates found.
+
+Creating and visiting a candidate is a *very* costly operation. It involves
+fetching, extracting, potentially building modules from source, and verifying
+distribution metadata. It is therefore crucial for performance to keep
+everything here lazy all the way down, so we only touch candidates that we
+absolutely need, and not "download the world" when we only need one version of
+something.
+"""
+
+import itertools
+
+from pip._vendor.six.moves import collections_abc  # type: ignore
+
+from pip._internal.utils.compat import lru_cache
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Callable, Iterator, Optional
+
+    from .base import Candidate
+
+
+def _insert_installed(installed, others):
+    # type: (Candidate, Iterator[Candidate]) -> Iterator[Candidate]
+    """Iterator for ``FoundCandidates``.
+
+    This iterator is used when the resolver prefers to upgrade an
+    already-installed package. Candidates from index are returned in their
+    normal ordering, except replaced when the version is already installed.
+
+    The implementation iterates through and yields other candidates, inserting
+    the installed candidate exactly once before we start yielding older or
+    equivalent candidates, or after all other candidates if they are all newer.
+    """
+    installed_yielded = False
+    for candidate in others:
+        # If the installed candidate is better, yield it first.
+        if not installed_yielded and installed.version >= candidate.version:
+            yield installed
+            installed_yielded = True
+        yield candidate
+
+    # If the installed candidate is older than all other candidates.
+    if not installed_yielded:
+        yield installed
+
+
+class FoundCandidates(collections_abc.Sequence):
+    """A lazy sequence to provide candidates to the resolver.
+
+    The intended usage is to return this from `find_matches()` so the resolver
+    can iterate through the sequence multiple times, but only access the index
+    page when remote packages are actually needed. This improve performances
+    when suitable candidates are already installed on disk.
+    """
+    def __init__(
+        self,
+        get_others,  # type: Callable[[], Iterator[Candidate]]
+        installed,  # type: Optional[Candidate]
+        prefers_installed,  # type: bool
+    ):
+        self._get_others = get_others
+        self._installed = installed
+        self._prefers_installed = prefers_installed
+
+    def __getitem__(self, index):
+        # type: (int) -> Candidate
+        # Implemented to satisfy the ABC check. This is not needed by the
+        # resolver, and should not be used by the provider either (for
+        # performance reasons).
+        raise NotImplementedError("don't do this")
+
+    def __iter__(self):
+        # type: () -> Iterator[Candidate]
+        if not self._installed:
+            return self._get_others()
+        others = (
+            candidate
+            for candidate in self._get_others()
+            if candidate.version != self._installed.version
+        )
+        if self._prefers_installed:
+            return itertools.chain([self._installed], others)
+        return _insert_installed(self._installed, others)
+
+    def __len__(self):
+        # type: () -> int
+        # Implemented to satisfy the ABC check. This is not needed by the
+        # resolver, and should not be used by the provider either (for
+        # performance reasons).
+        raise NotImplementedError("don't do this")
+
+    @lru_cache(maxsize=1)
+    def __bool__(self):
+        # type: () -> bool
+        if self._prefers_installed and self._installed:
+            return True
+        return any(self)
+
+    __nonzero__ = __bool__  # XXX: Python 2.
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py
new file mode 100644
index 0000000000000000000000000000000000000000..40a641a2a4dc164d8289148b9b478ee01b2a81d5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/provider.py
@@ -0,0 +1,174 @@
+from pip._vendor.resolvelib.providers import AbstractProvider
+
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+from .base import Constraint
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, Dict, Iterable, Optional, Sequence, Set, Tuple, Union
+
+    from .base import Candidate, Requirement
+    from .factory import Factory
+
+# Notes on the relationship between the provider, the factory, and the
+# candidate and requirement classes.
+#
+# The provider is a direct implementation of the resolvelib class. Its role
+# is to deliver the API that resolvelib expects.
+#
+# Rather than work with completely abstract "requirement" and "candidate"
+# concepts as resolvelib does, pip has concrete classes implementing these two
+# ideas. The API of Requirement and Candidate objects are defined in the base
+# classes, but essentially map fairly directly to the equivalent provider
+# methods. In particular, `find_matches` and `is_satisfied_by` are
+# requirement methods, and `get_dependencies` is a candidate method.
+#
+# The factory is the interface to pip's internal mechanisms. It is stateless,
+# and is created by the resolver and held as a property of the provider. It is
+# responsible for creating Requirement and Candidate objects, and provides
+# services to those objects (access to pip's finder and preparer).
+
+
+class PipProvider(AbstractProvider):
+    """Pip's provider implementation for resolvelib.
+
+    :params constraints: A mapping of constraints specified by the user. Keys
+        are canonicalized project names.
+    :params ignore_dependencies: Whether the user specified ``--no-deps``.
+    :params upgrade_strategy: The user-specified upgrade strategy.
+    :params user_requested: A set of canonicalized package names that the user
+        supplied for pip to install/upgrade.
+    """
+
+    def __init__(
+        self,
+        factory,  # type: Factory
+        constraints,  # type: Dict[str, Constraint]
+        ignore_dependencies,  # type: bool
+        upgrade_strategy,  # type: str
+        user_requested,  # type: Set[str]
+    ):
+        # type: (...) -> None
+        self._factory = factory
+        self._constraints = constraints
+        self._ignore_dependencies = ignore_dependencies
+        self._upgrade_strategy = upgrade_strategy
+        self._user_requested = user_requested
+
+    def identify(self, dependency):
+        # type: (Union[Requirement, Candidate]) -> str
+        return dependency.name
+
+    def get_preference(
+        self,
+        resolution,  # type: Optional[Candidate]
+        candidates,  # type: Sequence[Candidate]
+        information  # type: Sequence[Tuple[Requirement, Candidate]]
+    ):
+        # type: (...) -> Any
+        """Produce a sort key for given requirement based on preference.
+
+        The lower the return value is, the more preferred this group of
+        arguments is.
+
+        Currently pip considers the followings in order:
+
+        * Prefer if any of the known requirements points to an explicit URL.
+        * If equal, prefer if any requirements contain ``===`` and ``==``.
+        * If equal, prefer if requirements include version constraints, e.g.
+          ``>=`` and ``<``.
+        * If equal, prefer user-specified (non-transitive) requirements.
+        * If equal, order alphabetically for consistency (helps debuggability).
+        """
+
+        def _get_restrictive_rating(requirements):
+            # type: (Iterable[Requirement]) -> int
+            """Rate how restrictive a set of requirements are.
+
+            ``Requirement.get_candidate_lookup()`` returns a 2-tuple for
+            lookup. The first element is ``Optional[Candidate]`` and the
+            second ``Optional[InstallRequirement]``.
+
+            * If the requirement is an explicit one, the explicitly-required
+              candidate is returned as the first element.
+            * If the requirement is based on a PEP 508 specifier, the backing
+              ``InstallRequirement`` is returned as the second element.
+
+            We use the first element to check whether there is an explicit
+            requirement, and the second for equality operator.
+            """
+            lookups = (r.get_candidate_lookup() for r in requirements)
+            cands, ireqs = zip(*lookups)
+            if any(cand is not None for cand in cands):
+                return 0
+            spec_sets = (ireq.specifier for ireq in ireqs if ireq)
+            operators = [
+                specifier.operator
+                for spec_set in spec_sets
+                for specifier in spec_set
+            ]
+            if any(op in ("==", "===") for op in operators):
+                return 1
+            if operators:
+                return 2
+            # A "bare" requirement without any version requirements.
+            return 3
+
+        restrictive = _get_restrictive_rating(req for req, _ in information)
+        transitive = all(parent is not None for _, parent in information)
+        key = next(iter(candidates)).name if candidates else ""
+
+        # HACK: Setuptools have a very long and solid backward compatibility
+        # track record, and extremely few projects would request a narrow,
+        # non-recent version range of it since that would break a lot things.
+        # (Most projects specify it only to request for an installer feature,
+        # which does not work, but that's another topic.) Intentionally
+        # delaying Setuptools helps reduce branches the resolver has to check.
+        # This serves as a temporary fix for issues like "apache-airlfow[all]"
+        # while we work on "proper" branch pruning techniques.
+        delay_this = (key == "setuptools")
+
+        return (delay_this, restrictive, transitive, key)
+
+    def find_matches(self, requirements):
+        # type: (Sequence[Requirement]) -> Iterable[Candidate]
+        if not requirements:
+            return []
+        name = requirements[0].project_name
+
+        def _eligible_for_upgrade(name):
+            # type: (str) -> bool
+            """Are upgrades allowed for this project?
+
+            This checks the upgrade strategy, and whether the project was one
+            that the user specified in the command line, in order to decide
+            whether we should upgrade if there's a newer version available.
+
+            (Note that we don't need access to the `--upgrade` flag, because
+            an upgrade strategy of "to-satisfy-only" means that `--upgrade`
+            was not specified).
+            """
+            if self._upgrade_strategy == "eager":
+                return True
+            elif self._upgrade_strategy == "only-if-needed":
+                return (name in self._user_requested)
+            return False
+
+        return self._factory.find_candidates(
+            requirements,
+            constraint=self._constraints.get(name, Constraint.empty()),
+            prefers_installed=(not _eligible_for_upgrade(name)),
+        )
+
+    def is_satisfied_by(self, requirement, candidate):
+        # type: (Requirement, Candidate) -> bool
+        return requirement.is_satisfied_by(candidate)
+
+    def get_dependencies(self, candidate):
+        # type: (Candidate) -> Sequence[Requirement]
+        with_requires = not self._ignore_dependencies
+        return [
+            r
+            for r in candidate.iter_dependencies(with_requires)
+            if r is not None
+        ]
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/reporter.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/reporter.py
new file mode 100644
index 0000000000000000000000000000000000000000..d0ef3fadc670706b471be2b21302678ee971fca7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/reporter.py
@@ -0,0 +1,84 @@
+from collections import defaultdict
+from logging import getLogger
+
+from pip._vendor.resolvelib.reporters import BaseReporter
+
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, DefaultDict
+
+    from .base import Candidate, Requirement
+
+
+logger = getLogger(__name__)
+
+
+class PipReporter(BaseReporter):
+
+    def __init__(self):
+        # type: () -> None
+        self.backtracks_by_package = defaultdict(int)  # type: DefaultDict[str, int]
+
+        self._messages_at_backtrack = {
+            1: (
+                "pip is looking at multiple versions of {package_name} to "
+                "determine which version is compatible with other "
+                "requirements. This could take a while."
+            ),
+            8: (
+                "pip is looking at multiple versions of {package_name} to "
+                "determine which version is compatible with other "
+                "requirements. This could take a while."
+            ),
+            13: (
+                "This is taking longer than usual. You might need to provide "
+                "the dependency resolver with stricter constraints to reduce "
+                "runtime. If you want to abort this run, you can press "
+                "Ctrl + C to do so. To improve how pip performs, tell us what "
+                "happened here: https://pip.pypa.io/surveys/backtracking"
+            )
+        }
+
+    def backtracking(self, candidate):
+        # type: (Candidate) -> None
+        self.backtracks_by_package[candidate.name] += 1
+
+        count = self.backtracks_by_package[candidate.name]
+        if count not in self._messages_at_backtrack:
+            return
+
+        message = self._messages_at_backtrack[count]
+        logger.info("INFO: %s", message.format(package_name=candidate.name))
+
+
+class PipDebuggingReporter(BaseReporter):
+    """A reporter that does an info log for every event it sees."""
+
+    def starting(self):
+        # type: () -> None
+        logger.info("Reporter.starting()")
+
+    def starting_round(self, index):
+        # type: (int) -> None
+        logger.info("Reporter.starting_round(%r)", index)
+
+    def ending_round(self, index, state):
+        # type: (int, Any) -> None
+        logger.info("Reporter.ending_round(%r, state)", index)
+
+    def ending(self, state):
+        # type: (Any) -> None
+        logger.info("Reporter.ending(%r)", state)
+
+    def adding_requirement(self, requirement, parent):
+        # type: (Requirement, Candidate) -> None
+        logger.info("Reporter.adding_requirement(%r, %r)", requirement, parent)
+
+    def backtracking(self, candidate):
+        # type: (Candidate) -> None
+        logger.info("Reporter.backtracking(%r)", candidate)
+
+    def pinning(self, candidate):
+        # type: (Candidate) -> None
+        logger.info("Reporter.pinning(%r)", candidate)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py
new file mode 100644
index 0000000000000000000000000000000000000000..1229f353750b2732dc97dd35b455e4b7b856dd43
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/requirements.py
@@ -0,0 +1,201 @@
+from pip._vendor.packaging.utils import canonicalize_name
+
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+from .base import Requirement, format_name
+
+if MYPY_CHECK_RUNNING:
+    from pip._vendor.packaging.specifiers import SpecifierSet
+
+    from pip._internal.req.req_install import InstallRequirement
+
+    from .base import Candidate, CandidateLookup
+
+
+class ExplicitRequirement(Requirement):
+    def __init__(self, candidate):
+        # type: (Candidate) -> None
+        self.candidate = candidate
+
+    def __str__(self):
+        # type: () -> str
+        return str(self.candidate)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({candidate!r})".format(
+            class_name=self.__class__.__name__,
+            candidate=self.candidate,
+        )
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        # No need to canonicalise - the candidate did this
+        return self.candidate.project_name
+
+    @property
+    def name(self):
+        # type: () -> str
+        # No need to canonicalise - the candidate did this
+        return self.candidate.name
+
+    def format_for_error(self):
+        # type: () -> str
+        return self.candidate.format_for_error()
+
+    def get_candidate_lookup(self):
+        # type: () -> CandidateLookup
+        return self.candidate, None
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        return candidate == self.candidate
+
+
+class SpecifierRequirement(Requirement):
+    def __init__(self, ireq):
+        # type: (InstallRequirement) -> None
+        assert ireq.link is None, "This is a link, not a specifier"
+        self._ireq = ireq
+        self._extras = frozenset(ireq.extras)
+
+    def __str__(self):
+        # type: () -> str
+        return str(self._ireq.req)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({requirement!r})".format(
+            class_name=self.__class__.__name__,
+            requirement=str(self._ireq.req),
+        )
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        return canonicalize_name(self._ireq.req.name)
+
+    @property
+    def name(self):
+        # type: () -> str
+        return format_name(self.project_name, self._extras)
+
+    def format_for_error(self):
+        # type: () -> str
+
+        # Convert comma-separated specifiers into "A, B, ..., F and G"
+        # This makes the specifier a bit more "human readable", without
+        # risking a change in meaning. (Hopefully! Not all edge cases have
+        # been checked)
+        parts = [s.strip() for s in str(self).split(",")]
+        if len(parts) == 0:
+            return ""
+        elif len(parts) == 1:
+            return parts[0]
+
+        return ", ".join(parts[:-1]) + " and " + parts[-1]
+
+    def get_candidate_lookup(self):
+        # type: () -> CandidateLookup
+        return None, self._ireq
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        assert candidate.name == self.name, \
+            "Internal issue: Candidate is not for this requirement " \
+            " {} vs {}".format(candidate.name, self.name)
+        # We can safely always allow prereleases here since PackageFinder
+        # already implements the prerelease logic, and would have filtered out
+        # prerelease candidates if the user does not expect them.
+        spec = self._ireq.req.specifier
+        return spec.contains(candidate.version, prereleases=True)
+
+
+class RequiresPythonRequirement(Requirement):
+    """A requirement representing Requires-Python metadata.
+    """
+    def __init__(self, specifier, match):
+        # type: (SpecifierSet, Candidate) -> None
+        self.specifier = specifier
+        self._candidate = match
+
+    def __str__(self):
+        # type: () -> str
+        return "Python {}".format(self.specifier)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({specifier!r})".format(
+            class_name=self.__class__.__name__,
+            specifier=str(self.specifier),
+        )
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        return self._candidate.project_name
+
+    @property
+    def name(self):
+        # type: () -> str
+        return self._candidate.name
+
+    def format_for_error(self):
+        # type: () -> str
+        return str(self)
+
+    def get_candidate_lookup(self):
+        # type: () -> CandidateLookup
+        if self.specifier.contains(self._candidate.version, prereleases=True):
+            return self._candidate, None
+        return None, None
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        assert candidate.name == self._candidate.name, "Not Python candidate"
+        # We can safely always allow prereleases here since PackageFinder
+        # already implements the prerelease logic, and would have filtered out
+        # prerelease candidates if the user does not expect them.
+        return self.specifier.contains(candidate.version, prereleases=True)
+
+
+class UnsatisfiableRequirement(Requirement):
+    """A requirement that cannot be satisfied.
+    """
+    def __init__(self, name):
+        # type: (str) -> None
+        self._name = name
+
+    def __str__(self):
+        # type: () -> str
+        return "{} (unavailable)".format(self._name)
+
+    def __repr__(self):
+        # type: () -> str
+        return "{class_name}({name!r})".format(
+            class_name=self.__class__.__name__,
+            name=str(self._name),
+        )
+
+    @property
+    def project_name(self):
+        # type: () -> str
+        return self._name
+
+    @property
+    def name(self):
+        # type: () -> str
+        return self._name
+
+    def format_for_error(self):
+        # type: () -> str
+        return str(self)
+
+    def get_candidate_lookup(self):
+        # type: () -> CandidateLookup
+        return None, None
+
+    def is_satisfied_by(self, candidate):
+        # type: (Candidate) -> bool
+        return False
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py
new file mode 100644
index 0000000000000000000000000000000000000000..84421d43f8792b1742bf7f24b63d6b1705070133
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/resolution/resolvelib/resolver.py
@@ -0,0 +1,297 @@
+import functools
+import logging
+import os
+
+from pip._vendor import six
+from pip._vendor.packaging.utils import canonicalize_name
+from pip._vendor.packaging.version import parse as parse_version
+from pip._vendor.resolvelib import ResolutionImpossible
+from pip._vendor.resolvelib import Resolver as RLResolver
+
+from pip._internal.exceptions import InstallationError
+from pip._internal.req.req_install import check_invalid_constraint_type
+from pip._internal.req.req_set import RequirementSet
+from pip._internal.resolution.base import BaseResolver
+from pip._internal.resolution.resolvelib.provider import PipProvider
+from pip._internal.resolution.resolvelib.reporter import (
+    PipDebuggingReporter,
+    PipReporter,
+)
+from pip._internal.utils.deprecation import deprecated
+from pip._internal.utils.filetypes import is_archive_file
+from pip._internal.utils.misc import dist_is_editable
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+from .base import Constraint
+from .factory import Factory
+
+if MYPY_CHECK_RUNNING:
+    from typing import Dict, List, Optional, Set, Tuple
+
+    from pip._vendor.resolvelib.resolvers import Result
+    from pip._vendor.resolvelib.structs import Graph
+
+    from pip._internal.cache import WheelCache
+    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.resolution.base import InstallRequirementProvider
+
+
+logger = logging.getLogger(__name__)
+
+
+class Resolver(BaseResolver):
+    _allowed_strategies = {"eager", "only-if-needed", "to-satisfy-only"}
+
+    def __init__(
+        self,
+        preparer,  # type: RequirementPreparer
+        finder,  # type: PackageFinder
+        wheel_cache,  # type: Optional[WheelCache]
+        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, ...]]
+    ):
+        super(Resolver, self).__init__()
+        assert upgrade_strategy in self._allowed_strategies
+
+        self.factory = Factory(
+            finder=finder,
+            preparer=preparer,
+            make_install_req=make_install_req,
+            wheel_cache=wheel_cache,
+            use_user_site=use_user_site,
+            force_reinstall=force_reinstall,
+            ignore_installed=ignore_installed,
+            ignore_requires_python=ignore_requires_python,
+            py_version_info=py_version_info,
+        )
+        self.ignore_dependencies = ignore_dependencies
+        self.upgrade_strategy = upgrade_strategy
+        self._result = None  # type: Optional[Result]
+
+    def resolve(self, root_reqs, check_supported_wheels):
+        # type: (List[InstallRequirement], bool) -> RequirementSet
+
+        constraints = {}  # type: Dict[str, Constraint]
+        user_requested = set()  # type: Set[str]
+        requirements = []
+        for req in root_reqs:
+            if req.constraint:
+                # Ensure we only accept valid constraints
+                problem = check_invalid_constraint_type(req)
+                if problem:
+                    raise InstallationError(problem)
+                if not req.match_markers():
+                    continue
+                name = canonicalize_name(req.name)
+                if name in constraints:
+                    constraints[name] &= req
+                else:
+                    constraints[name] = Constraint.from_ireq(req)
+            else:
+                if req.user_supplied and req.name:
+                    user_requested.add(canonicalize_name(req.name))
+                r = self.factory.make_requirement_from_install_req(
+                    req, requested_extras=(),
+                )
+                if r is not None:
+                    requirements.append(r)
+
+        provider = PipProvider(
+            factory=self.factory,
+            constraints=constraints,
+            ignore_dependencies=self.ignore_dependencies,
+            upgrade_strategy=self.upgrade_strategy,
+            user_requested=user_requested,
+        )
+        if "PIP_RESOLVER_DEBUG" in os.environ:
+            reporter = PipDebuggingReporter()
+        else:
+            reporter = PipReporter()
+        resolver = RLResolver(provider, reporter)
+
+        try:
+            try_to_avoid_resolution_too_deep = 2000000
+            self._result = resolver.resolve(
+                requirements, max_rounds=try_to_avoid_resolution_too_deep,
+            )
+
+        except ResolutionImpossible as e:
+            error = self.factory.get_installation_error(e)
+            six.raise_from(error, e)
+
+        req_set = RequirementSet(check_supported_wheels=check_supported_wheels)
+        for candidate in self._result.mapping.values():
+            ireq = candidate.get_install_requirement()
+            if ireq is None:
+                continue
+
+            # Check if there is already an installation under the same name,
+            # and set a flag for later stages to uninstall it, if needed.
+            installed_dist = self.factory.get_dist_to_uninstall(candidate)
+            if installed_dist is None:
+                # There is no existing installation -- nothing to uninstall.
+                ireq.should_reinstall = False
+            elif self.factory.force_reinstall:
+                # The --force-reinstall flag is set -- reinstall.
+                ireq.should_reinstall = True
+            elif parse_version(installed_dist.version) != candidate.version:
+                # The installation is different in version -- reinstall.
+                ireq.should_reinstall = True
+            elif candidate.is_editable or dist_is_editable(installed_dist):
+                # The incoming distribution is editable, or different in
+                # editable-ness to installation -- reinstall.
+                ireq.should_reinstall = True
+            elif candidate.source_link.is_file:
+                # The incoming distribution is under file://
+                if candidate.source_link.is_wheel:
+                    # is a local wheel -- do nothing.
+                    logger.info(
+                        "%s is already installed with the same version as the "
+                        "provided wheel. Use --force-reinstall to force an "
+                        "installation of the wheel.",
+                        ireq.name,
+                    )
+                    continue
+
+                looks_like_sdist = (
+                    is_archive_file(candidate.source_link.file_path)
+                    and candidate.source_link.ext != ".zip"
+                )
+                if looks_like_sdist:
+                    # is a local sdist -- show a deprecation warning!
+                    reason = (
+                        "Source distribution is being reinstalled despite an "
+                        "installed package having the same name and version as "
+                        "the installed package."
+                    )
+                    replacement = "use --force-reinstall"
+                    deprecated(
+                        reason=reason,
+                        replacement=replacement,
+                        gone_in="21.1",
+                        issue=8711,
+                    )
+
+                # is a local sdist or path -- reinstall
+                ireq.should_reinstall = True
+            else:
+                continue
+
+            link = candidate.source_link
+            if link and link.is_yanked:
+                # The reason can contain non-ASCII characters, Unicode
+                # is required for Python 2.
+                msg = (
+                    u'The candidate selected for download or install is a '
+                    u'yanked version: {name!r} candidate (version {version} '
+                    u'at {link})\nReason for being yanked: {reason}'
+                ).format(
+                    name=candidate.name,
+                    version=candidate.version,
+                    link=link,
+                    reason=link.yanked_reason or u'<none given>',
+                )
+                logger.warning(msg)
+
+            req_set.add_named_requirement(ireq)
+
+        reqs = req_set.all_requirements
+        self.factory.preparer.prepare_linked_requirements_more(reqs)
+        return req_set
+
+    def get_installation_order(self, req_set):
+        # type: (RequirementSet) -> List[InstallRequirement]
+        """Get order for installation of requirements in RequirementSet.
+
+        The returned list contains a requirement before another that depends on
+        it. This helps ensure that the environment is kept consistent as they
+        get installed one-by-one.
+
+        The current implementation creates a topological ordering of the
+        dependency graph, while breaking any cycles in the graph at arbitrary
+        points. We make no guarantees about where the cycle would be broken,
+        other than they would be broken.
+        """
+        assert self._result is not None, "must call resolve() first"
+
+        graph = self._result.graph
+        weights = get_topological_weights(
+            graph,
+            expected_node_count=len(self._result.mapping) + 1,
+        )
+
+        sorted_items = sorted(
+            req_set.requirements.items(),
+            key=functools.partial(_req_set_item_sorter, weights=weights),
+            reverse=True,
+        )
+        return [ireq for _, ireq in sorted_items]
+
+
+def get_topological_weights(graph, expected_node_count):
+    # type: (Graph, int) -> Dict[Optional[str], int]
+    """Assign weights to each node based on how "deep" they are.
+
+    This implementation may change at any point in the future without prior
+    notice.
+
+    We take the length for the longest path to any node from root, ignoring any
+    paths that contain a single node twice (i.e. cycles). This is done through
+    a depth-first search through the graph, while keeping track of the path to
+    the node.
+
+    Cycles in the graph result would result in node being revisited while also
+    being it's own path. In this case, take no action. This helps ensure we
+    don't get stuck in a cycle.
+
+    When assigning weight, the longer path (i.e. larger length) is preferred.
+    """
+    path = set()  # type: Set[Optional[str]]
+    weights = {}  # type: Dict[Optional[str], int]
+
+    def visit(node):
+        # type: (Optional[str]) -> None
+        if node in path:
+            # We hit a cycle, so we'll break it here.
+            return
+
+        # Time to visit the children!
+        path.add(node)
+        for child in graph.iter_children(node):
+            visit(child)
+        path.remove(node)
+
+        last_known_parent_count = weights.get(node, 0)
+        weights[node] = max(last_known_parent_count, len(path))
+
+    # `None` is guaranteed to be the root node by resolvelib.
+    visit(None)
+
+    # Sanity checks
+    assert weights[None] == 0
+    assert len(weights) == expected_node_count
+
+    return weights
+
+
+def _req_set_item_sorter(
+    item,     # type: Tuple[str, InstallRequirement]
+    weights,  # type: Dict[Optional[str], int]
+):
+    # type: (...) -> Tuple[int, str]
+    """Key function used to sort install requirements for installation.
+
+    Based on the "weight" mapping calculated in ``get_installation_order()``.
+    The canonical package name is returned as the second member as a tie-
+    breaker to ensure the result is predictable, which is useful in tests.
+    """
+    name = canonicalize_name(item[0])
+    return weights[name], name
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py
new file mode 100644
index 0000000000000000000000000000000000000000..c2d166b1844f6c718009a39bce3552234aabce3f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/self_outdated_check.py
@@ -0,0 +1,197 @@
+from __future__ import absolute_import
+
+import datetime
+import hashlib
+import json
+import logging
+import os.path
+import sys
+
+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.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_distribution, get_installed_version
+from pip._internal.utils.packaging import get_installer
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    import optparse
+    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 _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):
+        # type: () -> str
+        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.
+    """
+    dist = get_distribution(pkg)
+    if not dist:
+        return False
+    return "pip" == get_installer(dist)
+
+
+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 = LinkCollector.create(
+                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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..28d2db19f3e716a03683cc84d4a3ae72757ec3a5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1b217f441cf56bb3e7d9ab8d735bcc873510e6ab
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/appdirs.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fc6bd3885d301d638d2bdcf0ca5d92c6e61287b3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..011aaed20b72a894ea508ddeaca7f5950e7f525a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/compatibility_tags.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e5f337cf61a437f94cc402386f3ce8368f17a3cf
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/datetime.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..590736bd95bad550c25b6e5a6a8220aeff72bfe0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/deprecation.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..85cd3a6a7459bf95be1ccd8c57bc8a31dcf7654d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/direct_url_helpers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e051e2e63bd1a3feee3a34aa25021a356f8223d4
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/distutils_args.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1058bd5fe0ae9cc1909f3244edc0dda345d1ed01
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/encoding.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5b358402ee93b37673dca4e7d206724d3f4faf17
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/entrypoints.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..44d6aae7793b6753c5415e3561fbd3753e1e4ab6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filesystem.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e86008a2000bc94aa294f1043eb6d6ae9bf21904
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/filetypes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c6048e9e102b70daec90f3e37c6d1fb8dd42922a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/glibc.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..922e0e26fba22a8f1727c89cbbc5840bb2cc0e54
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/hashes.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6a487ff96e8336fb927ee045b8e2e02791cb6de6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/inject_securetransport.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2a55de50dcae75464bba7e748185ff83074fc07c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/logging.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0c5ccdbb220ff056d5b05247b8e9fd65a059e7cd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/misc.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a64db945dac641f645c57f4be290fae20358fe33
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/models.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f317ce57e7ecc37ec288e89b69def55c751016ae
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/packaging.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fde4097351600146473139eb6002354e49ba674c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/parallel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..094a4daf6e74197c7cc2a1e574905992711ccc0c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/pkg_resources.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a57d117e7b49ba6f0f2754983adcaf07788200b6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/setuptools_build.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4a8b540e9377cdd33d2a17858c67da443c3002a6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/subprocess.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..81c7f85d904c8dd74187c32a2a612b4f25c76d2b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/temp_dir.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/typing.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/typing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..16a5099882e71320e4016188d3489584ccf7fc50
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/typing.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6649c93904131056196024d886c04e8ec1775671
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/unpacking.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..59ba1838a50215ede874c5d8267ea1e38173193d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/urls.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bd8cdc39ce1de16b881ac91d3ed00e14609fbac1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/virtualenv.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..aea0002ac9f7be75d8347813eb138c1498bb8426
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/appdirs.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/appdirs.py
new file mode 100644
index 0000000000000000000000000000000000000000..3989ed31c3a40a31fb2e24b6dd007e226f6393c3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/appdirs.py
@@ -0,0 +1,44 @@
+"""
+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
+    path = _appdirs.user_config_dir(appname, appauthor=False, roaming=roaming)
+    if _appdirs.system == "darwin" and not os.path.isdir(path):
+        path = os.path.expanduser('~/.config/')
+        if appname:
+            path = os.path.join(path, appname)
+    return path
+
+
+# for the discussion regarding site_config_dir locations
+# see <https://github.com/pypa/pip/issues/1733>
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compat.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..2196e6e0aea37743a702bd184f625c3d3e7f7ec5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compat.py
@@ -0,0 +1,293 @@
+"""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 functools
+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 Callable, Optional, Protocol, Text, Tuple, TypeVar, Union
+
+    # Used in the @lru_cache polyfill.
+    F = TypeVar('F')
+
+    class LruCache(Protocol):
+        def __call__(self, maxsize=None):
+            # type: (Optional[int]) -> Callable[[F], F]
+            raise NotImplementedError
+
+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(map(u"\\x{:x}".format, 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:
+        logger.warning(
+            '%s does not appear to be encoded as %s',
+            desc or 'Bytes object',
+            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(
+                "{} is a symlink; Will not return uid for symlinks".format(
+                    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 struct
+                import termios
+                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])
+
+
+# Fallback to noop_lru_cache in Python 2
+# TODO: this can be removed when python 2 support is dropped!
+def noop_lru_cache(maxsize=None):
+    # type: (Optional[int]) -> Callable[[F], F]
+    def _wrapper(f):
+        # type: (F) -> F
+        return f
+    return _wrapper
+
+
+lru_cache = getattr(functools, "lru_cache", noop_lru_cache)  # type: LruCache
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compatibility_tags.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compatibility_tags.py
new file mode 100644
index 0000000000000000000000000000000000000000..6780f9d9d64483eb05bbdbec897d2a78f6f59189
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/compatibility_tags.py
@@ -0,0 +1,178 @@
+"""Generate and work with PEP 425 Compatibility Tags.
+"""
+
+from __future__ import absolute_import
+
+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
+
+_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 _expand_allowed_platforms(platforms):
+    # type: (Optional[List[str]]) -> Optional[List[str]]
+    if not platforms:
+        return None
+
+    seen = set()
+    result = []
+
+    for p in platforms:
+        if p in seen:
+            continue
+        additions = [c for c in _get_custom_platforms(p) if c not in seen]
+        seen.update(additions)
+        result.extend(additions)
+
+    return result
+
+
+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]
+    platforms=None,  # type: Optional[List[str]]
+    impl=None,  # type: Optional[str]
+    abis=None  # type: Optional[List[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 a list of platforms 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 abis: specify a list of abis 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)
+
+    platforms = _expand_allowed_platforms(platforms)
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/datetime.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/datetime.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d0503c2f339b1d6e41bc7265f773f5ac7310baf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/datetime.py
@@ -0,0 +1,14 @@
+"""For when pip wants to check the date or time.
+"""
+
+from __future__ import absolute_import
+
+import datetime
+
+
+def today_is_later_than(year, month, day):
+    # type: (int, int, int) -> bool
+    today = datetime.date.today()
+    given = datetime.date(year, month, day)
+
+    return today > given
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/deprecation.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/deprecation.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f20cfd49d32f0bbab7b4719eb2dbdca971b751a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/deprecation.py
@@ -0,0 +1,104 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/direct_url_helpers.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/direct_url_helpers.py
new file mode 100644
index 0000000000000000000000000000000000000000..87bd61fa01f29e726d488828d3dd283252b4ff41
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/direct_url_helpers.py
@@ -0,0 +1,126 @@
+import logging
+
+from pip._internal.models.direct_url import (
+    DIRECT_URL_METADATA_NAME,
+    ArchiveInfo,
+    DirectUrl,
+    DirectUrlValidationError,
+    DirInfo,
+    VcsInfo,
+)
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+from pip._internal.vcs import vcs
+
+try:
+    from json import JSONDecodeError
+except ImportError:
+    # PY2
+    JSONDecodeError = ValueError  # type: ignore
+
+if MYPY_CHECK_RUNNING:
+    from typing import Optional
+
+    from pip._vendor.pkg_resources import Distribution
+
+    from pip._internal.models.link import Link
+
+logger = logging.getLogger(__name__)
+
+
+def direct_url_as_pep440_direct_reference(direct_url, name):
+    # type: (DirectUrl, str) -> str
+    """Convert a DirectUrl to a pip requirement string."""
+    direct_url.validate()  # if invalid, this is a pip bug
+    requirement = name + " @ "
+    fragments = []
+    if isinstance(direct_url.info, VcsInfo):
+        requirement += "{}+{}@{}".format(
+            direct_url.info.vcs, direct_url.url, direct_url.info.commit_id
+        )
+    elif isinstance(direct_url.info, ArchiveInfo):
+        requirement += direct_url.url
+        if direct_url.info.hash:
+            fragments.append(direct_url.info.hash)
+    else:
+        assert isinstance(direct_url.info, DirInfo)
+        requirement += direct_url.url
+    if direct_url.subdirectory:
+        fragments.append("subdirectory=" + direct_url.subdirectory)
+    if fragments:
+        requirement += "#" + "&".join(fragments)
+    return requirement
+
+
+def direct_url_from_link(link, source_dir=None, link_is_in_wheel_cache=False):
+    # type: (Link, Optional[str], bool) -> DirectUrl
+    if link.is_vcs:
+        vcs_backend = vcs.get_backend_for_scheme(link.scheme)
+        assert vcs_backend
+        url, requested_revision, _ = (
+            vcs_backend.get_url_rev_and_auth(link.url_without_fragment)
+        )
+        # For VCS links, we need to find out and add commit_id.
+        if link_is_in_wheel_cache:
+            # If the requested VCS link corresponds to a cached
+            # wheel, it means the requested revision was an
+            # immutable commit hash, otherwise it would not have
+            # been cached. In that case we don't have a source_dir
+            # with the VCS checkout.
+            assert requested_revision
+            commit_id = requested_revision
+        else:
+            # If the wheel was not in cache, it means we have
+            # had to checkout from VCS to build and we have a source_dir
+            # which we can inspect to find out the commit id.
+            assert source_dir
+            commit_id = vcs_backend.get_revision(source_dir)
+        return DirectUrl(
+            url=url,
+            info=VcsInfo(
+                vcs=vcs_backend.name,
+                commit_id=commit_id,
+                requested_revision=requested_revision,
+            ),
+            subdirectory=link.subdirectory_fragment,
+        )
+    elif link.is_existing_dir():
+        return DirectUrl(
+            url=link.url_without_fragment,
+            info=DirInfo(),
+            subdirectory=link.subdirectory_fragment,
+        )
+    else:
+        hash = None
+        hash_name = link.hash_name
+        if hash_name:
+            hash = "{}={}".format(hash_name, link.hash)
+        return DirectUrl(
+            url=link.url_without_fragment,
+            info=ArchiveInfo(hash=hash),
+            subdirectory=link.subdirectory_fragment,
+        )
+
+
+def dist_get_direct_url(dist):
+    # type: (Distribution) -> Optional[DirectUrl]
+    """Obtain a DirectUrl from a pkg_resource.Distribution.
+
+    Returns None if the distribution has no `direct_url.json` metadata,
+    or if `direct_url.json` is invalid.
+    """
+    if not dist.has_metadata(DIRECT_URL_METADATA_NAME):
+        return None
+    try:
+        return DirectUrl.from_json(dist.get_metadata(DIRECT_URL_METADATA_NAME))
+    except (
+        DirectUrlValidationError,
+        JSONDecodeError,
+        UnicodeDecodeError
+    ) as e:
+        logger.warning(
+            "Error parsing %s for %s: %s",
+            DIRECT_URL_METADATA_NAME,
+            dist.project_name,
+            e,
+        )
+        return None
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/distutils_args.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/distutils_args.py
new file mode 100644
index 0000000000000000000000000000000000000000..e38e402d7330778385f65a440b5b39f7bcbdedb3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/distutils_args.py
@@ -0,0 +1,48 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/encoding.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/encoding.py
new file mode 100644
index 0000000000000000000000000000000000000000..42a57535af8bd145bd1b0f81bdd09dd1bf9a24c4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/encoding.py
@@ -0,0 +1,41 @@
+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, Text, Tuple
+
+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):
+            result = ENCODING_RE.search(line)
+            assert result is not None
+            encoding = result.groups()[0].decode('ascii')
+            return data.decode(encoding)
+    return data.decode(
+        locale.getpreferredencoding(False) or sys.getdefaultencoding(),
+    )
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/entrypoints.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/entrypoints.py
new file mode 100644
index 0000000000000000000000000000000000000000..64d1cb2bd0b5debbcf13404ed97d271370cd60f9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/entrypoints.py
@@ -0,0 +1,31 @@
+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 List, Optional
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filesystem.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filesystem.py
new file mode 100644
index 0000000000000000000000000000000000000000..303243fd22f201fb4b22a1d206ac703ef5214392
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filesystem.py
@@ -0,0 +1,224 @@
+import errno
+import fnmatch
+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.misc import format_size
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING, cast
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, BinaryIO, Iterator, List, Union
+
+    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(
+                        "`{f}` is a socket".format(**locals()))
+
+        raise
+
+
+def is_socket(path):
+    # type: (str) -> bool
+    return stat.S_ISSOCK(os.lstat(path).st_mode)
+
+
+@contextmanager
+def adjacent_tmp_file(path, **kwargs):
+    # type: (str, **Any) -> Iterator[NamedTemporaryFileResult]
+    """Return a file-like object pointing to a tmp file next to path.
+
+    The file is created securely and is ensured to be written to disk
+    after the context reaches its end.
+
+    kwargs will be passed to tempfile.NamedTemporaryFile to control
+    the way the temporary file will be opened.
+    """
+    with NamedTemporaryFile(
+        delete=False,
+        dir=os.path.dirname(path),
+        prefix=os.path.basename(path),
+        suffix='.tmp',
+        **kwargs
+    ) 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 _ 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)
+        # Python 2 doesn't support FileExistsError and PermissionError.
+        except OSError as e:
+            # exception FileExistsError
+            if e.errno == errno.EEXIST:
+                continue
+            # exception PermissionError
+            if e.errno == errno.EPERM or e.errno == errno.EACCES:
+                # 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.
+                # This could as well be because the parent dir is not readable,
+                # due to non-privileged user access.
+                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'
+    )
+
+
+def find_files(path, pattern):
+    # type: (str, str) -> List[str]
+    """Returns a list of absolute paths of files beneath path, recursively,
+    with filenames which match the UNIX-style shell glob pattern."""
+    result = []  # type: List[str]
+    for root, _, files in os.walk(path):
+        matches = fnmatch.filter(files, pattern)
+        result.extend(os.path.join(root, f) for f in matches)
+    return result
+
+
+def file_size(path):
+    # type: (str) -> Union[int, float]
+    # If it's a symlink, return 0.
+    if os.path.islink(path):
+        return 0
+    return os.path.getsize(path)
+
+
+def format_file_size(path):
+    # type: (str) -> str
+    return format_size(file_size(path))
+
+
+def directory_size(path):
+    # type: (str) -> Union[int, float]
+    size = 0.0
+    for root, _dirs, files in os.walk(path):
+        for filename in files:
+            file_path = os.path.join(root, filename)
+            size += file_size(file_path)
+    return size
+
+
+def format_directory_size(path):
+    # type: (str) -> str
+    return format_size(directory_size(path))
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filetypes.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filetypes.py
new file mode 100644
index 0000000000000000000000000000000000000000..201c6ebbed845ca20e5e73df2ef63bdc5fa26160
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/filetypes.py
@@ -0,0 +1,26 @@
+"""Filetype information.
+"""
+from pip._internal.utils.misc import splitext
+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
+)
+
+
+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
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/glibc.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/glibc.py
new file mode 100644
index 0000000000000000000000000000000000000000..361042441384693dbeeb9424c78dedf3bdbb8a3d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/glibc.py
@@ -0,0 +1,98 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/hashes.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/hashes.py
new file mode 100644
index 0000000000000000000000000000000000000000..4d90f5bfda4ff3466b69016997268c70730572dd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/hashes.py
@@ -0,0 +1,169 @@
+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 BinaryIO, Dict, Iterator, List, NoReturn
+
+    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
+        """
+        allowed = {}
+        if hashes is not None:
+            for alg, keys in hashes.items():
+                # Make sure values are always sorted (to ease equality checks)
+                allowed[alg] = sorted(keys)
+        self._allowed = allowed
+
+    def __and__(self, other):
+        # type: (Hashes) -> Hashes
+        if not isinstance(other, Hashes):
+            return NotImplemented
+
+        # If either of the Hashes object is entirely empty (i.e. no hash
+        # specified at all), all hashes from the other object are allowed.
+        if not other:
+            return self
+        if not self:
+            return other
+
+        # Otherwise only hashes that present in both objects are allowed.
+        new = {}
+        for alg, values in iteritems(other._allowed):
+            if alg not in self._allowed:
+                continue
+            new[alg] = [v for v in values if v in self._allowed[alg]]
+        return Hashes(new)
+
+    @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: {}'.format(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__()
+
+    def __eq__(self, other):
+        # type: (object) -> bool
+        if not isinstance(other, Hashes):
+            return NotImplemented
+        return self._allowed == other._allowed
+
+    def __hash__(self):
+        # type: () -> int
+        return hash(
+            ",".join(sorted(
+                ":".join((alg, digest))
+                for alg, digest_list in self._allowed.items()
+                for digest in digest_list
+            ))
+        )
+
+
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/inject_securetransport.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/inject_securetransport.py
new file mode 100644
index 0000000000000000000000000000000000000000..5b93b1d6730518ec49afe78bdfbe74407825d8ee
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/inject_securetransport.py
@@ -0,0 +1,36 @@
+"""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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/logging.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/logging.py
new file mode 100644
index 0000000000000000000000000000000000000000..9a017cf7e333609f5f718177b7b40b21bfe1aed7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/logging.py
@@ -0,0 +1,399 @@
+# 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()
+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.
+    """
+    # For thread-safety
+    _log_state.indentation = get_indentation()
+    _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 = '{t},{record.msecs:03.0f} '.format(**locals())
+        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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/misc.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/misc.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8795ccf79d0e3fa36328681b41e78b38ce9969e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/misc.py
@@ -0,0 +1,977 @@
+# 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 itertools import tee
+
+from pip._vendor import pkg_resources
+from pip._vendor.packaging.utils import canonicalize_name
+
+# 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 filter, filterfalse, input, map, zip_longest
+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,
+        Callable,
+        Container,
+        Iterable,
+        Iterator,
+        List,
+        Optional,
+        Text,
+        Tuple,
+        TypeVar,
+        Union,
+    )
+
+    from pip._vendor.pkg_resources import Distribution
+
+    VersionInfo = Tuple[int, int, int]
+    T = TypeVar("T")
+
+
+__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 "{} -m pip".format(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: (AnyStr, 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: {}'.format(
+                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: '
+                '{}'.format(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'.format(bytes / 1000.0 / 1000)
+    elif bytes > 10 * 1000:
+        return '{} kB'.format(int(bytes / 1000))
+    elif bytes > 1000:
+        return '{:.1f} kB'.format(bytes / 1000.0)
+    else:
+        return '{} bytes'.format(int(bytes))
+
+
+def tabulate(rows):
+    # type: (Iterable[Iterable[Any]]) -> Tuple[List[str], List[int]]
+    """Return a list of formatted rows and a list of column sizes.
+
+    For example::
+
+    >>> tabulate([['foobar', 2000], [0xdeadbeef]])
+    (['foobar     2000', '3735928559'], [10, 4])
+    """
+    rows = [tuple(map(str, row)) for row in rows]
+    sizes = [max(map(len, col)) for col in zip_longest(*rows, fillvalue='')]
+    table = [" ".join(map(str.ljust, row, sizes)).rstrip() for row in rows]
+    return table, sizes
+
+
+def is_installable_dir(path):
+    # type: (str) -> bool
+    """Is path is a directory containing setup.py or pyproject.toml?
+    """
+    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)
+    # Hard-coded becouse PyPy uses a different sys.prefix on Debian
+    prefix = '/usr'
+
+    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.
+    """
+    return bool(egg_link_path(dist))
+
+
+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 _search_distribution(req_name):
+    # type: (str) -> Optional[Distribution]
+    """Find a distribution matching the ``req_name`` in the environment.
+
+    This searches from *all* distributions available in the environment, to
+    match the behavior of ``pkg_resources.get_distribution()``.
+    """
+    # Canonicalize the name before searching in the list of
+    # installed distributions and also while creating the package
+    # dictionary to get the Distribution object
+    req_name = canonicalize_name(req_name)
+    packages = get_installed_distributions(
+        local_only=False,
+        skip=(),
+        include_editables=True,
+        editables_only=False,
+        user_only=False,
+        paths=None,
+    )
+    pkg_dict = {canonicalize_name(p.key): p for p in packages}
+    return pkg_dict.get(req_name)
+
+
+def get_distribution(req_name):
+    # type: (str) -> Optional[Distribution]
+    """Given a requirement name, return the installed Distribution object.
+
+    This searches from *all* distributions available in the environment, to
+    match the behavior of ``pkg_resources.get_distribution()``.
+    """
+
+    # Search the distribution by looking through the working set
+    dist = _search_distribution(req_name)
+
+    # If distribution could not be found, call working_set.require
+    # to update the working set, and try to find the distribution
+    # again.
+    # This might happen for e.g. when you install a package
+    # twice, once using setup.py develop and again using setup.py install.
+    # Now when run pip uninstall twice, the package gets removed
+    # from the working set in the first uninstall, so we have to populate
+    # the working set again so that pip knows about it and the packages
+    # gets picked up and is successfully uninstalled the second time too.
+    if not dist:
+        try:
+            pkg_resources.working_set.require(req_name)
+        except pkg_resources.DistributionNotFound:
+            return None
+    return _search_distribution(req_name)
+
+
+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: (Any, Any) -> 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 = iter(lines)
+
+    def readline(self):
+        try:
+            return next(self._gen)
+        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')
+
+
+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 '<HiddenText {!r}>'.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: (Text, 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
+
+
+def pairwise(iterable):
+    # type: (Iterable[Any]) -> Iterator[Tuple[Any, Any]]
+    """
+    Return paired elements.
+
+    For example:
+        s -> (s0, s1), (s2, s3), (s4, s5), ...
+    """
+    iterable = iter(iterable)
+    return zip_longest(iterable, iterable)
+
+
+def partition(
+    pred,  # type: Callable[[T], bool]
+    iterable,  # type: Iterable[T]
+):
+    # type: (...) -> Tuple[Iterable[T], Iterable[T]]
+    """
+    Use a predicate to partition entries into false entries and true entries,
+    like
+
+        partition(is_odd, range(10)) --> 0 2 4 6 8   and  1 3 5 7 9
+    """
+    t1, t2 = tee(iterable)
+    return filterfalse(pred, t1), filter(pred, t2)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/models.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/models.py
new file mode 100644
index 0000000000000000000000000000000000000000..d1c2f22679661832831a88b13859fa29aaa2ed4d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/models.py
@@ -0,0 +1,44 @@
+"""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
+    """
+
+    __slots__ = ['_compare_key', '_defining_class']
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/packaging.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/packaging.py
new file mode 100644
index 0000000000000000000000000000000000000000..27fd204234fcc167217bc5ce3d94c82aad0cb0ba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/packaging.py
@@ -0,0 +1,95 @@
+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 email.message import Message
+    from typing import Optional, Tuple
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/parallel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/parallel.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4113bdc285dc6027d19bc74ac416b75d0402626
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/parallel.py
@@ -0,0 +1,107 @@
+"""Convenient parallelization of higher order functions.
+
+This module provides two helper functions, with appropriate fallbacks on
+Python 2 and on systems lacking support for synchronization mechanisms:
+
+- map_multiprocess
+- map_multithread
+
+These helpers work like Python 3's map, with two differences:
+
+- They don't guarantee the order of processing of
+  the elements of the iterable.
+- The underlying process/thread pools chop the iterable into
+  a number of chunks, so that for very long iterables using
+  a large value for chunksize can make the job complete much faster
+  than using the default value of 1.
+"""
+
+__all__ = ['map_multiprocess', 'map_multithread']
+
+from contextlib import contextmanager
+from multiprocessing import Pool as ProcessPool
+from multiprocessing.dummy import Pool as ThreadPool
+
+from pip._vendor.requests.adapters import DEFAULT_POOLSIZE
+from pip._vendor.six import PY2
+from pip._vendor.six.moves import map
+
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from multiprocessing import pool
+    from typing import Callable, Iterable, Iterator, TypeVar, Union
+
+    Pool = Union[pool.Pool, pool.ThreadPool]
+    S = TypeVar('S')
+    T = TypeVar('T')
+
+# On platforms without sem_open, multiprocessing[.dummy] Pool
+# cannot be created.
+try:
+    import multiprocessing.synchronize  # noqa
+except ImportError:
+    LACK_SEM_OPEN = True
+else:
+    LACK_SEM_OPEN = False
+
+# Incredibly large timeout to work around bpo-8296 on Python 2.
+TIMEOUT = 2000000
+
+
+@contextmanager
+def closing(pool):
+    # type: (Pool) -> Iterator[Pool]
+    """Return a context manager making sure the pool closes properly."""
+    try:
+        yield pool
+    finally:
+        # For Pool.imap*, close and join are needed
+        # for the returned iterator to begin yielding.
+        pool.close()
+        pool.join()
+        pool.terminate()
+
+
+def _map_fallback(func, iterable, chunksize=1):
+    # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]
+    """Make an iterator applying func to each element in iterable.
+
+    This function is the sequential fallback either on Python 2
+    where Pool.imap* doesn't react to KeyboardInterrupt
+    or when sem_open is unavailable.
+    """
+    return map(func, iterable)
+
+
+def _map_multiprocess(func, iterable, chunksize=1):
+    # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]
+    """Chop iterable into chunks and submit them to a process pool.
+
+    For very long iterables using a large value for chunksize can make
+    the job complete much faster than using the default value of 1.
+
+    Return an unordered iterator of the results.
+    """
+    with closing(ProcessPool()) as pool:
+        return pool.imap_unordered(func, iterable, chunksize)
+
+
+def _map_multithread(func, iterable, chunksize=1):
+    # type: (Callable[[S], T], Iterable[S], int) -> Iterator[T]
+    """Chop iterable into chunks and submit them to a thread pool.
+
+    For very long iterables using a large value for chunksize can make
+    the job complete much faster than using the default value of 1.
+
+    Return an unordered iterator of the results.
+    """
+    with closing(ThreadPool(DEFAULT_POOLSIZE)) as pool:
+        return pool.imap_unordered(func, iterable, chunksize)
+
+
+if LACK_SEM_OPEN or PY2:
+    map_multiprocess = map_multithread = _map_fallback
+else:
+    map_multiprocess = _map_multiprocess
+    map_multithread = _map_multithread
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/pkg_resources.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/pkg_resources.py
new file mode 100644
index 0000000000000000000000000000000000000000..0bc129acc6ab582eb087be7ee186c554dc5feba1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/pkg_resources.py
@@ -0,0 +1,44 @@
+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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/setuptools_build.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/setuptools_build.py
new file mode 100644
index 0000000000000000000000000000000000000000..2a664b00703768bca8034bb0b514caccfd6883ba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/setuptools_build.py
@@ -0,0 +1,181 @@
+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, no_user_config=no_user_config
+    )
+
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py
new file mode 100644
index 0000000000000000000000000000000000000000..3cd8b01f73efdf23d7e7e85c81e3ddcbaf79facb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/subprocess.py
@@ -0,0 +1,299 @@
+from __future__ import absolute_import
+
+import logging
+import os
+import subprocess
+
+from pip._vendor.six.moves import shlex_quote
+
+from pip._internal.cli.spinners import SpinnerInterface, open_spinner
+from pip._internal.exceptions import InstallationSubprocessError
+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
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, Callable, Iterable, List, Mapping, Optional, Text, Union
+
+    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]
+    stdout_only=False,  # 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.
+      stdout_only: if true, return only stdout, else return both. When true,
+        logging of both stdout and stderr occurs when the subprocess has
+        terminated, else logging occurs as subprocess output is produced.
+    """
+    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),
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.STDOUT if not stdout_only else subprocess.PIPE,
+            cwd=cwd,
+            env=env,
+        )
+    except Exception as exc:
+        if log_failed_cmd:
+            subprocess_logger.critical(
+                "Error %s while executing command %s", exc, command_desc,
+            )
+        raise
+    all_output = []
+    if not stdout_only:
+        assert proc.stdout
+        assert proc.stdin
+        proc.stdin.close()
+        # In this mode, stdout and stderr are in the same pipe.
+        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:
+                assert spinner
+                spinner.spin()
+        try:
+            proc.wait()
+        finally:
+            if proc.stdout:
+                proc.stdout.close()
+        output = ''.join(all_output)
+    else:
+        # In this mode, stdout and stderr are in different pipes.
+        # We must use communicate() which is the only safe way to read both.
+        out_bytes, err_bytes = proc.communicate()
+        # log line by line to preserve pip log indenting
+        out = console_to_str(out_bytes)
+        for out_line in out.splitlines():
+            log_subprocess(out_line)
+        all_output.append(out)
+        err = console_to_str(err_bytes)
+        for err_line in err.splitlines():
+            log_subprocess(err_line)
+        all_output.append(err)
+        output = out
+
+    proc_had_error = (
+        proc.returncode and proc.returncode not in extra_ok_returncodes
+    )
+    if use_spinner:
+        assert 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)
+            raise InstallationSubprocessError(proc.returncode, command_desc)
+        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={!r}'.format(
+                             on_returncode))
+    return 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py
new file mode 100644
index 0000000000000000000000000000000000000000..371958c9311a6bcc8bfbe78e251a09c3ce984959
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/temp_dir.py
@@ -0,0 +1,284 @@
+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._vendor.six import ensure_text
+
+from pip._internal.utils.compat import WINDOWS
+from pip._internal.utils.misc import enum, rmtree
+from pip._internal.utils.typing import MYPY_CHECK_RUNNING
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, Dict, Iterator, Optional, TypeVar, Union
+
+    _T = TypeVar('_T', bound='TempDirectory')
+
+
+logger = logging.getLogger(__name__)
+
+
+# Kinds of temporary directories. Only needed for ones that are
+# globally-managed.
+tempdir_kinds = enum(
+    BUILD_ENV="build-env",
+    EPHEM_WHEEL_CACHE="ephem-wheel-cache",
+    REQ_BUILD="req-build",
+)
+
+
+_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 _Default(object):
+    pass
+
+
+_default = _Default()
+
+
+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=_default,  # type: Union[bool, None, _Default]
+        kind="temp",  # type: str
+        globally_managed=False,  # type: bool
+    ):
+        super(TempDirectory, self).__init__()
+
+        if delete is _default:
+            if path is not None:
+                # If we were given an explicit directory, resolve delete option
+                # now.
+                delete = False
+            else:
+                # Otherwise, we wait until cleanup and see what
+                # tempdir_registry says.
+                delete = None
+
+        # The only time we specify path is in for editables where it
+        # is the value of the --src option.
+        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: %s", path)
+        return path
+
+    def cleanup(self):
+        # type: () -> None
+        """Remove the temporary directory created and reset state
+        """
+        self._deleted = True
+        if not os.path.exists(self._path):
+            return
+        # Make sure to pass unicode on Python 2 to make the contents also
+        # use unicode, ensuring non-ASCII names and can be represented.
+        # This is only done on Windows because POSIX platforms use bytes
+        # natively for paths, and the bytes-text conversion omission avoids
+        # errors caused by the environment configuring encodings incorrectly.
+        if WINDOWS:
+            rmtree(ensure_text(self._path))
+        else:
+            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: %s", path)
+        return path
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/typing.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/typing.py
new file mode 100644
index 0000000000000000000000000000000000000000..8505a29b15d5f8a3565a52796c4e39cc6b826ffc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/typing.py
@@ -0,0 +1,38 @@
+"""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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py
new file mode 100644
index 0000000000000000000000000000000000000000..620f31ebb745bf20d883ebb771acd0fe164ac79f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/unpacking.py
@@ -0,0 +1,281 @@
+"""Utilities related archives.
+"""
+
+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
+    from zipfile import ZipInfo
+
+
+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():
+    # type: () -> int
+    """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 set_extracted_file_to_default_mode_plus_executable(path):
+    # type: (Union[str, Text]) -> None
+    """
+    Make file present at path have execute for user/group/world
+    (chmod +x) is no-op on windows per python docs
+    """
+    os.chmod(path, (0o777 & ~current_umask() | 0o111))
+
+
+def zip_item_is_executable(info):
+    # type: (ZipInfo) -> bool
+    mode = info.external_attr >> 16
+    # if mode and regular file and any execute permissions for
+    # user/group/world?
+    return bool(mode and stat.S_ISREG(mode) and mode & 0o111)
+
+
+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()
+                    if zip_item_is_executable(info):
+                        set_extracted_file_to_default_mode_plus_executable(fn)
+    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))
+                assert fp is not None
+                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:
+                    set_extracted_file_to_default_mode_plus_executable(path)
+    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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/urls.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/urls.py
new file mode 100644
index 0000000000000000000000000000000000000000..f37bc8f90b2c0b6cb019f4d112d4ce6043ac672d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/urls.py
@@ -0,0 +1,55 @@
+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 {url!r})"
+        .format(**locals()))
+
+    _, 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: {url!r}'
+            .format(**locals())
+        )
+
+    path = urllib_request.url2pathname(netloc + path)
+    return path
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py
new file mode 100644
index 0000000000000000000000000000000000000000..4a7812873b3fd5daeed2581053a8fb76033995ed
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/virtualenv.py
@@ -0,0 +1,119 @@
+from __future__ import absolute_import
+
+import io
+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*(?P<value>true|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:
+        # Although PEP 405 does not specify, the built-in venv module always
+        # writes with UTF-8. (pypa/pip#8717)
+        with io.open(pyvenv_cfg_file, encoding='utf-8') 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.
+    """
+    # PEP 405 compliance needs to be checked first since virtualenv >=20 would
+    # return True for both checks, but is only able to use the PEP 405 config.
+    if _running_under_venv():
+        return _no_global_under_venv()
+
+    if _running_under_regular_virtualenv():
+        return _no_global_under_regular_virtualenv()
+
+    return False
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/wheel.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..9ce371c76eb1778024a6316ec34915256f4c3b0a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/utils/wheel.py
@@ -0,0 +1,225 @@
+"""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 = set(p.split("/", 1)[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 Wheel-Version ({}) is not compatible with this version "
+            "of pip".format(name, '.'.join(map(str, version)))
+        )
+    elif version > VERSION_COMPATIBLE:
+        logger.warning(
+            'Installing from a newer Wheel-Version (%s)',
+            '.'.join(map(str, version)),
+        )
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2a4eb1375763fa3287d171a2a1b0766d1d9d1224
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__init__.py
@@ -0,0 +1,15 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..310d80f4f613a64c4e8e030b3bf3d6068e7d2ebd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e9df606d3fa45c93f49cca42f0e42e5cfaad7362
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/bazaar.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c914e3aa1b9ef3211075616b70a9ec169da8f49d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/git.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f489f5e01172931cc95e420758da4410ffbbf00c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/mercurial.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9a1a5e3db9583fab26b4996a65ae8811fa57962b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/subversion.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4b5d3c0106542aad89157c9560c0ed51a8801aae
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/__pycache__/versioncontrol.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.py
new file mode 100644
index 0000000000000000000000000000000000000000..4a63d6faa5c42424c8adc535fbc06cb90e561485
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/bazaar.py
@@ -0,0 +1,123 @@
+# 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, stdout_only=True, 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, stdout_only=True, 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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/git.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/git.py
new file mode 100644
index 0000000000000000000000000000000000000000..4423a9182cac563f71be9b5b79a8baaa92ac1812
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/git.py
@@ -0,0 +1,460 @@
+# 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, InstallationError
+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, stdout_only=True
+        )
+        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,
+            stdout_only=True,
+            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,
+            stdout_only=True,
+            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 _should_fetch(cls, dest, rev):
+        """
+        Return true if rev is a ref or is a commit that we don't have locally.
+
+        Branches and tags are not considered in this method because they are
+        assumed to be always available locally (which is a normal outcome of
+        ``git clone`` and ``git fetch --tags``).
+        """
+        if rev.startswith("refs/"):
+            # Always fetch remote refs.
+            return True
+
+        if not looks_like_hash(rev):
+            # Git fetch would fail with abbreviated commits.
+            return False
+
+        if cls.has_commit(dest, rev):
+            # Don't fetch if we have the commit locally.
+            return False
+
+        return True
+
+    @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 cls._should_fetch(dest, rev):
+            return rev_options
+
+        # fetch the requested revision
+        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,
+            stdout_only=True,
+            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 has_commit(cls, location, rev):
+        """
+        Check if rev is a commit that is available in the local repository.
+        """
+        try:
+            cls.run_command(
+                ['rev-parse', '-q', '--verify', "sha^" + rev],
+                cwd=location,
+                log_failed_cmd=False,
+            )
+        except InstallationError:
+            return False
+        else:
+            return True
+
+    @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,
+            stdout_only=True,
+            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,
+            stdout_only=True,
+            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('/')
+            )
+            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 get_repository_root(cls, location):
+        loc = super(Git, cls).get_repository_root(location)
+        if loc:
+            return loc
+        try:
+            r = cls.run_command(
+                ['rev-parse', '--show-toplevel'],
+                cwd=location,
+                show_stdout=False,
+                stdout_only=True,
+                on_returncode='raise',
+                log_failed_cmd=False,
+            )
+        except BadCommand:
+            logger.debug("could not determine if %s is under git control "
+                         "because git is not available", location)
+            return None
+        except InstallationError:
+            return None
+        return os.path.normpath(r.rstrip('\r\n'))
+
+
+vcs.register(Git)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/mercurial.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/mercurial.py
new file mode 100644
index 0000000000000000000000000000000000000000..d2d145f623f79cbe6d49cf14e97ee8ebfa14aca5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/mercurial.py
@@ -0,0 +1,172 @@
+# 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,
+            stdout_only=True,
+            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,
+            stdout_only=True,
+            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,
+            stdout_only=True,
+            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, stdout_only=True, 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 get_repository_root(cls, location):
+        loc = super(Mercurial, cls).get_repository_root(location)
+        if loc:
+            return loc
+        try:
+            r = cls.run_command(
+                ['root'],
+                cwd=location,
+                show_stdout=False,
+                stdout_only=True,
+                on_returncode='raise',
+                log_failed_cmd=False,
+            )
+        except BadCommand:
+            logger.debug("could not determine if %s is under hg control "
+                         "because hg is not available", location)
+            return None
+        except InstallationError:
+            return None
+        return os.path.normpath(r.rstrip('\r\n'))
+
+
+vcs.register(Mercurial)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/subversion.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/subversion.py
new file mode 100644
index 0000000000000000000000000000000000000000..701f41db4b2e7fef92165636c322a920ecc25dbd
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/subversion.py
@@ -0,0 +1,340 @@
+# 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'<url>(.*)</url>')
+
+
+if MYPY_CHECK_RUNNING:
+    from typing import Optional, Tuple
+
+    from pip._internal.utils.misc import HiddenText
+    from pip._internal.utils.subprocess import CommandArgs
+    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, _ 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('<?xml'):
+            match = _svn_xml_url_re.search(data)
+            if not match:
+                raise ValueError(
+                    'Badly formatted data: {data!r}'.format(**locals()))
+            url = match.group(1)    # get repository URL
+            revs = [int(m.group(1)) for m in _svn_rev_re.finditer(data)] + [0]
+        else:
+            try:
+                # subversion >= 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,
+                    stdout_only=True,
+                )
+                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
+        #   svn, version 1.12.0-SlikSvn (SlikSvn/1.12.0)
+        #      compiled May 28 2019, 13:44:56 on x86_64-microsoft-windows6.2
+        version_prefix = 'svn, version '
+        version = self.run_command(
+            ['--version'], show_stdout=False, stdout_only=True
+        )
+        if not version.startswith(version_prefix):
+            return ()
+
+        version = version[len(version_prefix):].split()[0]
+        version_list = version.partition('-')[0].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/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py
new file mode 100644
index 0000000000000000000000000000000000000000..0e807a2fb06059e0516227bd015b5754c4eec3cf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/vcs/versioncontrol.py
@@ -0,0 +1,735 @@
+"""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, InstallationError
+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.cli.spinners 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 '<RevOptions {}: rev={!r}>'.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.
+        """
+        vcs_backends = {}
+        for vcs_backend in self._registry.values():
+            repo_path = vcs_backend.get_repository_root(location)
+            if not repo_path:
+                continue
+            logger.debug('Determine that %s uses VCS: %s',
+                         location, vcs_backend.name)
+            vcs_backends[repo_path] = vcs_backend
+
+        if not vcs_backends:
+            return None
+
+        # Choose the VCS in the inner-most directory. Since all repository
+        # roots found here would be either `location` or one of its
+        # parents, the longest path should have the most path components,
+        # i.e. the backend representing the inner-most repository.
+        inner_most_repo_path = max(vcs_backends, key=len)
+        return vcs_backends[inner_most_repo_path]
+
+    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 <vcs>+<protocol>://<url>, "
+                "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)
+            if not rev:
+                raise InstallationError(
+                    "The URL {!r} has an empty revision (after @) "
+                    "which is not supported. Include a revision after @ "
+                    "or remove @ from the URL.".format(url)
+                )
+        url = urllib_parse.urlunsplit((scheme, netloc, path, query, ''))
+        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?  {}'.format(
+            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
+        stdout_only=False,  # 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,
+                                   stdout_only=stdout_only)
+        except OSError as e:
+            # errno.ENOENT = no such file or directory
+            # In other words, the VCS executable isn't available
+            if e.errno == errno.ENOENT:
+                raise BadCommand(
+                    'Cannot find command {cls.name!r} - do you have '
+                    '{cls.name!r} installed and in your '
+                    'PATH?'.format(**locals()))
+            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 get_repository_root(cls, location):
+        # type: (str) -> Optional[str]
+        """
+        Return the "root" (top-level) directory controlled by the vcs,
+        or `None` if the directory is not in any.
+
+        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.
+        """
+        if cls.is_repository_directory(location):
+            return location
+        return None
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_internal/wheel_builder.py b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/wheel_builder.py
new file mode 100644
index 0000000000000000000000000000000000000000..f7e15afbcab5507f577b54ef6b2c2307fe133133
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_internal/wheel_builder.py
@@ -0,0 +1,363 @@
+"""Orchestrator for building wheels from InstallRequirements.
+"""
+
+import logging
+import os.path
+import re
+import shutil
+import zipfile
+
+from pip._vendor.packaging.utils import canonicalize_name, canonicalize_version
+from pip._vendor.packaging.version import InvalidVersion, Version
+from pip._vendor.packaging.version import parse as parse_version
+from pip._vendor.pkg_resources import Distribution
+
+from pip._internal.exceptions import InvalidWheelFilename, UnsupportedWheel
+from pip._internal.models.link import Link
+from pip._internal.models.wheel import Wheel
+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.utils.wheel import pkg_resources_distribution_for_wheel
+from pip._internal.vcs import vcs
+
+if MYPY_CHECK_RUNNING:
+    from typing import Any, Callable, Iterable, List, Optional, 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__)
+
+_egg_info_re = re.compile(r'([a-z0-9_.]+)-([a-z0-9_.!+-]+)', re.IGNORECASE)
+
+
+def _contains_egg_info(s):
+    # type: (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 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
+
+    if not req.use_pep517 and not is_wheel_installed():
+        # we don't build legacy requirements if wheel is not installed
+        logger.info(
+            "Using legacy 'setup.py install' for %s, "
+            "since package 'wheel' is not installed.", req.name,
+        )
+        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 req.editable or not req.source_dir:
+        # never cache editable requirements
+        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
+
+    assert req.link
+    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)
+    assert req.link
+    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 _get_metadata_version(dist):
+    # type: (Distribution) -> Optional[Version]
+    for line in dist.get_metadata_lines(dist.PKG_INFO):
+        if line.lower().startswith("metadata-version:"):
+            value = line.split(":", 1)[-1].strip()
+            try:
+                return Version(value)
+            except InvalidVersion:
+                msg = "Invalid Metadata-Version: {}".format(value)
+                raise UnsupportedWheel(msg)
+    raise UnsupportedWheel("Missing Metadata-Version")
+
+
+def _verify_one(req, wheel_path):
+    # type: (InstallRequirement, str) -> None
+    canonical_name = canonicalize_name(req.name)
+    w = Wheel(os.path.basename(wheel_path))
+    if canonicalize_name(w.name) != canonical_name:
+        raise InvalidWheelFilename(
+            "Wheel has unexpected file name: expected {!r}, "
+            "got {!r}".format(canonical_name, w.name),
+        )
+    with zipfile.ZipFile(wheel_path, allowZip64=True) as zf:
+        dist = pkg_resources_distribution_for_wheel(
+            zf, canonical_name, wheel_path,
+        )
+    if canonicalize_version(dist.version) != canonicalize_version(w.version):
+        raise InvalidWheelFilename(
+            "Wheel has unexpected file name: expected {!r}, "
+            "got {!r}".format(dist.version, w.version),
+        )
+    if (_get_metadata_version(dist) >= Version("1.2")
+            and not isinstance(parse_version(dist.version), Version)):
+        raise UnsupportedWheel(
+            "Metadata 1.2 mandates PEP 440 version, "
+            "but {!r} is not".format(dist.version)
+        )
+
+
+def _build_one(
+    req,  # type: InstallRequirement
+    output_dir,  # type: str
+    verify,  # type: bool
+    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:
+        wheel_path = _build_one_inside_env(
+            req, output_dir, build_options, global_options
+        )
+    if wheel_path and verify:
+        try:
+            _verify_one(req, wheel_path)
+        except (InvalidWheelFilename, UnsupportedWheel) as e:
+            logger.warning("Built wheel for %s is invalid: %s", req.name, e)
+            return None
+    return wheel_path
+
+
+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:
+        assert req.name
+        if req.use_pep517:
+            assert req.metadata_directory
+            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
+    verify,  # type: bool
+    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),  # type: ignore
+    )
+
+    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, verify, 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]),  # type: ignore
+        )
+    if build_failures:
+        logger.info(
+            'Failed to build %s',
+            ' '.join([req.name for req in build_failures]),  # type: ignore
+        )
+    # Return a list of requirements that failed to build
+    return build_successes, build_failures
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d4e20fedd922fbdcee6603ea297d991d2c8071d1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__init__.py
@@ -0,0 +1,123 @@
+"""
+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[:] = [fn for fn in glob.iglob(os.path.join(WHEEL_DIR, '*.whl'))
+         if not (os.path.basename(fn).startswith('wheel') or
+             os.path.basename(fn).startswith('pip'))] + sys.path
+
+    # Actually alias all of our vendored dependencies.
+    vendored("appdirs")
+    vendored("cachecontrol")
+    vendored("certifi")
+    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("resolvelib")
+    vendored("toml")
+    vendored("toml.encoder")
+    vendored("toml.decoder")
+    vendored("urllib3")
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b8e9d66893717ace006231be8b05d1f6547785dc
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/vendor.txt b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/vendor.txt
new file mode 100644
index 0000000000000000000000000000000000000000..712fb77d46b1b2a66a23c220c198679f5d2d325c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pip/_vendor/vendor.txt
@@ -0,0 +1,24 @@
+appdirs==1.4.4
+CacheControl==0.12.6
+colorama==0.4.4
+contextlib2==0.6.0.post1
+distlib==0.3.1
+distro==1.5.0
+html5lib==1.1
+ipaddress==1.0.23  # Only needed on 2.6 and 2.7
+msgpack==1.0.0
+packaging==20.8
+pep517==0.9.1
+progress==1.5
+pyparsing==2.4.7
+requests==2.25.0
+    certifi==2020.11.08
+    chardet==3.0.4
+    idna==2.10
+    urllib3==1.26.2
+resolvelib==0.5.4
+retrying==1.3.3
+setuptools==44.0.0
+six==1.15.0
+toml==0.10.2
+webencodings==0.5.1
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0360f988f2b533c1d9acd1563018f2bcee8a85b4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/AUTHORS.txt
@@ -0,0 +1,590 @@
+@Switch01
+A_Rog
+Aakanksha Agrawal
+Abhinav Sagar
+ABHYUDAY PRATAP SINGH
+abs51295
+AceGentile
+Adam Chainz
+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
+Alli
+Ami Fischman
+Ananya Maiti
+Anatoly Techtonik
+Anders Kaseorg
+Andre Aguiar
+Andreas Lutro
+Andrei Geacar
+Andrew Gaul
+Andrey Bulgakov
+Andrés Delfino
+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
+Anudit Nagar
+Anuj Godase
+AQNOUCH Mohammed
+AraHaan
+Arindam Choudhury
+Armin Ronacher
+Artem
+Ashley Manton
+Ashwin Ramaswami
+atse
+Atsushi Odagiri
+Avinash Karhana
+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
+Bernard
+Bernard Tyers
+Bernardo B. Marques
+Bernhard M. Wiedemann
+Bertil Hatt
+Bhavam Vidyarthi
+Bogdan Opanchuk
+BorisZZZ
+Brad Erickson
+Bradley Ayers
+Brandon L. Reiss
+Brandt Bucher
+Brett Randall
+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
+Chris Brinker
+Chris Hunt
+Chris Jerdonek
+Chris McDonough
+Chris Wolfe
+Christian Clauss
+Christian Heimes
+Christian Oudard
+Christoph Reiter
+Christopher Hunt
+Christopher Snyder
+cjc7373
+Clark Boylan
+Clay McClure
+Cody
+Cody Soyland
+Colin Watson
+Connor Osborn
+Cooper Lees
+Cooper Ry Lees
+Cory Benfield
+Cory Wright
+Craig Kerstiens
+Cristian Sorinel
+Cristina
+Cristina Muñoz
+Curtis Doty
+cytolentino
+Damian Quiroga
+Dan Black
+Dan Savilonis
+Dan Sully
+daniel
+Daniel Collins
+Daniel Hahler
+Daniel Holth
+Daniel Jost
+Daniel Katz
+Daniel Shaulov
+Daniele Esposti
+Daniele Procida
+Danny Hermes
+Danny McClanahan
+Dav Clark
+Dave Abrahams
+Dave Jones
+David Aguilar
+David Black
+David Bordeynik
+David Caro
+David Evans
+David Linke
+David Poggi
+David Pursehouse
+David Tucker
+David Wales
+Davidovich
+Deepak Sharma
+derwolfe
+Desetude
+Devesh Kumar Singh
+Diego Caraballo
+DiegoCaraballo
+Dmitry Gladkov
+Domen Kožar
+Donald Stufft
+Dongweiming
+Douglas Thor
+DrFeathers
+Dustin Ingram
+Dwayne Bailey
+Ed Morley
+Eitan Adler
+ekristina
+elainechan
+Eli Schwartz
+Elisha Hollander
+Ellen Marie Dash
+Emil Burzo
+Emil Styrke
+Emmanuel Arias
+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
+Filipe Laíns
+Florian Briand
+Florian Rathgeber
+Francesco
+Francesco Montesano
+Frost Ming
+Gabriel Curio
+Gabriel de Perthuis
+Garry Polley
+gdanielson
+Geoffrey Sneddon
+George Song
+Georgi Valkov
+ghost
+Giftlin Rajaiah
+gizmoguy1
+gkdoc
+Gopinath M
+GOTO Hayato
+gpiks
+Greg Ward
+Guilherme Espada
+gutsytechster
+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
+Igor Kuzmitshov
+Igor Sobreira
+Ilan Schnell
+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 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 T. Wodder II
+John-Scott Atlakson
+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
+Jussi Kukkonen
+jwg4
+Jyrki Pulliainen
+Kai Chen
+Kamal Bin Mustafa
+kaustav haldar
+keanemind
+Keith Maxwell
+Kelsey Hightower
+Kenneth Belitzky
+Kenneth Reitz
+Kevin Burke
+Kevin Carter
+Kevin Frommelt
+Kevin R Patterson
+Kexuan Sun
+Kit Randel
+KOLANICH
+kpinc
+Krishna Oza
+Kumar McMillan
+Kyle Persohn
+lakshmanaram
+Laszlo Kiss-Kollar
+Laurent Bristiel
+Laurie O
+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
+Marc Abramowitz
+Marc Tamlyn
+Marcus Smith
+Mariatta
+Mark Kohler
+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
+mdebi
+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
+Nguyễn Gia Phong
+Nick Coghlan
+Nick Stenning
+Nick Timkovich
+Nicolas Bock
+Nicole Harris
+Nikhil Benesch
+Nikolay Korolev
+Nitesh Sharma
+Noah
+Noah Gorny
+Nowell Strite
+NtaleGrey
+nvdv
+Ofekmeister
+ofrinevo
+Oliver Jeeves
+Oliver Mannion
+Oliver Tonnhofer
+Olivier Girardot
+Olivier Grisel
+Ollie Rutherfurd
+OMOTO Kenji
+Omry Yadan
+onlinejudge95
+Oren Held
+Oscar Benjamin
+Oz N Tiram
+Pachwenko
+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
+Pawel Jasinski
+Pekka Klärck
+Peter Lisák
+Peter Waller
+petr-tik
+Phaneendra Chiruvella
+Phil Elson
+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
+Prashant Sharma
+Pratik Mallya
+Preet Thakkar
+Preston Holmes
+Przemek Wrzos
+Pulkit Goyal
+Qiangning Hong
+Quentin Pradet
+R. David Murray
+Rafael Caricio
+Ralf Schmitt
+Razzi Abuissa
+rdb
+Reece Dunham
+Remi Rampin
+Rene Dudfield
+Riccardo Magliocchetti
+Richard Jones
+Ricky Ng-Adam
+RobberPhex
+Robert Collins
+Robert McGibbon
+Robert T. McGibbon
+robin elisha robinson
+Roey Berman
+Rohan Jain
+Roman Bogorodskiy
+Romuald Brunet
+Ronny Pfannschmidt
+Rory McCann
+Ross Brattain
+Roy Wellington Ⅳ
+Ruairidh MacLeod
+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
+shireenrao
+Shlomi Fish
+Shovan Maity
+Simeon Visser
+Simon Cross
+Simon Pichugin
+sinoroc
+sinscary
+socketubs
+Sorin Sbarnea
+Srinivas Nyayapati
+Stavros Korokithakis
+Stefan Scherfke
+Stefano Rivera
+Stephan Erb
+stepshal
+Steve (Gadget) Barnes
+Steve Barnes
+Steve Dower
+Steve Kowalik
+Steven Myint
+stonebig
+Stéphane Bidoul
+Stéphane Bidoul (ACSONE)
+Stéphane Klein
+Sumana Harihareswara
+Surbhi Sharma
+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 Hrnciar
+Tomas Orsava
+Tomer Chachamu
+Tony Beswick
+Tony Zhaocheng Tan
+TonyBeswick
+toonarmycaptain
+Toshio Kuratomi
+toxinu
+Travis Swicegood
+Tzu-ping Chung
+Valentin Haenel
+Victor Stinner
+victorvpaulo
+Vikram - Google
+Viktor Szépe
+Ville Skyttä
+Vinay Sajip
+Vincent Philippon
+Vinicyus Macedo
+Vipul Kumar
+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
+xoviat
+xtreak
+YAMAMOTO Takashi
+Yen Chi Hsuan
+Yeray Diaz Diaz
+Yoval P
+Yu Jian
+Yuan Jing Vincent Yan
+Zearin
+Zhiping Deng
+Zvezdan Petkovic
+Łukasz Langa
+Семён Марьясин
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..75eb0fd80b08c55e9dac4cc6ff6557ca4892eed0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2020 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..cf6c9302c5b0495077d258b68c77e2fe11f90f8f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/METADATA
@@ -0,0 +1,13 @@
+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/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..2cc7da9cdbf7d883c77519f970557965567acee1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/RECORD
@@ -0,0 +1,39 @@
+pkg_resources-0.0.0.dist-info/AUTHORS.txt,sha256=ilkpJ4nuW3rRgU3fX4EufclaM4Y7RsZu5uOu0oizmNM,8036
+pkg_resources-0.0.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+pkg_resources-0.0.0.dist-info/LICENSE.txt,sha256=gdAS_gPyTUkBTvvgoNNlG9Mv1KFDTig6W1JdeMD2Efg,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/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+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-39.pyc,,
+pkg_resources/__pycache__/py31compat.cpython-39.pyc,,
+pkg_resources/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+pkg_resources/_vendor/__pycache__/__init__.cpython-39.pyc,,
+pkg_resources/_vendor/__pycache__/appdirs.cpython-39.pyc,,
+pkg_resources/_vendor/__pycache__/pyparsing.cpython-39.pyc,,
+pkg_resources/_vendor/__pycache__/six.cpython-39.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-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/markers.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/utils.cpython-39.pyc,,
+pkg_resources/_vendor/packaging/__pycache__/version.cpython-39.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-39.pyc,,
+pkg_resources/py31compat.py,sha256=-WQ0e4c3RG_acdhwC3gLiXhP_lg4G5q7XYkZkQg0gxU,558
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/REQUESTED b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ef99c6cf3283b50a273ac4c6d009a0aa85597070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources-0.0.0.dist-info/WHEEL
@@ -0,0 +1,6 @@
+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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..2f5aa64a6e10832f407601d668e4ef0d9d5d0aeb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__init__.py
@@ -0,0 +1,3296 @@
+# 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<name>[^-]+) (
+        -(?P<ver>[^-]+) (
+            -py(?P<pyver>[^-]+) (
+                -(?P<plat>.+)
+            )?
+        )?
+    )?
+    """,
+    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<name>.+?)\s*'
+        r'=\s*'
+        r'(?P<module>[\w.]+)\s*'
+        r'(:\s*(?P<attr>[\w.]+))?\s*'
+        r'(?P<extras>\[.*\])?\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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0f22418d384a41a38d7eb254d83cdf3ae6bbb2b9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/py31compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/py31compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a8e5f1b1e6c12c6fa206b96f005a2ab747f4d466
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/__pycache__/py31compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7878f227445c39c1b58f1bf020df6da4abac4fab
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..64ce259f65fc9b4c6de7ec50dc1d40e4e2c5b457
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/appdirs.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..03d9559d3fa82b90f9327ca66404522417c0fe3d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/pyparsing.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f3f5567afaa8ba5634c00313ca0e341be2afacb1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/__pycache__/six.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/appdirs.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/appdirs.py
new file mode 100644
index 0000000000000000000000000000000000000000..ae67001af8b661373edeee2eb327b9f63e630d62
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/appdirs.py
@@ -0,0 +1,608 @@
+#!/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 <http://github.com/ActiveState/appdirs> 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 "<major>.<minor>".
+            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
+            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
+            for a discussion of issues.
+
+    Typical user data directories are:
+        Mac OS X:               ~/Library/Application Support/<AppName>
+        Unix:                   ~/.local/share/<AppName>    # or in $XDG_DATA_HOME, if defined
+        Win XP (not roaming):   C:\Documents and Settings\<username>\Application Data\<AppAuthor>\<AppName>
+        Win XP (roaming):       C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>
+        Win 7  (not roaming):   C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>
+        Win 7  (roaming):       C:\Users\<username>\AppData\Roaming\<AppAuthor>\<AppName>
+
+    For Unix, we follow the XDG spec and support $XDG_DATA_HOME.
+    That means, by default "~/.local/share/<AppName>".
+    """
+    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 "<major>.<minor>".
+            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/<AppName>',
+            if XDG_DATA_DIRS is not set
+
+    Typical site data directories are:
+        Mac OS X:   /Library/Application Support/<AppName>
+        Unix:       /usr/local/share/<AppName> or /usr/share/<AppName>
+        Win XP:     C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName>
+        Vista:      (Fail! "C:\ProgramData" is a hidden *system* directory on Vista.)
+        Win 7:      C:\ProgramData\<AppAuthor>\<AppName>   # 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 "<major>.<minor>".
+            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
+            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
+            for a discussion of issues.
+
+    Typical user config directories are:
+        Mac OS X:               same as user_data_dir
+        Unix:                   ~/.config/<AppName>     # 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/<AppName>".
+    """
+    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 "<major>.<minor>".
+            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/<AppName>', if XDG_CONFIG_DIRS is not set
+
+    Typical site config directories are:
+        Mac OS X:   same as site_data_dir
+        Unix:       /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> 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 "<major>.<minor>".
+            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/<AppName>
+        Unix:       ~/.cache/<AppName> (XDG default)
+        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Cache
+        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\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\<ProfileName>\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 "<major>.<minor>".
+            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
+            <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx>
+            for a discussion of issues.
+
+    Typical user state directories are:
+        Mac OS X:  same as user_data_dir
+        Unix:      ~/.local/state/<AppName>   # or in $XDG_STATE_HOME, if defined
+        Win *:     same as user_data_dir
+
+    For Unix, we follow this Debian proposal <https://wiki.debian.org/XDGBaseDirectorySpecification#state>
+    to extend the XDG spec and support $XDG_STATE_HOME.
+
+    That means, by default "~/.local/state/<AppName>".
+    """
+    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 "<major>.<minor>".
+            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/<AppName>
+        Unix:       ~/.cache/<AppName>/log  # or under $XDG_CACHE_HOME if defined
+        Win XP:     C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs
+        Vista:      C:\Users\<username>\AppData\Local\<AppAuthor>\<AppName>\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
+        # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
+        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
+    # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
+    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
+    # <http://bugs.activestate.com/show_bug.cgi?id=85099>.
+    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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__about__.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__about__.py
new file mode 100644
index 0000000000000000000000000000000000000000..95d330ef823aa2e12f7846bc63c0955b25df6029
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__about__.py
@@ -0,0 +1,21 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..5ee6220203e5425f900fb5a43676c24ea377c2fa
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__init__.py
@@ -0,0 +1,14 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..452713802a1b799f3b4be9392b93bb73742c5ad0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b30dbd886f5fd1a73c8aeebec7c3788d8ece58aa
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3054da53126110515c88f3ab0ea420f47f31ae9a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a208c14867f1e0f628324a032ee3ae9b73fa0148
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2d1fb3cdcb5f0941567bad3b0fc0b37ec6f4057a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/markers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9c19d54df0a13f69ffa2459a4cbcbc2f888e9fb7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..58bce146ba076b3c70eb27d3dbe65e33d3089a64
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c9e5da4bf668b774a46e77e337cbca15c82d82ef
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b57db93db4b2c7a23b3808e16b6a910c74d3a90b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/__pycache__/version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_compat.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..210bb80b7e7b64cb79f7e7cdf3e42819fe3471fe
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_compat.py
@@ -0,0 +1,30 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_structures.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_structures.py
new file mode 100644
index 0000000000000000000000000000000000000000..ccc27861c3a4d9efaa3db753c77c4515a627bd98
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/_structures.py
@@ -0,0 +1,68 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py
new file mode 100644
index 0000000000000000000000000000000000000000..892e578edd4b992cc2996c31d9deb13af73d62c0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/markers.py
@@ -0,0 +1,301 @@
+# 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 "<Marker({0!r})>".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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py
new file mode 100644
index 0000000000000000000000000000000000000000..0c8c4a3852fd37053fd552846aa7787805c30a48
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/requirements.py
@@ -0,0 +1,127 @@
+# 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 "<Requirement({0!r})>".format(str(self))
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f5a76cfd63f47dcce29b3ea82f59d10f4e8d771
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/specifiers.py
@@ -0,0 +1,774 @@
+# 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<operator>(==|!=|<=|>=|<|>))
+        \s*
+        (?P<version>
+            [^,;\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<operator>(~=|==|!=|<=|>=|<|>|===))
+        (?P<version>
+            (?:
+                # 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.
+                (?<!==|!=|~=)         # We have special cases for these
+                                      # operators so we want to make sure they
+                                      # don't match here.
+
+                \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]*)
+                )?
+                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
+            )
+        )
+        """
+    )
+
+    _regex = re.compile(
+        r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
+
+    _operators = {
+        "~=": "compatible",
+        "==": "equal",
+        "!=": "not_equal",
+        "<=": "less_than_equal",
+        ">=": "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 "<SpecifierSet({0!r}{1})>".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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/utils.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..942387cef5d75f299a769b1eb43b6c7679e7a3a0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/utils.py
@@ -0,0 +1,14 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..83b5ee8c5efadf22ce2f16ff08c8a8d75f1eb5df
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/packaging/version.py
@@ -0,0 +1,393 @@
+# 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 "<LegacyVersion({0})>".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<epoch>[0-9]+)!)?                           # epoch
+        (?P<release>[0-9]+(?:\.[0-9]+)*)                  # release segment
+        (?P<pre>                                          # pre-release
+            [-_\.]?
+            (?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
+            [-_\.]?
+            (?P<pre_n>[0-9]+)?
+        )?
+        (?P<post>                                         # post release
+            (?:-(?P<post_n1>[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?P<post_l>post|rev|r)
+                [-_\.]?
+                (?P<post_n2>[0-9]+)?
+            )
+        )?
+        (?P<dev>                                          # dev release
+            [-_\.]?
+            (?P<dev_l>dev)
+            [-_\.]?
+            (?P<dev_n>[0-9]+)?
+        )?
+    )
+    (?:\+(?P<local>[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 "<Version({0})>".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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf75e1e5fcbfe7eac41d2a9e446c5c980741087b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/pyparsing.py
@@ -0,0 +1,5742 @@
+# 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{"<salutation>, <addressee>!"}), built up using L{Word}, L{Literal}, and L{And} elements 
+(L{'+'<ParserElement.__add__>} 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<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{'+'<And>}, L{'|'<MatchFirst>}, L{'^'<Or>}, and L{'&'<Each>} 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 <ptmcg@users.sourceforge.net>"
+
+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<And._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.<resultsName>} - 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) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
+            
+            # Use asList() to create an actual list
+            result_list = result.asList()
+            print(type(result_list), result_list) # -> <class '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)) # -> <class 'pyparsing.ParseResults'> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
+            
+            result_dict = result.asDict()
+            print(type(result_dict), repr(result_dict)) # -> <class '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,
+                                                "</", resTag, ">" ]
+
+        out += [ nl, indent, "</", selfTag, ">" ]
+        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}<ParserElement.parseString>} for more information
+   on parsing strings containing C{<TAB>}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<loc<len(s) and s[loc-1] == '\n' else loc - s.rfind("\n", 0, loc)
+
+def lineno(loc,strg):
+    """Returns current line number within a string, counting newlines as line separators.
+   The first line 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}<ParserElement.parseString>} for more information
+   on parsing strings containing C{<TAB>}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 = "<parse action>"
+    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, <TAB> 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 = "<unknown>"  # 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}<parseString>} for more information
+        on parsing strings containing C{<TAB>}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}<setParseAction>}.
+        
+        See examples in L{I{copy}<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}<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}<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}<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 <TAB>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{<TAB>}s to spaces before parsing the input string.
+        Must be called before C{parseString} when the input grammar contains elements that
+        match C{<TAB>} 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 <exprname> at loc <n>(<line>,<col>)"}
+        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 (loc<instrlen and instring[loc] in bodychars):
+                throwException = True
+
+        if throwException:
+            raise ParseException(instring, loc, self.errmsg, self)
+
+        return loc, instring[start:loc]
+
+    def __str__( self ):
+        try:
+            return super(Word,self).__str__()
+        except Exception:
+            pass
+
+
+        if self.strRepr is None:
+
+            def charsAsStr(s):
+                if len(s)>4:
+                    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<name>...)}), these will be preserved as 
+    named parse results.
+
+    Example::
+        realnum = Regex(r"[+-]?\d+\.\d*")
+        date = Regex(r'(?P<year>\d{4})-(?P<month>\d\d?)-(?P<day>\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 = {
+        " " : "<SPC>",
+        "\t": "<TAB>",
+        "\n": "<LF>",
+        "\r": "<CR>",
+        "\f": "<FF>",
+        }
+    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):
+            if instring[loc] == "\n":
+                return loc+1, "\n"
+            else:
+                raise ParseException(instring, loc, self.errmsg, self)
+        elif loc == len(instring):
+            return loc+1, []
+        else:
+            raise ParseException(instring, loc, self.errmsg, self)
+
+class StringStart(_PositionToken):
+    """
+    Matches if current position is at the beginning of the parse string
+    """
+    def __init__( self ):
+        super(StringStart,self).__init__()
+        self.errmsg = "Expected start of text"
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        if loc != 0:
+            # see if entire string up to here is just whitespace and ignoreables
+            if loc != self.preParse( instring, 0 ):
+                raise ParseException(instring, loc, self.errmsg, self)
+        return loc, []
+
+class StringEnd(_PositionToken):
+    """
+    Matches if current position is at the end of the parse string
+    """
+    def __init__( self ):
+        super(StringEnd,self).__init__()
+        self.errmsg = "Expected end of text"
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        if loc < len(instring):
+            raise ParseException(instring, loc, self.errmsg, self)
+        elif loc == len(instring):
+            return loc+1, []
+        elif 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<instrlen:
+            if (instring[loc] in self.wordChars or
+                instring[loc-1] not in self.wordChars):
+                raise ParseException(instring, loc, self.errmsg, self)
+        return loc, []
+
+
+class ParseExpression(ParserElement):
+    """
+    Abstract subclass of ParserElement, for combining and post-processing parsed tokens.
+    """
+    def __init__( self, exprs, savelist = False ):
+        super(ParseExpression,self).__init__(savelist)
+        if isinstance( exprs, _generatorType ):
+            exprs = list(exprs)
+
+        if isinstance( exprs, basestring ):
+            self.exprs = [ ParserElement._literalStringClass( exprs ) ]
+        elif isinstance( exprs, Iterable ):
+            exprs = list(exprs)
+            # if sequence of strings provided, wrap with Literal
+            if all(isinstance(expr, basestring) for expr in exprs):
+                exprs = map(ParserElement._literalStringClass, exprs)
+            self.exprs = list(exprs)
+        else:
+            try:
+                self.exprs = list( exprs )
+            except TypeError:
+                self.exprs = [ exprs ]
+        self.callPreparse = False
+
+    def __getitem__( self, i ):
+        return self.exprs[i]
+
+    def append( self, other ):
+        self.exprs.append( other )
+        self.strRepr = None
+        return self
+
+    def leaveWhitespace( self ):
+        """Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on
+           all contained expressions."""
+        self.skipWhitespace = False
+        self.exprs = [ e.copy() for e in self.exprs ]
+        for e in self.exprs:
+            e.leaveWhitespace()
+        return self
+
+    def ignore( self, other ):
+        if isinstance( other, Suppress ):
+            if other not in self.ignoreExprs:
+                super( ParseExpression, self).ignore( other )
+                for e in self.exprs:
+                    e.ignore( self.ignoreExprs[-1] )
+        else:
+            super( ParseExpression, self).ignore( other )
+            for e in self.exprs:
+                e.ignore( self.ignoreExprs[-1] )
+        return self
+
+    def __str__( self ):
+        try:
+            return super(ParseExpression,self).__str__()
+        except Exception:
+            pass
+
+        if self.strRepr is None:
+            self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.exprs) )
+        return self.strRepr
+
+    def streamline( self ):
+        super(ParseExpression,self).streamline()
+
+        for e in self.exprs:
+            e.streamline()
+
+        # collapse nested And's of the form And( And( And( a,b), c), d) to And( a,b,c,d )
+        # but only if there are no parse actions or resultsNames on the nested And's
+        # (likewise for Or's and MatchFirst's)
+        if ( len(self.exprs) == 2 ):
+            other = self.exprs[0]
+            if ( isinstance( other, self.__class__ ) and
+                  not(other.parseAction) and
+                  other.resultsName is None and
+                  not other.debug ):
+                self.exprs = other.exprs[:] + [ self.exprs[1] ]
+                self.strRepr = None
+                self.mayReturnEmpty |= other.mayReturnEmpty
+                self.mayIndexError  |= other.mayIndexError
+
+            other = self.exprs[-1]
+            if ( isinstance( other, self.__class__ ) and
+                  not(other.parseAction) and
+                  other.resultsName is None and
+                  not other.debug ):
+                self.exprs = self.exprs[:-1] + other.exprs[:]
+                self.strRepr = None
+                self.mayReturnEmpty |= other.mayReturnEmpty
+                self.mayIndexError  |= other.mayIndexError
+
+        self.errmsg = "Expected " + _ustr(self)
+        
+        return self
+
+    def setResultsName( self, name, listAllMatches=False ):
+        ret = super(ParseExpression,self).setResultsName(name,listAllMatches)
+        return ret
+
+    def validate( self, validateTrace=[] ):
+        tmp = validateTrace[:]+[self]
+        for e in self.exprs:
+            e.validate(tmp)
+        self.checkRecursion( [] )
+        
+    def copy(self):
+        ret = super(ParseExpression,self).copy()
+        ret.exprs = [e.copy() for e in self.exprs]
+        return ret
+
+class And(ParseExpression):
+    """
+    Requires all given C{ParseExpression}s to be found in the given order.
+    Expressions may be separated by whitespace.
+    May be constructed using the C{'+'} operator.
+    May also be constructed using the C{'-'} operator, which will suppress backtracking.
+
+    Example::
+        integer = Word(nums)
+        name_expr = OneOrMore(Word(alphas))
+
+        expr = And([integer("id"),name_expr("name"),integer("age")])
+        # more easily written as:
+        expr = integer("id") + name_expr("name") + integer("age")
+    """
+
+    class _ErrorStop(Empty):
+        def __init__(self, *args, **kwargs):
+            super(And._ErrorStop,self).__init__(*args, **kwargs)
+            self.name = '-'
+            self.leaveWhitespace()
+
+    def __init__( self, exprs, savelist = True ):
+        super(And,self).__init__(exprs, savelist)
+        self.mayReturnEmpty = all(e.mayReturnEmpty for e in self.exprs)
+        self.setWhitespaceChars( self.exprs[0].whiteChars )
+        self.skipWhitespace = self.exprs[0].skipWhitespace
+        self.callPreparse = True
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        # pass False as last arg to _parse for first element, since we already
+        # pre-parsed the string as part of our And pre-parsing
+        loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
+        errorStop = False
+        for e in self.exprs[1:]:
+            if isinstance(e, And._ErrorStop):
+                errorStop = True
+                continue
+            if errorStop:
+                try:
+                    loc, exprtokens = e._parse( instring, loc, doActions )
+                except ParseSyntaxException:
+                    raise
+                except ParseBaseException as pe:
+                    pe.__traceback__ = None
+                    raise ParseSyntaxException._from_exception(pe)
+                except IndexError:
+                    raise ParseSyntaxException(instring, len(instring), self.errmsg, self)
+            else:
+                loc, exprtokens = e._parse( instring, loc, doActions )
+            if exprtokens or exprtokens.haskeys():
+                resultlist += exprtokens
+        return loc, resultlist
+
+    def __iadd__(self, other ):
+        if isinstance( other, basestring ):
+            other = ParserElement._literalStringClass( other )
+        return self.append( other ) #And( [ self, other ] )
+
+    def checkRecursion( self, parseElementList ):
+        subRecCheckList = parseElementList[:] + [ self ]
+        for e in self.exprs:
+            e.checkRecursion( subRecCheckList )
+            if not e.mayReturnEmpty:
+                break
+
+    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
+
+
+class Or(ParseExpression):
+    """
+    Requires that at least one C{ParseExpression} is found.
+    If two expressions match, the expression that matches the longest string will be used.
+    May be constructed using the C{'^'} operator.
+
+    Example::
+        # construct Or using '^' operator
+        
+        number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums))
+        print(number.searchString("123 3.1416 789"))
+    prints::
+        [['123'], ['3.1416'], ['789']]
+    """
+    def __init__( self, exprs, savelist = False ):
+        super(Or,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
+        matches = []
+        for e in self.exprs:
+            try:
+                loc2 = e.tryParse( instring, loc )
+            except ParseException as err:
+                err.__traceback__ = None
+                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)
+            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'], {}))
+        <<leaving remove_duplicate_chars (ret: 'dfjkls')
+        ['dfjkls']
+    """
+    f = _trim_arity(f)
+    def z(*paArgs):
+        thisFunc = f.__name__
+        s,l,t = paArgs[-3:]
+        if len(paArgs)>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( "<<leaving %s (exception: %s)\n" % (thisFunc,exc) )
+            raise
+        sys.stderr.write( "<<leaving %s (ret: %r)\n" % (thisFunc,ret) )
+        return ret
+    try:
+        z.__name__ = f.__name__
+    except AttributeError:
+        pass
+    return z
+
+#
+# global helpers
+#
+def delimitedList( expr, delim=",", combine=False ):
+    """
+    Helper to define a delimited list of expressions - the delimiter defaults to ','.
+    By default, the list elements and delimiters can have intervening whitespace, and
+    comments, but this can be overridden by passing C{combine=True} in the constructor.
+    If C{combine} is set to C{True}, the matching tokens are returned as a single token
+    string, with the delimiters included; otherwise, the matching tokens are returned
+    as a list of tokens, with the delimiters suppressed.
+
+    Example::
+        delimitedList(Word(alphas)).parseString("aa,bb,cc") # -> ['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 <b> bold <i>text</i> </b> normal text "
+        for tag in ("b","i"):
+            opener,closer = makeHTMLTags(tag)
+            patt = originalTextFor(opener + SkipTo(closer) + closer)
+            print(patt.searchString(src)[0])
+    prints::
+        ['<b> bold <i>text</i> </b>']
+        ['<i>text</i>']
+    """
+    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{<TAB>} 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<ParserElement.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("</") + tagStr + ">")
+
+    openTag = openTag.setResultsName("start"+"".join(resname.replace(":"," ").title().split())).setName("<%s>" % resname)
+    closeTag = closeTag.setResultsName("end"+"".join(resname.replace(":"," ").title().split())).setName("</%s>" % 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 = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>'
+        # 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 <A> 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{<TD>} or C{<DIV>}.
+
+    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 = '''
+            <div>
+            Some text
+            <div type="grid">1 4 0 1 0</div>
+            <div type="graph">1,3 2,3 1,1</div>
+            <div>this has no type</div>
+            </div>
+                
+        '''
+        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 = '''
+            <div>
+            Some text
+            <div class="grid">1 4 0 1 0</div>
+            <div class="graph">1,3 2,3 1,1</div>
+            <div>this &lt;div&gt; has no class</div>
+            </div>
+                
+        '''
+        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<entity>' + '|'.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"<!--[\s\S]*?-->").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<integer>}, L{reals<real>}, L{scientific notation<sci_real>})
+     - common L{programming identifiers<identifier>}
+     - network addresses (L{MAC<mac_address>}, L{IPv4<ipv4_address>}, L{IPv6<ipv6_address>})
+     - ISO8601 L{dates<iso8601_date>} and L{datetime<iso8601_datetime>}
+     - L{UUID<uuid>}
+     - L{comma-separated list<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<year>\d{4})(?:-(?P<month>\d\d)(?:-(?P<day>\d\d))?)?').setName("ISO8601 date")
+    "ISO8601 date (C{yyyy-mm-dd})"
+
+    iso8601_datetime = Regex(r'(?P<year>\d{4})-(?P<month>\d\d)-(?P<day>\d\d)[T ](?P<hour>\d\d):(?P<minute>\d\d)(:(?P<second>\d\d(\.\d*)?)?)?(?P<tz>Z|[+-]\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 = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>'
+            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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/six.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/six.py
new file mode 100644
index 0000000000000000000000000000000000000000..190c0239cd7d7af82a6e0cbc8d68053fa2e3dfaf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/_vendor/six.py
@@ -0,0 +1,868 @@
+"""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 <benjamin@python.org>"
+__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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c1eb9e998f8e117c82c176bc83ab1d350c729cd7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__init__.py
@@ -0,0 +1,73 @@
+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/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..c2cc363f35bf7814a156a3a8be1ed90558075b38
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/extern/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pkg_resources/py31compat.py b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/py31compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..a381c424f9eaacb4126d4b8a474052551e34ccfb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pkg_resources/py31compat.py
@@ -0,0 +1,23 @@
+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/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..ea215f2dbb279c7759384cce82de5fd320e75ccb
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/LICENSE
@@ -0,0 +1,27 @@
+pycparser -- A C parser in Python
+
+Copyright (c) 2008-2020, Eli Bendersky
+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 Eli Bendersky 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/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..1d0fbd65144ffb486e9df01005c2f2cf1fdf2c63
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/METADATA
@@ -0,0 +1,31 @@
+Metadata-Version: 2.1
+Name: pycparser
+Version: 2.21
+Summary: C parser in Python
+Home-page: https://github.com/eliben/pycparser
+Author: Eli Bendersky
+Author-email: eliben@gmail.com
+Maintainer: Eli Bendersky
+License: BSD
+Platform: Cross Platform
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: License :: OSI Approved :: BSD License
+Classifier: Programming Language :: Python :: 2
+Classifier: Programming Language :: Python :: 2.7
+Classifier: Programming Language :: Python :: 3
+Classifier: Programming Language :: Python :: 3.4
+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
+Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
+
+
+pycparser is a complete parser of the C language, written in
+pure Python using the PLY parsing library.
+It parses C code into an AST and can serve as a front-end for
+C compilers or analysis tools.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..e2304986a0b833c0b9cbaa6ab2eb4eb510f3c8be
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/RECORD
@@ -0,0 +1,41 @@
+pycparser-2.21.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+pycparser-2.21.dist-info/LICENSE,sha256=Pn3yW437ZYyakVAZMNTZQ7BQh6g0fH4rQyVhavU1BHs,1536
+pycparser-2.21.dist-info/METADATA,sha256=GvTEQA9yKj0nvP4mknfoGpMvjaJXCQjQANcQHrRrAxc,1108
+pycparser-2.21.dist-info/RECORD,,
+pycparser-2.21.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
+pycparser-2.21.dist-info/top_level.txt,sha256=c-lPcS74L_8KoH7IE6PQF5ofyirRQNV4VhkbSFIPeWM,10
+pycparser/__init__.py,sha256=WUEp5D0fuHBH9Q8c1fYvR2eKWfj-CNghLf2MMlQLI1I,2815
+pycparser/__pycache__/__init__.cpython-39.pyc,,
+pycparser/__pycache__/_ast_gen.cpython-39.pyc,,
+pycparser/__pycache__/_build_tables.cpython-39.pyc,,
+pycparser/__pycache__/ast_transforms.cpython-39.pyc,,
+pycparser/__pycache__/c_ast.cpython-39.pyc,,
+pycparser/__pycache__/c_generator.cpython-39.pyc,,
+pycparser/__pycache__/c_lexer.cpython-39.pyc,,
+pycparser/__pycache__/c_parser.cpython-39.pyc,,
+pycparser/__pycache__/lextab.cpython-39.pyc,,
+pycparser/__pycache__/plyparser.cpython-39.pyc,,
+pycparser/__pycache__/yacctab.cpython-39.pyc,,
+pycparser/_ast_gen.py,sha256=0JRVnDW-Jw-3IjVlo8je9rbAcp6Ko7toHAnB5zi7h0Q,10555
+pycparser/_build_tables.py,sha256=oZCd3Plhq-vkV-QuEsaahcf-jUI6-HgKsrAL9gvFzuU,1039
+pycparser/_c_ast.cfg,sha256=ld5ezE9yzIJFIVAUfw7ezJSlMi4nXKNCzfmqjOyQTNo,4255
+pycparser/ast_transforms.py,sha256=GTMYlUgWmXd5wJVyovXY1qzzAqjxzCpVVg0664dKGBs,5691
+pycparser/c_ast.py,sha256=HWeOrfYdCY0u5XaYhE1i60uVyE3yMWdcxzECUX-DqJw,31445
+pycparser/c_generator.py,sha256=yi6Mcqxv88J5ue8k5-mVGxh3iJ37iD4QyF-sWcGjC-8,17772
+pycparser/c_lexer.py,sha256=xCpjIb6vOUebBJpdifidb08y7XgAsO3T1gNGXJT93-w,17167
+pycparser/c_parser.py,sha256=_8y3i52bL6SUK21KmEEl0qzHxe-0eZRzjZGkWg8gQ4A,73680
+pycparser/lextab.py,sha256=fIxBAHYRC418oKF52M7xb8_KMj3K-tHx0TzZiKwxjPM,8504
+pycparser/ply/__init__.py,sha256=q4s86QwRsYRa20L9ueSxfh-hPihpftBjDOvYa2_SS2Y,102
+pycparser/ply/__pycache__/__init__.cpython-39.pyc,,
+pycparser/ply/__pycache__/cpp.cpython-39.pyc,,
+pycparser/ply/__pycache__/ctokens.cpython-39.pyc,,
+pycparser/ply/__pycache__/lex.cpython-39.pyc,,
+pycparser/ply/__pycache__/yacc.cpython-39.pyc,,
+pycparser/ply/__pycache__/ygen.cpython-39.pyc,,
+pycparser/ply/cpp.py,sha256=UtC3ylTWp5_1MKA-PLCuwKQR8zSOnlGuGGIdzj8xS98,33282
+pycparser/ply/ctokens.py,sha256=MKksnN40TehPhgVfxCJhjj_BjL943apreABKYz-bl0Y,3177
+pycparser/ply/lex.py,sha256=7Qol57x702HZwjA3ZLp-84CUEWq1EehW-N67Wzghi-M,42918
+pycparser/ply/yacc.py,sha256=eatSDkRLgRr6X3-hoDk_SQQv065R0BdL2K7fQ54CgVM,137323
+pycparser/ply/ygen.py,sha256=2JYNeYtrPz1JzLSLO3d4GsS8zJU8jY_I_CR1VI9gWrA,2251
+pycparser/plyparser.py,sha256=8tLOoEytcapvWrr1JfCf7Dog-wulBtS1YrDs8S7JfMo,4875
+pycparser/yacctab.py,sha256=j_fVNIyDWDRVk7eWMqQtlBw2AwUSV5JTrtT58l7zis0,205652
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ef99c6cf3283b50a273ac4c6d009a0aa85597070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/WHEEL
@@ -0,0 +1,6 @@
+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/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..dc1c9e101ad9ccd943b359338ef42c342ebc84a1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser-2.21.dist-info/top_level.txt
@@ -0,0 +1 @@
+pycparser
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..d82eb2d6fbafe9828a2281cebc335bd6c20fcbe5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/__init__.py
@@ -0,0 +1,90 @@
+#-----------------------------------------------------------------
+# pycparser: __init__.py
+#
+# This package file exports some convenience functions for
+# interacting with pycparser
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+__all__ = ['c_lexer', 'c_parser', 'c_ast']
+__version__ = '2.21'
+
+import io
+from subprocess import check_output
+from .c_parser import CParser
+
+
+def preprocess_file(filename, cpp_path='cpp', cpp_args=''):
+    """ Preprocess a file using cpp.
+
+        filename:
+            Name of the file you want to preprocess.
+
+        cpp_path:
+        cpp_args:
+            Refer to the documentation of parse_file for the meaning of these
+            arguments.
+
+        When successful, returns the preprocessed file's contents.
+        Errors from cpp will be printed out.
+    """
+    path_list = [cpp_path]
+    if isinstance(cpp_args, list):
+        path_list += cpp_args
+    elif cpp_args != '':
+        path_list += [cpp_args]
+    path_list += [filename]
+
+    try:
+        # Note the use of universal_newlines to treat all newlines
+        # as \n for Python's purpose
+        text = check_output(path_list, universal_newlines=True)
+    except OSError as e:
+        raise RuntimeError("Unable to invoke 'cpp'.  " +
+            'Make sure its path was passed correctly\n' +
+            ('Original error: %s' % e))
+
+    return text
+
+
+def parse_file(filename, use_cpp=False, cpp_path='cpp', cpp_args='',
+               parser=None):
+    """ Parse a C file using pycparser.
+
+        filename:
+            Name of the file you want to parse.
+
+        use_cpp:
+            Set to True if you want to execute the C pre-processor
+            on the file prior to parsing it.
+
+        cpp_path:
+            If use_cpp is True, this is the path to 'cpp' on your
+            system. If no path is provided, it attempts to just
+            execute 'cpp', so it must be in your PATH.
+
+        cpp_args:
+            If use_cpp is True, set this to the command line arguments strings
+            to cpp. Be careful with quotes - it's best to pass a raw string
+            (r'') here. For example:
+            r'-I../utils/fake_libc_include'
+            If several arguments are required, pass a list of strings.
+
+        parser:
+            Optional parser object to be used instead of the default CParser
+
+        When successful, an AST is returned. ParseError can be
+        thrown if the file doesn't parse successfully.
+
+        Errors from cpp will be printed out.
+    """
+    if use_cpp:
+        text = preprocess_file(filename, cpp_path, cpp_args)
+    else:
+        with io.open(filename) as f:
+            text = f.read()
+
+    if parser is None:
+        parser = CParser()
+    return parser.parse(text, filename)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d63943099f0720aff78bea794a52e5b75ac1ff98
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_ast_gen.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_ast_gen.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bad4ca80be154650495502b004a4dc02e4464904
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_ast_gen.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_build_tables.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_build_tables.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d3e01534bad57bdeac4c6c34b427ee767b5faebd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/_build_tables.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/ast_transforms.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/ast_transforms.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..960f1299a63ee82d93799cfe1d4c512ef8ba1ff2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/ast_transforms.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_ast.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_ast.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b0a4a860a55875b0a9e8bfc2b213b02172021f5d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_ast.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_generator.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_generator.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6da119f7ee8e8d6f4c18170f53126fcc8f9cb988
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_generator.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_lexer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_lexer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..75b012b8c2df1057298a6e54504fb1b9e082be32
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_lexer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_parser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_parser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a8b80cd5955cabb959a0d739fd31c0cd0b0a3bcb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/c_parser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/lextab.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/lextab.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a136daf9eed2bd8fa314fb6bbf65050db833def0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/lextab.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/plyparser.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/plyparser.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5fbf94b478c5cc0c1815a560a3f6e7b199db4116
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/plyparser.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/yacctab.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/yacctab.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..deb3138cb5678682ab712165554e577fa4b36841
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/__pycache__/yacctab.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/_ast_gen.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/_ast_gen.py
new file mode 100644
index 0000000000000000000000000000000000000000..0f7d330ba694ec21e278264b90bfbe483ca2b7d3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/_ast_gen.py
@@ -0,0 +1,336 @@
+#-----------------------------------------------------------------
+# _ast_gen.py
+#
+# Generates the AST Node classes from a specification given in
+# a configuration file
+#
+# The design of this module was inspired by astgen.py from the
+# Python 2.5 code-base.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+from string import Template
+
+
+class ASTCodeGenerator(object):
+    def __init__(self, cfg_filename='_c_ast.cfg'):
+        """ Initialize the code generator from a configuration
+            file.
+        """
+        self.cfg_filename = cfg_filename
+        self.node_cfg = [NodeCfg(name, contents)
+            for (name, contents) in self.parse_cfgfile(cfg_filename)]
+
+    def generate(self, file=None):
+        """ Generates the code into file, an open file buffer.
+        """
+        src = Template(_PROLOGUE_COMMENT).substitute(
+            cfg_filename=self.cfg_filename)
+
+        src += _PROLOGUE_CODE
+        for node_cfg in self.node_cfg:
+            src += node_cfg.generate_source() + '\n\n'
+
+        file.write(src)
+
+    def parse_cfgfile(self, filename):
+        """ Parse the configuration file and yield pairs of
+            (name, contents) for each node.
+        """
+        with open(filename, "r") as f:
+            for line in f:
+                line = line.strip()
+                if not line or line.startswith('#'):
+                    continue
+                colon_i = line.find(':')
+                lbracket_i = line.find('[')
+                rbracket_i = line.find(']')
+                if colon_i < 1 or lbracket_i <= colon_i or rbracket_i <= lbracket_i:
+                    raise RuntimeError("Invalid line in %s:\n%s\n" % (filename, line))
+
+                name = line[:colon_i]
+                val = line[lbracket_i + 1:rbracket_i]
+                vallist = [v.strip() for v in val.split(',')] if val else []
+                yield name, vallist
+
+
+class NodeCfg(object):
+    """ Node configuration.
+
+        name: node name
+        contents: a list of contents - attributes and child nodes
+        See comment at the top of the configuration file for details.
+    """
+
+    def __init__(self, name, contents):
+        self.name = name
+        self.all_entries = []
+        self.attr = []
+        self.child = []
+        self.seq_child = []
+
+        for entry in contents:
+            clean_entry = entry.rstrip('*')
+            self.all_entries.append(clean_entry)
+
+            if entry.endswith('**'):
+                self.seq_child.append(clean_entry)
+            elif entry.endswith('*'):
+                self.child.append(clean_entry)
+            else:
+                self.attr.append(entry)
+
+    def generate_source(self):
+        src = self._gen_init()
+        src += '\n' + self._gen_children()
+        src += '\n' + self._gen_iter()
+        src += '\n' + self._gen_attr_names()
+        return src
+
+    def _gen_init(self):
+        src = "class %s(Node):\n" % self.name
+
+        if self.all_entries:
+            args = ', '.join(self.all_entries)
+            slots = ', '.join("'{0}'".format(e) for e in self.all_entries)
+            slots += ", 'coord', '__weakref__'"
+            arglist = '(self, %s, coord=None)' % args
+        else:
+            slots = "'coord', '__weakref__'"
+            arglist = '(self, coord=None)'
+
+        src += "    __slots__ = (%s)\n" % slots
+        src += "    def __init__%s:\n" % arglist
+
+        for name in self.all_entries + ['coord']:
+            src += "        self.%s = %s\n" % (name, name)
+
+        return src
+
+    def _gen_children(self):
+        src = '    def children(self):\n'
+
+        if self.all_entries:
+            src += '        nodelist = []\n'
+
+            for child in self.child:
+                src += (
+                    '        if self.%(child)s is not None:' +
+                    ' nodelist.append(("%(child)s", self.%(child)s))\n') % (
+                        dict(child=child))
+
+            for seq_child in self.seq_child:
+                src += (
+                    '        for i, child in enumerate(self.%(child)s or []):\n'
+                    '            nodelist.append(("%(child)s[%%d]" %% i, child))\n') % (
+                        dict(child=seq_child))
+
+            src += '        return tuple(nodelist)\n'
+        else:
+            src += '        return ()\n'
+
+        return src
+
+    def _gen_iter(self):
+        src = '    def __iter__(self):\n'
+
+        if self.all_entries:
+            for child in self.child:
+                src += (
+                    '        if self.%(child)s is not None:\n' +
+                    '            yield self.%(child)s\n') % (dict(child=child))
+
+            for seq_child in self.seq_child:
+                src += (
+                    '        for child in (self.%(child)s or []):\n'
+                    '            yield child\n') % (dict(child=seq_child))
+
+            if not (self.child or self.seq_child):
+                # Empty generator
+                src += (
+                    '        return\n' +
+                    '        yield\n')
+        else:
+            # Empty generator
+            src += (
+                '        return\n' +
+                '        yield\n')
+
+        return src
+
+    def _gen_attr_names(self):
+        src = "    attr_names = (" + ''.join("%r, " % nm for nm in self.attr) + ')'
+        return src
+
+
+_PROLOGUE_COMMENT = \
+r'''#-----------------------------------------------------------------
+# ** ATTENTION **
+# This code was automatically generated from the file:
+# $cfg_filename
+#
+# Do not modify it directly. Modify the configuration file and
+# run the generator again.
+# ** ** *** ** **
+#
+# pycparser: c_ast.py
+#
+# AST Node classes.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+
+'''
+
+_PROLOGUE_CODE = r'''
+import sys
+
+def _repr(obj):
+    """
+    Get the representation of an object, with dedicated pprint-like format for lists.
+    """
+    if isinstance(obj, list):
+        return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]'
+    else:
+        return repr(obj)
+
+class Node(object):
+    __slots__ = ()
+    """ Abstract base class for AST nodes.
+    """
+    def __repr__(self):
+        """ Generates a python representation of the current node
+        """
+        result = self.__class__.__name__ + '('
+
+        indent = ''
+        separator = ''
+        for name in self.__slots__[:-2]:
+            result += separator
+            result += indent
+            result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n  ' + (' ' * (len(name) + len(self.__class__.__name__)))))
+
+            separator = ','
+            indent = '\n ' + (' ' * len(self.__class__.__name__))
+
+        result += indent + ')'
+
+        return result
+
+    def children(self):
+        """ A sequence of all children that are Nodes
+        """
+        pass
+
+    def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
+        """ Pretty print the Node and all its attributes and
+            children (recursively) to a buffer.
+
+            buf:
+                Open IO buffer into which the Node is printed.
+
+            offset:
+                Initial offset (amount of leading spaces)
+
+            attrnames:
+                True if you want to see the attribute names in
+                name=value pairs. False to only see the values.
+
+            nodenames:
+                True if you want to see the actual node names
+                within their parents.
+
+            showcoord:
+                Do you want the coordinates of each Node to be
+                displayed.
+        """
+        lead = ' ' * offset
+        if nodenames and _my_node_name is not None:
+            buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ')
+        else:
+            buf.write(lead + self.__class__.__name__+ ': ')
+
+        if self.attr_names:
+            if attrnames:
+                nvlist = [(n, getattr(self,n)) for n in self.attr_names]
+                attrstr = ', '.join('%s=%s' % nv for nv in nvlist)
+            else:
+                vlist = [getattr(self, n) for n in self.attr_names]
+                attrstr = ', '.join('%s' % v for v in vlist)
+            buf.write(attrstr)
+
+        if showcoord:
+            buf.write(' (at %s)' % self.coord)
+        buf.write('\n')
+
+        for (child_name, child) in self.children():
+            child.show(
+                buf,
+                offset=offset + 2,
+                attrnames=attrnames,
+                nodenames=nodenames,
+                showcoord=showcoord,
+                _my_node_name=child_name)
+
+
+class NodeVisitor(object):
+    """ A base NodeVisitor class for visiting c_ast nodes.
+        Subclass it and define your own visit_XXX methods, where
+        XXX is the class name you want to visit with these
+        methods.
+
+        For example:
+
+        class ConstantVisitor(NodeVisitor):
+            def __init__(self):
+                self.values = []
+
+            def visit_Constant(self, node):
+                self.values.append(node.value)
+
+        Creates a list of values of all the constant nodes
+        encountered below the given node. To use it:
+
+        cv = ConstantVisitor()
+        cv.visit(node)
+
+        Notes:
+
+        *   generic_visit() will be called for AST nodes for which
+            no visit_XXX method was defined.
+        *   The children of nodes for which a visit_XXX was
+            defined will not be visited - if you need this, call
+            generic_visit() on the node.
+            You can use:
+                NodeVisitor.generic_visit(self, node)
+        *   Modeled after Python's own AST visiting facilities
+            (the ast module of Python 3.0)
+    """
+
+    _method_cache = None
+
+    def visit(self, node):
+        """ Visit a node.
+        """
+
+        if self._method_cache is None:
+            self._method_cache = {}
+
+        visitor = self._method_cache.get(node.__class__.__name__, None)
+        if visitor is None:
+            method = 'visit_' + node.__class__.__name__
+            visitor = getattr(self, method, self.generic_visit)
+            self._method_cache[node.__class__.__name__] = visitor
+
+        return visitor(node)
+
+    def generic_visit(self, node):
+        """ Called if no explicit visitor function exists for a
+            node. Implements preorder visiting of the node.
+        """
+        for c in node:
+            self.visit(c)
+
+'''
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/_build_tables.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/_build_tables.py
new file mode 100644
index 0000000000000000000000000000000000000000..958381ad0f2927aff0253a8516c3bc76d00760d6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/_build_tables.py
@@ -0,0 +1,37 @@
+#-----------------------------------------------------------------
+# pycparser: _build_tables.py
+#
+# A dummy for generating the lexing/parsing tables and and
+# compiling them into .pyc for faster execution in optimized mode.
+# Also generates AST code from the configuration file.
+# Should be called from the pycparser directory.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+
+# Insert '.' and '..' as first entries to the search path for modules.
+# Restricted environments like embeddable python do not include the
+# current working directory on startup.
+import sys
+sys.path[0:0] = ['.', '..']
+
+# Generate c_ast.py
+from _ast_gen import ASTCodeGenerator
+ast_gen = ASTCodeGenerator('_c_ast.cfg')
+ast_gen.generate(open('c_ast.py', 'w'))
+
+from pycparser import c_parser
+
+# Generates the tables
+#
+c_parser.CParser(
+    lex_optimize=True,
+    yacc_debug=False,
+    yacc_optimize=True)
+
+# Load to compile into .pyc
+#
+import lextab
+import yacctab
+import c_ast
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/_c_ast.cfg b/TP03/TP03/lib/python3.9/site-packages/pycparser/_c_ast.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..0626533e8adf517da897ec047c8deb6ad41c38c9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/_c_ast.cfg
@@ -0,0 +1,195 @@
+#-----------------------------------------------------------------
+# pycparser: _c_ast.cfg
+#
+# Defines the AST Node classes used in pycparser.
+#
+# Each entry is a Node sub-class name, listing the attributes
+# and child nodes of the class:
+#   <name>*     - a child node
+#   <name>**    - a sequence of child nodes
+#   <name>      - an attribute
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+
+# ArrayDecl is a nested declaration of an array with the given type.
+# dim: the dimension (for example, constant 42)
+# dim_quals: list of dimension qualifiers, to support C99's allowing 'const'
+#            and 'static' within the array dimension in function declarations.
+ArrayDecl: [type*, dim*, dim_quals]
+
+ArrayRef: [name*, subscript*]
+
+# op: =, +=, /= etc.
+#
+Assignment: [op, lvalue*, rvalue*]
+
+Alignas: [alignment*]
+
+BinaryOp: [op, left*, right*]
+
+Break: []
+
+Case: [expr*, stmts**]
+
+Cast: [to_type*, expr*]
+
+# Compound statement in C99 is a list of block items (declarations or
+# statements).
+#
+Compound: [block_items**]
+
+# Compound literal (anonymous aggregate) for C99.
+# (type-name) {initializer_list}
+# type: the typename
+# init: InitList for the initializer list
+#
+CompoundLiteral: [type*, init*]
+
+# type: int, char, float, string, etc.
+#
+Constant: [type, value]
+
+Continue: []
+
+# name: the variable being declared
+# quals: list of qualifiers (const, volatile)
+# funcspec: list function specifiers (i.e. inline in C99)
+# storage: list of storage specifiers (extern, register, etc.)
+# type: declaration type (probably nested with all the modifiers)
+# init: initialization value, or None
+# bitsize: bit field size, or None
+#
+Decl: [name, quals, align, storage, funcspec, type*, init*, bitsize*]
+
+DeclList: [decls**]
+
+Default: [stmts**]
+
+DoWhile: [cond*, stmt*]
+
+# Represents the ellipsis (...) parameter in a function
+# declaration
+#
+EllipsisParam: []
+
+# An empty statement (a semicolon ';' on its own)
+#
+EmptyStatement: []
+
+# Enumeration type specifier
+# name: an optional ID
+# values: an EnumeratorList
+#
+Enum: [name, values*]
+
+# A name/value pair for enumeration values
+#
+Enumerator: [name, value*]
+
+# A list of enumerators
+#
+EnumeratorList: [enumerators**]
+
+# A list of expressions separated by the comma operator.
+#
+ExprList: [exprs**]
+
+# This is the top of the AST, representing a single C file (a
+# translation unit in K&R jargon). It contains a list of
+# "external-declaration"s, which is either declarations (Decl),
+# Typedef or function definitions (FuncDef).
+#
+FileAST: [ext**]
+
+# for (init; cond; next) stmt
+#
+For: [init*, cond*, next*, stmt*]
+
+# name: Id
+# args: ExprList
+#
+FuncCall: [name*, args*]
+
+# type <decl>(args)
+#
+FuncDecl: [args*, type*]
+
+# Function definition: a declarator for the function name and
+# a body, which is a compound statement.
+# There's an optional list of parameter declarations for old
+# K&R-style definitions
+#
+FuncDef: [decl*, param_decls**, body*]
+
+Goto: [name]
+
+ID: [name]
+
+# Holder for types that are a simple identifier (e.g. the built
+# ins void, char etc. and typedef-defined types)
+#
+IdentifierType: [names]
+
+If: [cond*, iftrue*, iffalse*]
+
+# An initialization list used for compound literals.
+#
+InitList: [exprs**]
+
+Label: [name, stmt*]
+
+# A named initializer for C99.
+# The name of a NamedInitializer is a sequence of Nodes, because
+# names can be hierarchical and contain constant expressions.
+#
+NamedInitializer: [name**, expr*]
+
+# a list of comma separated function parameter declarations
+#
+ParamList: [params**]
+
+PtrDecl: [quals, type*]
+
+Return: [expr*]
+
+StaticAssert: [cond*, message*]
+
+# name: struct tag name
+# decls: declaration of members
+#
+Struct: [name, decls**]
+
+# type: . or ->
+# name.field or name->field
+#
+StructRef: [name*, type, field*]
+
+Switch: [cond*, stmt*]
+
+# cond ? iftrue : iffalse
+#
+TernaryOp: [cond*, iftrue*, iffalse*]
+
+# A base type declaration
+#
+TypeDecl: [declname, quals, align, type*]
+
+# A typedef declaration.
+# Very similar to Decl, but without some attributes
+#
+Typedef: [name, quals, storage, type*]
+
+Typename: [name, quals, align, type*]
+
+UnaryOp: [op, expr*]
+
+# name: union tag name
+# decls: declaration of members
+#
+Union: [name, decls**]
+
+While: [cond*, stmt*]
+
+Pragma: [string]
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ast_transforms.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ast_transforms.py
new file mode 100644
index 0000000000000000000000000000000000000000..367dcf54c57db47429fae8a67325237e7c048e17
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ast_transforms.py
@@ -0,0 +1,164 @@
+#------------------------------------------------------------------------------
+# pycparser: ast_transforms.py
+#
+# Some utilities used by the parser to create a friendlier AST.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#------------------------------------------------------------------------------
+
+from . import c_ast
+
+
+def fix_switch_cases(switch_node):
+    """ The 'case' statements in a 'switch' come out of parsing with one
+        child node, so subsequent statements are just tucked to the parent
+        Compound. Additionally, consecutive (fall-through) case statements
+        come out messy. This is a peculiarity of the C grammar. The following:
+
+            switch (myvar) {
+                case 10:
+                    k = 10;
+                    p = k + 1;
+                    return 10;
+                case 20:
+                case 30:
+                    return 20;
+                default:
+                    break;
+            }
+
+        Creates this tree (pseudo-dump):
+
+            Switch
+                ID: myvar
+                Compound:
+                    Case 10:
+                        k = 10
+                    p = k + 1
+                    return 10
+                    Case 20:
+                        Case 30:
+                            return 20
+                    Default:
+                        break
+
+        The goal of this transform is to fix this mess, turning it into the
+        following:
+
+            Switch
+                ID: myvar
+                Compound:
+                    Case 10:
+                        k = 10
+                        p = k + 1
+                        return 10
+                    Case 20:
+                    Case 30:
+                        return 20
+                    Default:
+                        break
+
+        A fixed AST node is returned. The argument may be modified.
+    """
+    assert isinstance(switch_node, c_ast.Switch)
+    if not isinstance(switch_node.stmt, c_ast.Compound):
+        return switch_node
+
+    # The new Compound child for the Switch, which will collect children in the
+    # correct order
+    new_compound = c_ast.Compound([], switch_node.stmt.coord)
+
+    # The last Case/Default node
+    last_case = None
+
+    # Goes over the children of the Compound below the Switch, adding them
+    # either directly below new_compound or below the last Case as appropriate
+    # (for `switch(cond) {}`, block_items would have been None)
+    for child in (switch_node.stmt.block_items or []):
+        if isinstance(child, (c_ast.Case, c_ast.Default)):
+            # If it's a Case/Default:
+            # 1. Add it to the Compound and mark as "last case"
+            # 2. If its immediate child is also a Case or Default, promote it
+            #    to a sibling.
+            new_compound.block_items.append(child)
+            _extract_nested_case(child, new_compound.block_items)
+            last_case = new_compound.block_items[-1]
+        else:
+            # Other statements are added as children to the last case, if it
+            # exists.
+            if last_case is None:
+                new_compound.block_items.append(child)
+            else:
+                last_case.stmts.append(child)
+
+    switch_node.stmt = new_compound
+    return switch_node
+
+
+def _extract_nested_case(case_node, stmts_list):
+    """ Recursively extract consecutive Case statements that are made nested
+        by the parser and add them to the stmts_list.
+    """
+    if isinstance(case_node.stmts[0], (c_ast.Case, c_ast.Default)):
+        stmts_list.append(case_node.stmts.pop())
+        _extract_nested_case(stmts_list[-1], stmts_list)
+
+
+def fix_atomic_specifiers(decl):
+    """ Atomic specifiers like _Atomic(type) are unusually structured,
+        conferring a qualifier upon the contained type.
+
+        This function fixes a decl with atomic specifiers to have a sane AST
+        structure, by removing spurious Typename->TypeDecl pairs and attaching
+        the _Atomic qualifier in the right place.
+    """
+    # There can be multiple levels of _Atomic in a decl; fix them until a
+    # fixed point is reached.
+    while True:
+        decl, found = _fix_atomic_specifiers_once(decl)
+        if not found:
+            break
+
+    # Make sure to add an _Atomic qual on the topmost decl if needed. Also
+    # restore the declname on the innermost TypeDecl (it gets placed in the
+    # wrong place during construction).
+    typ = decl
+    while not isinstance(typ, c_ast.TypeDecl):
+        try:
+            typ = typ.type
+        except AttributeError:
+            return decl
+    if '_Atomic' in typ.quals and '_Atomic' not in decl.quals:
+        decl.quals.append('_Atomic')
+    if typ.declname is None:
+        typ.declname = decl.name
+
+    return decl
+
+
+def _fix_atomic_specifiers_once(decl):
+    """ Performs one 'fix' round of atomic specifiers.
+        Returns (modified_decl, found) where found is True iff a fix was made.
+    """
+    parent = decl
+    grandparent = None
+    node = decl.type
+    while node is not None:
+        if isinstance(node, c_ast.Typename) and '_Atomic' in node.quals:
+            break
+        try:
+            grandparent = parent
+            parent = node
+            node = node.type
+        except AttributeError:
+            # If we've reached a node without a `type` field, it means we won't
+            # find what we're looking for at this point; give up the search
+            # and return the original decl unmodified.
+            return decl, False
+
+    assert isinstance(parent, c_ast.TypeDecl)
+    grandparent.type = node.type
+    if '_Atomic' not in node.type.quals:
+        node.type.quals.append('_Atomic')
+    return decl, True
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/c_ast.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_ast.py
new file mode 100644
index 0000000000000000000000000000000000000000..6575a2ad395a3fd43c44e296b010e6b33c7eefd0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_ast.py
@@ -0,0 +1,1125 @@
+#-----------------------------------------------------------------
+# ** ATTENTION **
+# This code was automatically generated from the file:
+# _c_ast.cfg
+#
+# Do not modify it directly. Modify the configuration file and
+# run the generator again.
+# ** ** *** ** **
+#
+# pycparser: c_ast.py
+#
+# AST Node classes.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+
+
+import sys
+
+def _repr(obj):
+    """
+    Get the representation of an object, with dedicated pprint-like format for lists.
+    """
+    if isinstance(obj, list):
+        return '[' + (',\n '.join((_repr(e).replace('\n', '\n ') for e in obj))) + '\n]'
+    else:
+        return repr(obj)
+
+class Node(object):
+    __slots__ = ()
+    """ Abstract base class for AST nodes.
+    """
+    def __repr__(self):
+        """ Generates a python representation of the current node
+        """
+        result = self.__class__.__name__ + '('
+
+        indent = ''
+        separator = ''
+        for name in self.__slots__[:-2]:
+            result += separator
+            result += indent
+            result += name + '=' + (_repr(getattr(self, name)).replace('\n', '\n  ' + (' ' * (len(name) + len(self.__class__.__name__)))))
+
+            separator = ','
+            indent = '\n ' + (' ' * len(self.__class__.__name__))
+
+        result += indent + ')'
+
+        return result
+
+    def children(self):
+        """ A sequence of all children that are Nodes
+        """
+        pass
+
+    def show(self, buf=sys.stdout, offset=0, attrnames=False, nodenames=False, showcoord=False, _my_node_name=None):
+        """ Pretty print the Node and all its attributes and
+            children (recursively) to a buffer.
+
+            buf:
+                Open IO buffer into which the Node is printed.
+
+            offset:
+                Initial offset (amount of leading spaces)
+
+            attrnames:
+                True if you want to see the attribute names in
+                name=value pairs. False to only see the values.
+
+            nodenames:
+                True if you want to see the actual node names
+                within their parents.
+
+            showcoord:
+                Do you want the coordinates of each Node to be
+                displayed.
+        """
+        lead = ' ' * offset
+        if nodenames and _my_node_name is not None:
+            buf.write(lead + self.__class__.__name__+ ' <' + _my_node_name + '>: ')
+        else:
+            buf.write(lead + self.__class__.__name__+ ': ')
+
+        if self.attr_names:
+            if attrnames:
+                nvlist = [(n, getattr(self,n)) for n in self.attr_names]
+                attrstr = ', '.join('%s=%s' % nv for nv in nvlist)
+            else:
+                vlist = [getattr(self, n) for n in self.attr_names]
+                attrstr = ', '.join('%s' % v for v in vlist)
+            buf.write(attrstr)
+
+        if showcoord:
+            buf.write(' (at %s)' % self.coord)
+        buf.write('\n')
+
+        for (child_name, child) in self.children():
+            child.show(
+                buf,
+                offset=offset + 2,
+                attrnames=attrnames,
+                nodenames=nodenames,
+                showcoord=showcoord,
+                _my_node_name=child_name)
+
+
+class NodeVisitor(object):
+    """ A base NodeVisitor class for visiting c_ast nodes.
+        Subclass it and define your own visit_XXX methods, where
+        XXX is the class name you want to visit with these
+        methods.
+
+        For example:
+
+        class ConstantVisitor(NodeVisitor):
+            def __init__(self):
+                self.values = []
+
+            def visit_Constant(self, node):
+                self.values.append(node.value)
+
+        Creates a list of values of all the constant nodes
+        encountered below the given node. To use it:
+
+        cv = ConstantVisitor()
+        cv.visit(node)
+
+        Notes:
+
+        *   generic_visit() will be called for AST nodes for which
+            no visit_XXX method was defined.
+        *   The children of nodes for which a visit_XXX was
+            defined will not be visited - if you need this, call
+            generic_visit() on the node.
+            You can use:
+                NodeVisitor.generic_visit(self, node)
+        *   Modeled after Python's own AST visiting facilities
+            (the ast module of Python 3.0)
+    """
+
+    _method_cache = None
+
+    def visit(self, node):
+        """ Visit a node.
+        """
+
+        if self._method_cache is None:
+            self._method_cache = {}
+
+        visitor = self._method_cache.get(node.__class__.__name__, None)
+        if visitor is None:
+            method = 'visit_' + node.__class__.__name__
+            visitor = getattr(self, method, self.generic_visit)
+            self._method_cache[node.__class__.__name__] = visitor
+
+        return visitor(node)
+
+    def generic_visit(self, node):
+        """ Called if no explicit visitor function exists for a
+            node. Implements preorder visiting of the node.
+        """
+        for c in node:
+            self.visit(c)
+
+class ArrayDecl(Node):
+    __slots__ = ('type', 'dim', 'dim_quals', 'coord', '__weakref__')
+    def __init__(self, type, dim, dim_quals, coord=None):
+        self.type = type
+        self.dim = dim
+        self.dim_quals = dim_quals
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        if self.dim is not None: nodelist.append(("dim", self.dim))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+        if self.dim is not None:
+            yield self.dim
+
+    attr_names = ('dim_quals', )
+
+class ArrayRef(Node):
+    __slots__ = ('name', 'subscript', 'coord', '__weakref__')
+    def __init__(self, name, subscript, coord=None):
+        self.name = name
+        self.subscript = subscript
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.name is not None: nodelist.append(("name", self.name))
+        if self.subscript is not None: nodelist.append(("subscript", self.subscript))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.name is not None:
+            yield self.name
+        if self.subscript is not None:
+            yield self.subscript
+
+    attr_names = ()
+
+class Assignment(Node):
+    __slots__ = ('op', 'lvalue', 'rvalue', 'coord', '__weakref__')
+    def __init__(self, op, lvalue, rvalue, coord=None):
+        self.op = op
+        self.lvalue = lvalue
+        self.rvalue = rvalue
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.lvalue is not None: nodelist.append(("lvalue", self.lvalue))
+        if self.rvalue is not None: nodelist.append(("rvalue", self.rvalue))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.lvalue is not None:
+            yield self.lvalue
+        if self.rvalue is not None:
+            yield self.rvalue
+
+    attr_names = ('op', )
+
+class Alignas(Node):
+    __slots__ = ('alignment', 'coord', '__weakref__')
+    def __init__(self, alignment, coord=None):
+        self.alignment = alignment
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.alignment is not None: nodelist.append(("alignment", self.alignment))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.alignment is not None:
+            yield self.alignment
+
+    attr_names = ()
+
+class BinaryOp(Node):
+    __slots__ = ('op', 'left', 'right', 'coord', '__weakref__')
+    def __init__(self, op, left, right, coord=None):
+        self.op = op
+        self.left = left
+        self.right = right
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.left is not None: nodelist.append(("left", self.left))
+        if self.right is not None: nodelist.append(("right", self.right))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.left is not None:
+            yield self.left
+        if self.right is not None:
+            yield self.right
+
+    attr_names = ('op', )
+
+class Break(Node):
+    __slots__ = ('coord', '__weakref__')
+    def __init__(self, coord=None):
+        self.coord = coord
+
+    def children(self):
+        return ()
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ()
+
+class Case(Node):
+    __slots__ = ('expr', 'stmts', 'coord', '__weakref__')
+    def __init__(self, expr, stmts, coord=None):
+        self.expr = expr
+        self.stmts = stmts
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.expr is not None: nodelist.append(("expr", self.expr))
+        for i, child in enumerate(self.stmts or []):
+            nodelist.append(("stmts[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.expr is not None:
+            yield self.expr
+        for child in (self.stmts or []):
+            yield child
+
+    attr_names = ()
+
+class Cast(Node):
+    __slots__ = ('to_type', 'expr', 'coord', '__weakref__')
+    def __init__(self, to_type, expr, coord=None):
+        self.to_type = to_type
+        self.expr = expr
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.to_type is not None: nodelist.append(("to_type", self.to_type))
+        if self.expr is not None: nodelist.append(("expr", self.expr))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.to_type is not None:
+            yield self.to_type
+        if self.expr is not None:
+            yield self.expr
+
+    attr_names = ()
+
+class Compound(Node):
+    __slots__ = ('block_items', 'coord', '__weakref__')
+    def __init__(self, block_items, coord=None):
+        self.block_items = block_items
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.block_items or []):
+            nodelist.append(("block_items[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.block_items or []):
+            yield child
+
+    attr_names = ()
+
+class CompoundLiteral(Node):
+    __slots__ = ('type', 'init', 'coord', '__weakref__')
+    def __init__(self, type, init, coord=None):
+        self.type = type
+        self.init = init
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        if self.init is not None: nodelist.append(("init", self.init))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+        if self.init is not None:
+            yield self.init
+
+    attr_names = ()
+
+class Constant(Node):
+    __slots__ = ('type', 'value', 'coord', '__weakref__')
+    def __init__(self, type, value, coord=None):
+        self.type = type
+        self.value = value
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        return tuple(nodelist)
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ('type', 'value', )
+
+class Continue(Node):
+    __slots__ = ('coord', '__weakref__')
+    def __init__(self, coord=None):
+        self.coord = coord
+
+    def children(self):
+        return ()
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ()
+
+class Decl(Node):
+    __slots__ = ('name', 'quals', 'align', 'storage', 'funcspec', 'type', 'init', 'bitsize', 'coord', '__weakref__')
+    def __init__(self, name, quals, align, storage, funcspec, type, init, bitsize, coord=None):
+        self.name = name
+        self.quals = quals
+        self.align = align
+        self.storage = storage
+        self.funcspec = funcspec
+        self.type = type
+        self.init = init
+        self.bitsize = bitsize
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        if self.init is not None: nodelist.append(("init", self.init))
+        if self.bitsize is not None: nodelist.append(("bitsize", self.bitsize))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+        if self.init is not None:
+            yield self.init
+        if self.bitsize is not None:
+            yield self.bitsize
+
+    attr_names = ('name', 'quals', 'align', 'storage', 'funcspec', )
+
+class DeclList(Node):
+    __slots__ = ('decls', 'coord', '__weakref__')
+    def __init__(self, decls, coord=None):
+        self.decls = decls
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.decls or []):
+            nodelist.append(("decls[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.decls or []):
+            yield child
+
+    attr_names = ()
+
+class Default(Node):
+    __slots__ = ('stmts', 'coord', '__weakref__')
+    def __init__(self, stmts, coord=None):
+        self.stmts = stmts
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.stmts or []):
+            nodelist.append(("stmts[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.stmts or []):
+            yield child
+
+    attr_names = ()
+
+class DoWhile(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
+    def __init__(self, cond, stmt, coord=None):
+        self.cond = cond
+        self.stmt = stmt
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.stmt is not None: nodelist.append(("stmt", self.stmt))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.stmt is not None:
+            yield self.stmt
+
+    attr_names = ()
+
+class EllipsisParam(Node):
+    __slots__ = ('coord', '__weakref__')
+    def __init__(self, coord=None):
+        self.coord = coord
+
+    def children(self):
+        return ()
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ()
+
+class EmptyStatement(Node):
+    __slots__ = ('coord', '__weakref__')
+    def __init__(self, coord=None):
+        self.coord = coord
+
+    def children(self):
+        return ()
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ()
+
+class Enum(Node):
+    __slots__ = ('name', 'values', 'coord', '__weakref__')
+    def __init__(self, name, values, coord=None):
+        self.name = name
+        self.values = values
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.values is not None: nodelist.append(("values", self.values))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.values is not None:
+            yield self.values
+
+    attr_names = ('name', )
+
+class Enumerator(Node):
+    __slots__ = ('name', 'value', 'coord', '__weakref__')
+    def __init__(self, name, value, coord=None):
+        self.name = name
+        self.value = value
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.value is not None: nodelist.append(("value", self.value))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.value is not None:
+            yield self.value
+
+    attr_names = ('name', )
+
+class EnumeratorList(Node):
+    __slots__ = ('enumerators', 'coord', '__weakref__')
+    def __init__(self, enumerators, coord=None):
+        self.enumerators = enumerators
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.enumerators or []):
+            nodelist.append(("enumerators[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.enumerators or []):
+            yield child
+
+    attr_names = ()
+
+class ExprList(Node):
+    __slots__ = ('exprs', 'coord', '__weakref__')
+    def __init__(self, exprs, coord=None):
+        self.exprs = exprs
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.exprs or []):
+            nodelist.append(("exprs[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.exprs or []):
+            yield child
+
+    attr_names = ()
+
+class FileAST(Node):
+    __slots__ = ('ext', 'coord', '__weakref__')
+    def __init__(self, ext, coord=None):
+        self.ext = ext
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.ext or []):
+            nodelist.append(("ext[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.ext or []):
+            yield child
+
+    attr_names = ()
+
+class For(Node):
+    __slots__ = ('init', 'cond', 'next', 'stmt', 'coord', '__weakref__')
+    def __init__(self, init, cond, next, stmt, coord=None):
+        self.init = init
+        self.cond = cond
+        self.next = next
+        self.stmt = stmt
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.init is not None: nodelist.append(("init", self.init))
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.next is not None: nodelist.append(("next", self.next))
+        if self.stmt is not None: nodelist.append(("stmt", self.stmt))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.init is not None:
+            yield self.init
+        if self.cond is not None:
+            yield self.cond
+        if self.next is not None:
+            yield self.next
+        if self.stmt is not None:
+            yield self.stmt
+
+    attr_names = ()
+
+class FuncCall(Node):
+    __slots__ = ('name', 'args', 'coord', '__weakref__')
+    def __init__(self, name, args, coord=None):
+        self.name = name
+        self.args = args
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.name is not None: nodelist.append(("name", self.name))
+        if self.args is not None: nodelist.append(("args", self.args))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.name is not None:
+            yield self.name
+        if self.args is not None:
+            yield self.args
+
+    attr_names = ()
+
+class FuncDecl(Node):
+    __slots__ = ('args', 'type', 'coord', '__weakref__')
+    def __init__(self, args, type, coord=None):
+        self.args = args
+        self.type = type
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.args is not None: nodelist.append(("args", self.args))
+        if self.type is not None: nodelist.append(("type", self.type))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.args is not None:
+            yield self.args
+        if self.type is not None:
+            yield self.type
+
+    attr_names = ()
+
+class FuncDef(Node):
+    __slots__ = ('decl', 'param_decls', 'body', 'coord', '__weakref__')
+    def __init__(self, decl, param_decls, body, coord=None):
+        self.decl = decl
+        self.param_decls = param_decls
+        self.body = body
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.decl is not None: nodelist.append(("decl", self.decl))
+        if self.body is not None: nodelist.append(("body", self.body))
+        for i, child in enumerate(self.param_decls or []):
+            nodelist.append(("param_decls[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.decl is not None:
+            yield self.decl
+        if self.body is not None:
+            yield self.body
+        for child in (self.param_decls or []):
+            yield child
+
+    attr_names = ()
+
+class Goto(Node):
+    __slots__ = ('name', 'coord', '__weakref__')
+    def __init__(self, name, coord=None):
+        self.name = name
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        return tuple(nodelist)
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ('name', )
+
+class ID(Node):
+    __slots__ = ('name', 'coord', '__weakref__')
+    def __init__(self, name, coord=None):
+        self.name = name
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        return tuple(nodelist)
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ('name', )
+
+class IdentifierType(Node):
+    __slots__ = ('names', 'coord', '__weakref__')
+    def __init__(self, names, coord=None):
+        self.names = names
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        return tuple(nodelist)
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ('names', )
+
+class If(Node):
+    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
+    def __init__(self, cond, iftrue, iffalse, coord=None):
+        self.cond = cond
+        self.iftrue = iftrue
+        self.iffalse = iffalse
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue))
+        if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.iftrue is not None:
+            yield self.iftrue
+        if self.iffalse is not None:
+            yield self.iffalse
+
+    attr_names = ()
+
+class InitList(Node):
+    __slots__ = ('exprs', 'coord', '__weakref__')
+    def __init__(self, exprs, coord=None):
+        self.exprs = exprs
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.exprs or []):
+            nodelist.append(("exprs[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.exprs or []):
+            yield child
+
+    attr_names = ()
+
+class Label(Node):
+    __slots__ = ('name', 'stmt', 'coord', '__weakref__')
+    def __init__(self, name, stmt, coord=None):
+        self.name = name
+        self.stmt = stmt
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.stmt is not None: nodelist.append(("stmt", self.stmt))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.stmt is not None:
+            yield self.stmt
+
+    attr_names = ('name', )
+
+class NamedInitializer(Node):
+    __slots__ = ('name', 'expr', 'coord', '__weakref__')
+    def __init__(self, name, expr, coord=None):
+        self.name = name
+        self.expr = expr
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.expr is not None: nodelist.append(("expr", self.expr))
+        for i, child in enumerate(self.name or []):
+            nodelist.append(("name[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.expr is not None:
+            yield self.expr
+        for child in (self.name or []):
+            yield child
+
+    attr_names = ()
+
+class ParamList(Node):
+    __slots__ = ('params', 'coord', '__weakref__')
+    def __init__(self, params, coord=None):
+        self.params = params
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.params or []):
+            nodelist.append(("params[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.params or []):
+            yield child
+
+    attr_names = ()
+
+class PtrDecl(Node):
+    __slots__ = ('quals', 'type', 'coord', '__weakref__')
+    def __init__(self, quals, type, coord=None):
+        self.quals = quals
+        self.type = type
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+
+    attr_names = ('quals', )
+
+class Return(Node):
+    __slots__ = ('expr', 'coord', '__weakref__')
+    def __init__(self, expr, coord=None):
+        self.expr = expr
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.expr is not None: nodelist.append(("expr", self.expr))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.expr is not None:
+            yield self.expr
+
+    attr_names = ()
+
+class StaticAssert(Node):
+    __slots__ = ('cond', 'message', 'coord', '__weakref__')
+    def __init__(self, cond, message, coord=None):
+        self.cond = cond
+        self.message = message
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.message is not None: nodelist.append(("message", self.message))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.message is not None:
+            yield self.message
+
+    attr_names = ()
+
+class Struct(Node):
+    __slots__ = ('name', 'decls', 'coord', '__weakref__')
+    def __init__(self, name, decls, coord=None):
+        self.name = name
+        self.decls = decls
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.decls or []):
+            nodelist.append(("decls[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.decls or []):
+            yield child
+
+    attr_names = ('name', )
+
+class StructRef(Node):
+    __slots__ = ('name', 'type', 'field', 'coord', '__weakref__')
+    def __init__(self, name, type, field, coord=None):
+        self.name = name
+        self.type = type
+        self.field = field
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.name is not None: nodelist.append(("name", self.name))
+        if self.field is not None: nodelist.append(("field", self.field))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.name is not None:
+            yield self.name
+        if self.field is not None:
+            yield self.field
+
+    attr_names = ('type', )
+
+class Switch(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
+    def __init__(self, cond, stmt, coord=None):
+        self.cond = cond
+        self.stmt = stmt
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.stmt is not None: nodelist.append(("stmt", self.stmt))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.stmt is not None:
+            yield self.stmt
+
+    attr_names = ()
+
+class TernaryOp(Node):
+    __slots__ = ('cond', 'iftrue', 'iffalse', 'coord', '__weakref__')
+    def __init__(self, cond, iftrue, iffalse, coord=None):
+        self.cond = cond
+        self.iftrue = iftrue
+        self.iffalse = iffalse
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.iftrue is not None: nodelist.append(("iftrue", self.iftrue))
+        if self.iffalse is not None: nodelist.append(("iffalse", self.iffalse))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.iftrue is not None:
+            yield self.iftrue
+        if self.iffalse is not None:
+            yield self.iffalse
+
+    attr_names = ()
+
+class TypeDecl(Node):
+    __slots__ = ('declname', 'quals', 'align', 'type', 'coord', '__weakref__')
+    def __init__(self, declname, quals, align, type, coord=None):
+        self.declname = declname
+        self.quals = quals
+        self.align = align
+        self.type = type
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+
+    attr_names = ('declname', 'quals', 'align', )
+
+class Typedef(Node):
+    __slots__ = ('name', 'quals', 'storage', 'type', 'coord', '__weakref__')
+    def __init__(self, name, quals, storage, type, coord=None):
+        self.name = name
+        self.quals = quals
+        self.storage = storage
+        self.type = type
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+
+    attr_names = ('name', 'quals', 'storage', )
+
+class Typename(Node):
+    __slots__ = ('name', 'quals', 'align', 'type', 'coord', '__weakref__')
+    def __init__(self, name, quals, align, type, coord=None):
+        self.name = name
+        self.quals = quals
+        self.align = align
+        self.type = type
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.type is not None: nodelist.append(("type", self.type))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.type is not None:
+            yield self.type
+
+    attr_names = ('name', 'quals', 'align', )
+
+class UnaryOp(Node):
+    __slots__ = ('op', 'expr', 'coord', '__weakref__')
+    def __init__(self, op, expr, coord=None):
+        self.op = op
+        self.expr = expr
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.expr is not None: nodelist.append(("expr", self.expr))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.expr is not None:
+            yield self.expr
+
+    attr_names = ('op', )
+
+class Union(Node):
+    __slots__ = ('name', 'decls', 'coord', '__weakref__')
+    def __init__(self, name, decls, coord=None):
+        self.name = name
+        self.decls = decls
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        for i, child in enumerate(self.decls or []):
+            nodelist.append(("decls[%d]" % i, child))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        for child in (self.decls or []):
+            yield child
+
+    attr_names = ('name', )
+
+class While(Node):
+    __slots__ = ('cond', 'stmt', 'coord', '__weakref__')
+    def __init__(self, cond, stmt, coord=None):
+        self.cond = cond
+        self.stmt = stmt
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        if self.cond is not None: nodelist.append(("cond", self.cond))
+        if self.stmt is not None: nodelist.append(("stmt", self.stmt))
+        return tuple(nodelist)
+
+    def __iter__(self):
+        if self.cond is not None:
+            yield self.cond
+        if self.stmt is not None:
+            yield self.stmt
+
+    attr_names = ()
+
+class Pragma(Node):
+    __slots__ = ('string', 'coord', '__weakref__')
+    def __init__(self, string, coord=None):
+        self.string = string
+        self.coord = coord
+
+    def children(self):
+        nodelist = []
+        return tuple(nodelist)
+
+    def __iter__(self):
+        return
+        yield
+
+    attr_names = ('string', )
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/c_generator.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_generator.py
new file mode 100644
index 0000000000000000000000000000000000000000..1057b2c62e26feb74f2c1d0536de22140579fc8b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_generator.py
@@ -0,0 +1,502 @@
+#------------------------------------------------------------------------------
+# pycparser: c_generator.py
+#
+# C code generator from pycparser AST nodes.
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#------------------------------------------------------------------------------
+from . import c_ast
+
+
+class CGenerator(object):
+    """ Uses the same visitor pattern as c_ast.NodeVisitor, but modified to
+        return a value from each visit method, using string accumulation in
+        generic_visit.
+    """
+    def __init__(self, reduce_parentheses=False):
+        """ Constructs C-code generator
+
+            reduce_parentheses:
+                if True, eliminates needless parentheses on binary operators
+        """
+        # Statements start with indentation of self.indent_level spaces, using
+        # the _make_indent method.
+        self.indent_level = 0
+        self.reduce_parentheses = reduce_parentheses
+
+    def _make_indent(self):
+        return ' ' * self.indent_level
+
+    def visit(self, node):
+        method = 'visit_' + node.__class__.__name__
+        return getattr(self, method, self.generic_visit)(node)
+
+    def generic_visit(self, node):
+        if node is None:
+            return ''
+        else:
+            return ''.join(self.visit(c) for c_name, c in node.children())
+
+    def visit_Constant(self, n):
+        return n.value
+
+    def visit_ID(self, n):
+        return n.name
+
+    def visit_Pragma(self, n):
+        ret = '#pragma'
+        if n.string:
+            ret += ' ' + n.string
+        return ret
+
+    def visit_ArrayRef(self, n):
+        arrref = self._parenthesize_unless_simple(n.name)
+        return arrref + '[' + self.visit(n.subscript) + ']'
+
+    def visit_StructRef(self, n):
+        sref = self._parenthesize_unless_simple(n.name)
+        return sref + n.type + self.visit(n.field)
+
+    def visit_FuncCall(self, n):
+        fref = self._parenthesize_unless_simple(n.name)
+        return fref + '(' + self.visit(n.args) + ')'
+
+    def visit_UnaryOp(self, n):
+        if n.op == 'sizeof':
+            # Always parenthesize the argument of sizeof since it can be
+            # a name.
+            return 'sizeof(%s)' % self.visit(n.expr)
+        else:
+            operand = self._parenthesize_unless_simple(n.expr)
+            if n.op == 'p++':
+                return '%s++' % operand
+            elif n.op == 'p--':
+                return '%s--' % operand
+            else:
+                return '%s%s' % (n.op, operand)
+
+    # Precedence map of binary operators:
+    precedence_map = {
+        # Should be in sync with c_parser.CParser.precedence
+        # Higher numbers are stronger binding
+        '||': 0,  # weakest binding
+        '&&': 1,
+        '|': 2,
+        '^': 3,
+        '&': 4,
+        '==': 5, '!=': 5,
+        '>': 6, '>=': 6, '<': 6, '<=': 6,
+        '>>': 7, '<<': 7,
+        '+': 8, '-': 8,
+        '*': 9, '/': 9, '%': 9  # strongest binding
+    }
+
+    def visit_BinaryOp(self, n):
+        # Note: all binary operators are left-to-right associative
+        #
+        # If `n.left.op` has a stronger or equally binding precedence in
+        # comparison to `n.op`, no parenthesis are needed for the left:
+        # e.g., `(a*b) + c` is equivalent to `a*b + c`, as well as
+        #       `(a+b) - c` is equivalent to `a+b - c` (same precedence).
+        # If the left operator is weaker binding than the current, then
+        # parentheses are necessary:
+        # e.g., `(a+b) * c` is NOT equivalent to `a+b * c`.
+        lval_str = self._parenthesize_if(
+            n.left,
+            lambda d: not (self._is_simple_node(d) or
+                      self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and
+                      self.precedence_map[d.op] >= self.precedence_map[n.op]))
+        # If `n.right.op` has a stronger -but not equal- binding precedence,
+        # parenthesis can be omitted on the right:
+        # e.g., `a + (b*c)` is equivalent to `a + b*c`.
+        # If the right operator is weaker or equally binding, then parentheses
+        # are necessary:
+        # e.g., `a * (b+c)` is NOT equivalent to `a * b+c` and
+        #       `a - (b+c)` is NOT equivalent to `a - b+c` (same precedence).
+        rval_str = self._parenthesize_if(
+            n.right,
+            lambda d: not (self._is_simple_node(d) or
+                      self.reduce_parentheses and isinstance(d, c_ast.BinaryOp) and
+                      self.precedence_map[d.op] > self.precedence_map[n.op]))
+        return '%s %s %s' % (lval_str, n.op, rval_str)
+
+    def visit_Assignment(self, n):
+        rval_str = self._parenthesize_if(
+                            n.rvalue,
+                            lambda n: isinstance(n, c_ast.Assignment))
+        return '%s %s %s' % (self.visit(n.lvalue), n.op, rval_str)
+
+    def visit_IdentifierType(self, n):
+        return ' '.join(n.names)
+
+    def _visit_expr(self, n):
+        if isinstance(n, c_ast.InitList):
+            return '{' + self.visit(n) + '}'
+        elif isinstance(n, c_ast.ExprList):
+            return '(' + self.visit(n) + ')'
+        else:
+            return self.visit(n)
+
+    def visit_Decl(self, n, no_type=False):
+        # no_type is used when a Decl is part of a DeclList, where the type is
+        # explicitly only for the first declaration in a list.
+        #
+        s = n.name if no_type else self._generate_decl(n)
+        if n.bitsize: s += ' : ' + self.visit(n.bitsize)
+        if n.init:
+            s += ' = ' + self._visit_expr(n.init)
+        return s
+
+    def visit_DeclList(self, n):
+        s = self.visit(n.decls[0])
+        if len(n.decls) > 1:
+            s += ', ' + ', '.join(self.visit_Decl(decl, no_type=True)
+                                    for decl in n.decls[1:])
+        return s
+
+    def visit_Typedef(self, n):
+        s = ''
+        if n.storage: s += ' '.join(n.storage) + ' '
+        s += self._generate_type(n.type)
+        return s
+
+    def visit_Cast(self, n):
+        s = '(' + self._generate_type(n.to_type, emit_declname=False) + ')'
+        return s + ' ' + self._parenthesize_unless_simple(n.expr)
+
+    def visit_ExprList(self, n):
+        visited_subexprs = []
+        for expr in n.exprs:
+            visited_subexprs.append(self._visit_expr(expr))
+        return ', '.join(visited_subexprs)
+
+    def visit_InitList(self, n):
+        visited_subexprs = []
+        for expr in n.exprs:
+            visited_subexprs.append(self._visit_expr(expr))
+        return ', '.join(visited_subexprs)
+
+    def visit_Enum(self, n):
+        return self._generate_struct_union_enum(n, name='enum')
+
+    def visit_Alignas(self, n):
+        return '_Alignas({})'.format(self.visit(n.alignment))
+
+    def visit_Enumerator(self, n):
+        if not n.value:
+            return '{indent}{name},\n'.format(
+                indent=self._make_indent(),
+                name=n.name,
+            )
+        else:
+            return '{indent}{name} = {value},\n'.format(
+                indent=self._make_indent(),
+                name=n.name,
+                value=self.visit(n.value),
+            )
+
+    def visit_FuncDef(self, n):
+        decl = self.visit(n.decl)
+        self.indent_level = 0
+        body = self.visit(n.body)
+        if n.param_decls:
+            knrdecls = ';\n'.join(self.visit(p) for p in n.param_decls)
+            return decl + '\n' + knrdecls + ';\n' + body + '\n'
+        else:
+            return decl + '\n' + body + '\n'
+
+    def visit_FileAST(self, n):
+        s = ''
+        for ext in n.ext:
+            if isinstance(ext, c_ast.FuncDef):
+                s += self.visit(ext)
+            elif isinstance(ext, c_ast.Pragma):
+                s += self.visit(ext) + '\n'
+            else:
+                s += self.visit(ext) + ';\n'
+        return s
+
+    def visit_Compound(self, n):
+        s = self._make_indent() + '{\n'
+        self.indent_level += 2
+        if n.block_items:
+            s += ''.join(self._generate_stmt(stmt) for stmt in n.block_items)
+        self.indent_level -= 2
+        s += self._make_indent() + '}\n'
+        return s
+
+    def visit_CompoundLiteral(self, n):
+        return '(' + self.visit(n.type) + '){' + self.visit(n.init) + '}'
+
+
+    def visit_EmptyStatement(self, n):
+        return ';'
+
+    def visit_ParamList(self, n):
+        return ', '.join(self.visit(param) for param in n.params)
+
+    def visit_Return(self, n):
+        s = 'return'
+        if n.expr: s += ' ' + self.visit(n.expr)
+        return s + ';'
+
+    def visit_Break(self, n):
+        return 'break;'
+
+    def visit_Continue(self, n):
+        return 'continue;'
+
+    def visit_TernaryOp(self, n):
+        s  = '(' + self._visit_expr(n.cond) + ') ? '
+        s += '(' + self._visit_expr(n.iftrue) + ') : '
+        s += '(' + self._visit_expr(n.iffalse) + ')'
+        return s
+
+    def visit_If(self, n):
+        s = 'if ('
+        if n.cond: s += self.visit(n.cond)
+        s += ')\n'
+        s += self._generate_stmt(n.iftrue, add_indent=True)
+        if n.iffalse:
+            s += self._make_indent() + 'else\n'
+            s += self._generate_stmt(n.iffalse, add_indent=True)
+        return s
+
+    def visit_For(self, n):
+        s = 'for ('
+        if n.init: s += self.visit(n.init)
+        s += ';'
+        if n.cond: s += ' ' + self.visit(n.cond)
+        s += ';'
+        if n.next: s += ' ' + self.visit(n.next)
+        s += ')\n'
+        s += self._generate_stmt(n.stmt, add_indent=True)
+        return s
+
+    def visit_While(self, n):
+        s = 'while ('
+        if n.cond: s += self.visit(n.cond)
+        s += ')\n'
+        s += self._generate_stmt(n.stmt, add_indent=True)
+        return s
+
+    def visit_DoWhile(self, n):
+        s = 'do\n'
+        s += self._generate_stmt(n.stmt, add_indent=True)
+        s += self._make_indent() + 'while ('
+        if n.cond: s += self.visit(n.cond)
+        s += ');'
+        return s
+
+    def visit_StaticAssert(self, n):
+        s = '_Static_assert('
+        s += self.visit(n.cond)
+        if n.message:
+            s += ','
+            s += self.visit(n.message)
+        s += ')'
+        return s
+
+    def visit_Switch(self, n):
+        s = 'switch (' + self.visit(n.cond) + ')\n'
+        s += self._generate_stmt(n.stmt, add_indent=True)
+        return s
+
+    def visit_Case(self, n):
+        s = 'case ' + self.visit(n.expr) + ':\n'
+        for stmt in n.stmts:
+            s += self._generate_stmt(stmt, add_indent=True)
+        return s
+
+    def visit_Default(self, n):
+        s = 'default:\n'
+        for stmt in n.stmts:
+            s += self._generate_stmt(stmt, add_indent=True)
+        return s
+
+    def visit_Label(self, n):
+        return n.name + ':\n' + self._generate_stmt(n.stmt)
+
+    def visit_Goto(self, n):
+        return 'goto ' + n.name + ';'
+
+    def visit_EllipsisParam(self, n):
+        return '...'
+
+    def visit_Struct(self, n):
+        return self._generate_struct_union_enum(n, 'struct')
+
+    def visit_Typename(self, n):
+        return self._generate_type(n.type)
+
+    def visit_Union(self, n):
+        return self._generate_struct_union_enum(n, 'union')
+
+    def visit_NamedInitializer(self, n):
+        s = ''
+        for name in n.name:
+            if isinstance(name, c_ast.ID):
+                s += '.' + name.name
+            else:
+                s += '[' + self.visit(name) + ']'
+        s += ' = ' + self._visit_expr(n.expr)
+        return s
+
+    def visit_FuncDecl(self, n):
+        return self._generate_type(n)
+
+    def visit_ArrayDecl(self, n):
+        return self._generate_type(n, emit_declname=False)
+
+    def visit_TypeDecl(self, n):
+        return self._generate_type(n, emit_declname=False)
+
+    def visit_PtrDecl(self, n):
+        return self._generate_type(n, emit_declname=False)
+
+    def _generate_struct_union_enum(self, n, name):
+        """ Generates code for structs, unions, and enums. name should be
+            'struct', 'union', or 'enum'.
+        """
+        if name in ('struct', 'union'):
+            members = n.decls
+            body_function = self._generate_struct_union_body
+        else:
+            assert name == 'enum'
+            members = None if n.values is None else n.values.enumerators
+            body_function = self._generate_enum_body
+        s = name + ' ' + (n.name or '')
+        if members is not None:
+            # None means no members
+            # Empty sequence means an empty list of members
+            s += '\n'
+            s += self._make_indent()
+            self.indent_level += 2
+            s += '{\n'
+            s += body_function(members)
+            self.indent_level -= 2
+            s += self._make_indent() + '}'
+        return s
+
+    def _generate_struct_union_body(self, members):
+        return ''.join(self._generate_stmt(decl) for decl in members)
+
+    def _generate_enum_body(self, members):
+        # `[:-2] + '\n'` removes the final `,` from the enumerator list
+        return ''.join(self.visit(value) for value in members)[:-2] + '\n'
+
+    def _generate_stmt(self, n, add_indent=False):
+        """ Generation from a statement node. This method exists as a wrapper
+            for individual visit_* methods to handle different treatment of
+            some statements in this context.
+        """
+        typ = type(n)
+        if add_indent: self.indent_level += 2
+        indent = self._make_indent()
+        if add_indent: self.indent_level -= 2
+
+        if typ in (
+                c_ast.Decl, c_ast.Assignment, c_ast.Cast, c_ast.UnaryOp,
+                c_ast.BinaryOp, c_ast.TernaryOp, c_ast.FuncCall, c_ast.ArrayRef,
+                c_ast.StructRef, c_ast.Constant, c_ast.ID, c_ast.Typedef,
+                c_ast.ExprList):
+            # These can also appear in an expression context so no semicolon
+            # is added to them automatically
+            #
+            return indent + self.visit(n) + ';\n'
+        elif typ in (c_ast.Compound,):
+            # No extra indentation required before the opening brace of a
+            # compound - because it consists of multiple lines it has to
+            # compute its own indentation.
+            #
+            return self.visit(n)
+        elif typ in (c_ast.If,):
+            return indent + self.visit(n)
+        else:
+            return indent + self.visit(n) + '\n'
+
+    def _generate_decl(self, n):
+        """ Generation from a Decl node.
+        """
+        s = ''
+        if n.funcspec: s = ' '.join(n.funcspec) + ' '
+        if n.storage: s += ' '.join(n.storage) + ' '
+        if n.align: s += self.visit(n.align[0]) + ' '
+        s += self._generate_type(n.type)
+        return s
+
+    def _generate_type(self, n, modifiers=[], emit_declname = True):
+        """ Recursive generation from a type node. n is the type node.
+            modifiers collects the PtrDecl, ArrayDecl and FuncDecl modifiers
+            encountered on the way down to a TypeDecl, to allow proper
+            generation from it.
+        """
+        typ = type(n)
+        #~ print(n, modifiers)
+
+        if typ == c_ast.TypeDecl:
+            s = ''
+            if n.quals: s += ' '.join(n.quals) + ' '
+            s += self.visit(n.type)
+
+            nstr = n.declname if n.declname and emit_declname else ''
+            # Resolve modifiers.
+            # Wrap in parens to distinguish pointer to array and pointer to
+            # function syntax.
+            #
+            for i, modifier in enumerate(modifiers):
+                if isinstance(modifier, c_ast.ArrayDecl):
+                    if (i != 0 and
+                        isinstance(modifiers[i - 1], c_ast.PtrDecl)):
+                            nstr = '(' + nstr + ')'
+                    nstr += '['
+                    if modifier.dim_quals:
+                        nstr += ' '.join(modifier.dim_quals) + ' '
+                    nstr += self.visit(modifier.dim) + ']'
+                elif isinstance(modifier, c_ast.FuncDecl):
+                    if (i != 0 and
+                        isinstance(modifiers[i - 1], c_ast.PtrDecl)):
+                            nstr = '(' + nstr + ')'
+                    nstr += '(' + self.visit(modifier.args) + ')'
+                elif isinstance(modifier, c_ast.PtrDecl):
+                    if modifier.quals:
+                        nstr = '* %s%s' % (' '.join(modifier.quals),
+                                           ' ' + nstr if nstr else '')
+                    else:
+                        nstr = '*' + nstr
+            if nstr: s += ' ' + nstr
+            return s
+        elif typ == c_ast.Decl:
+            return self._generate_decl(n.type)
+        elif typ == c_ast.Typename:
+            return self._generate_type(n.type, emit_declname = emit_declname)
+        elif typ == c_ast.IdentifierType:
+            return ' '.join(n.names) + ' '
+        elif typ in (c_ast.ArrayDecl, c_ast.PtrDecl, c_ast.FuncDecl):
+            return self._generate_type(n.type, modifiers + [n],
+                                       emit_declname = emit_declname)
+        else:
+            return self.visit(n)
+
+    def _parenthesize_if(self, n, condition):
+        """ Visits 'n' and returns its string representation, parenthesized
+            if the condition function applied to the node returns True.
+        """
+        s = self._visit_expr(n)
+        if condition(n):
+            return '(' + s + ')'
+        else:
+            return s
+
+    def _parenthesize_unless_simple(self, n):
+        """ Common use case for _parenthesize_if
+        """
+        return self._parenthesize_if(n, lambda d: not self._is_simple_node(d))
+
+    def _is_simple_node(self, n):
+        """ Returns True for nodes that are "simple" - i.e. nodes that always
+            have higher precedence than operators.
+        """
+        return isinstance(n, (c_ast.Constant, c_ast.ID, c_ast.ArrayRef,
+                              c_ast.StructRef, c_ast.FuncCall))
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/c_lexer.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_lexer.py
new file mode 100644
index 0000000000000000000000000000000000000000..d68d8ebfa3b3a108c7ef515846d1e35c0f6922d8
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_lexer.py
@@ -0,0 +1,554 @@
+#------------------------------------------------------------------------------
+# pycparser: c_lexer.py
+#
+# CLexer class: lexer for the C language
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#------------------------------------------------------------------------------
+import re
+
+from .ply import lex
+from .ply.lex import TOKEN
+
+
+class CLexer(object):
+    """ A lexer for the C language. After building it, set the
+        input text with input(), and call token() to get new
+        tokens.
+
+        The public attribute filename can be set to an initial
+        filename, but the lexer will update it upon #line
+        directives.
+    """
+    def __init__(self, error_func, on_lbrace_func, on_rbrace_func,
+                 type_lookup_func):
+        """ Create a new Lexer.
+
+            error_func:
+                An error function. Will be called with an error
+                message, line and column as arguments, in case of
+                an error during lexing.
+
+            on_lbrace_func, on_rbrace_func:
+                Called when an LBRACE or RBRACE is encountered
+                (likely to push/pop type_lookup_func's scope)
+
+            type_lookup_func:
+                A type lookup function. Given a string, it must
+                return True IFF this string is a name of a type
+                that was defined with a typedef earlier.
+        """
+        self.error_func = error_func
+        self.on_lbrace_func = on_lbrace_func
+        self.on_rbrace_func = on_rbrace_func
+        self.type_lookup_func = type_lookup_func
+        self.filename = ''
+
+        # Keeps track of the last token returned from self.token()
+        self.last_token = None
+
+        # Allow either "# line" or "# <num>" to support GCC's
+        # cpp output
+        #
+        self.line_pattern = re.compile(r'([ \t]*line\W)|([ \t]*\d+)')
+        self.pragma_pattern = re.compile(r'[ \t]*pragma\W')
+
+    def build(self, **kwargs):
+        """ Builds the lexer from the specification. Must be
+            called after the lexer object is created.
+
+            This method exists separately, because the PLY
+            manual warns against calling lex.lex inside
+            __init__
+        """
+        self.lexer = lex.lex(object=self, **kwargs)
+
+    def reset_lineno(self):
+        """ Resets the internal line number counter of the lexer.
+        """
+        self.lexer.lineno = 1
+
+    def input(self, text):
+        self.lexer.input(text)
+
+    def token(self):
+        self.last_token = self.lexer.token()
+        return self.last_token
+
+    def find_tok_column(self, token):
+        """ Find the column of the token in its line.
+        """
+        last_cr = self.lexer.lexdata.rfind('\n', 0, token.lexpos)
+        return token.lexpos - last_cr
+
+    ######################--   PRIVATE   --######################
+
+    ##
+    ## Internal auxiliary methods
+    ##
+    def _error(self, msg, token):
+        location = self._make_tok_location(token)
+        self.error_func(msg, location[0], location[1])
+        self.lexer.skip(1)
+
+    def _make_tok_location(self, token):
+        return (token.lineno, self.find_tok_column(token))
+
+    ##
+    ## Reserved keywords
+    ##
+    keywords = (
+        'AUTO', 'BREAK', 'CASE', 'CHAR', 'CONST',
+        'CONTINUE', 'DEFAULT', 'DO', 'DOUBLE', 'ELSE', 'ENUM', 'EXTERN',
+        'FLOAT', 'FOR', 'GOTO', 'IF', 'INLINE', 'INT', 'LONG',
+        'REGISTER', 'OFFSETOF',
+        'RESTRICT', 'RETURN', 'SHORT', 'SIGNED', 'SIZEOF', 'STATIC', 'STRUCT',
+        'SWITCH', 'TYPEDEF', 'UNION', 'UNSIGNED', 'VOID',
+        'VOLATILE', 'WHILE', '__INT128',
+    )
+
+    keywords_new = (
+        '_BOOL', '_COMPLEX',
+        '_NORETURN', '_THREAD_LOCAL', '_STATIC_ASSERT',
+        '_ATOMIC', '_ALIGNOF', '_ALIGNAS',
+        )
+
+    keyword_map = {}
+
+    for keyword in keywords:
+        keyword_map[keyword.lower()] = keyword
+
+    for keyword in keywords_new:
+        keyword_map[keyword[:2].upper() + keyword[2:].lower()] = keyword
+
+    ##
+    ## All the tokens recognized by the lexer
+    ##
+    tokens = keywords + keywords_new + (
+        # Identifiers
+        'ID',
+
+        # Type identifiers (identifiers previously defined as
+        # types with typedef)
+        'TYPEID',
+
+        # constants
+        'INT_CONST_DEC', 'INT_CONST_OCT', 'INT_CONST_HEX', 'INT_CONST_BIN', 'INT_CONST_CHAR',
+        'FLOAT_CONST', 'HEX_FLOAT_CONST',
+        'CHAR_CONST',
+        'WCHAR_CONST',
+        'U8CHAR_CONST',
+        'U16CHAR_CONST',
+        'U32CHAR_CONST',
+
+        # String literals
+        'STRING_LITERAL',
+        'WSTRING_LITERAL',
+        'U8STRING_LITERAL',
+        'U16STRING_LITERAL',
+        'U32STRING_LITERAL',
+
+        # Operators
+        'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MOD',
+        'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',
+        'LOR', 'LAND', 'LNOT',
+        'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',
+
+        # Assignment
+        'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL',
+        'PLUSEQUAL', 'MINUSEQUAL',
+        'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL',
+        'OREQUAL',
+
+        # Increment/decrement
+        'PLUSPLUS', 'MINUSMINUS',
+
+        # Structure dereference (->)
+        'ARROW',
+
+        # Conditional operator (?)
+        'CONDOP',
+
+        # Delimiters
+        'LPAREN', 'RPAREN',         # ( )
+        'LBRACKET', 'RBRACKET',     # [ ]
+        'LBRACE', 'RBRACE',         # { }
+        'COMMA', 'PERIOD',          # . ,
+        'SEMI', 'COLON',            # ; :
+
+        # Ellipsis (...)
+        'ELLIPSIS',
+
+        # pre-processor
+        'PPHASH',       # '#'
+        'PPPRAGMA',     # 'pragma'
+        'PPPRAGMASTR',
+    )
+
+    ##
+    ## Regexes for use in tokens
+    ##
+    ##
+
+    # valid C identifiers (K&R2: A.2.3), plus '$' (supported by some compilers)
+    identifier = r'[a-zA-Z_$][0-9a-zA-Z_$]*'
+
+    hex_prefix = '0[xX]'
+    hex_digits = '[0-9a-fA-F]+'
+    bin_prefix = '0[bB]'
+    bin_digits = '[01]+'
+
+    # integer constants (K&R2: A.2.5.1)
+    integer_suffix_opt = r'(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?'
+    decimal_constant = '(0'+integer_suffix_opt+')|([1-9][0-9]*'+integer_suffix_opt+')'
+    octal_constant = '0[0-7]*'+integer_suffix_opt
+    hex_constant = hex_prefix+hex_digits+integer_suffix_opt
+    bin_constant = bin_prefix+bin_digits+integer_suffix_opt
+
+    bad_octal_constant = '0[0-7]*[89]'
+
+    # character constants (K&R2: A.2.5.2)
+    # Note: a-zA-Z and '.-~^_!=&;,' are allowed as escape chars to support #line
+    # directives with Windows paths as filenames (..\..\dir\file)
+    # For the same reason, decimal_escape allows all digit sequences. We want to
+    # parse all correct code, even if it means to sometimes parse incorrect
+    # code.
+    #
+    # The original regexes were taken verbatim from the C syntax definition,
+    # and were later modified to avoid worst-case exponential running time.
+    #
+    #   simple_escape = r"""([a-zA-Z._~!=&\^\-\\?'"])"""
+    #   decimal_escape = r"""(\d+)"""
+    #   hex_escape = r"""(x[0-9a-fA-F]+)"""
+    #   bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-7])"""
+    #
+    # The following modifications were made to avoid the ambiguity that allowed backtracking:
+    # (https://github.com/eliben/pycparser/issues/61)
+    #
+    # - \x was removed from simple_escape, unless it was not followed by a hex digit, to avoid ambiguity with hex_escape.
+    # - hex_escape allows one or more hex characters, but requires that the next character(if any) is not hex
+    # - decimal_escape allows one or more decimal characters, but requires that the next character(if any) is not a decimal
+    # - bad_escape does not allow any decimals (8-9), to avoid conflicting with the permissive decimal_escape.
+    #
+    # Without this change, python's `re` module would recursively try parsing each ambiguous escape sequence in multiple ways.
+    # e.g. `\123` could be parsed as `\1`+`23`, `\12`+`3`, and `\123`.
+
+    simple_escape = r"""([a-wyzA-Z._~!=&\^\-\\?'"]|x(?![0-9a-fA-F]))"""
+    decimal_escape = r"""(\d+)(?!\d)"""
+    hex_escape = r"""(x[0-9a-fA-F]+)(?![0-9a-fA-F])"""
+    bad_escape = r"""([\\][^a-zA-Z._~^!=&\^\-\\?'"x0-9])"""
+
+    escape_sequence = r"""(\\("""+simple_escape+'|'+decimal_escape+'|'+hex_escape+'))'
+
+    # This complicated regex with lookahead might be slow for strings, so because all of the valid escapes (including \x) allowed
+    # 0 or more non-escaped characters after the first character, simple_escape+decimal_escape+hex_escape got simplified to
+
+    escape_sequence_start_in_string = r"""(\\[0-9a-zA-Z._~!=&\^\-\\?'"])"""
+
+    cconst_char = r"""([^'\\\n]|"""+escape_sequence+')'
+    char_const = "'"+cconst_char+"'"
+    wchar_const = 'L'+char_const
+    u8char_const = 'u8'+char_const
+    u16char_const = 'u'+char_const
+    u32char_const = 'U'+char_const
+    multicharacter_constant = "'"+cconst_char+"{2,4}'"
+    unmatched_quote = "('"+cconst_char+"*\\n)|('"+cconst_char+"*$)"
+    bad_char_const = r"""('"""+cconst_char+"""[^'\n]+')|('')|('"""+bad_escape+r"""[^'\n]*')"""
+
+    # string literals (K&R2: A.2.6)
+    string_char = r"""([^"\\\n]|"""+escape_sequence_start_in_string+')'
+    string_literal = '"'+string_char+'*"'
+    wstring_literal = 'L'+string_literal
+    u8string_literal = 'u8'+string_literal
+    u16string_literal = 'u'+string_literal
+    u32string_literal = 'U'+string_literal
+    bad_string_literal = '"'+string_char+'*'+bad_escape+string_char+'*"'
+
+    # floating constants (K&R2: A.2.5.3)
+    exponent_part = r"""([eE][-+]?[0-9]+)"""
+    fractional_constant = r"""([0-9]*\.[0-9]+)|([0-9]+\.)"""
+    floating_constant = '(((('+fractional_constant+')'+exponent_part+'?)|([0-9]+'+exponent_part+'))[FfLl]?)'
+    binary_exponent_part = r'''([pP][+-]?[0-9]+)'''
+    hex_fractional_constant = '((('+hex_digits+r""")?\."""+hex_digits+')|('+hex_digits+r"""\.))"""
+    hex_floating_constant = '('+hex_prefix+'('+hex_digits+'|'+hex_fractional_constant+')'+binary_exponent_part+'[FfLl]?)'
+
+    ##
+    ## Lexer states: used for preprocessor \n-terminated directives
+    ##
+    states = (
+        # ppline: preprocessor line directives
+        #
+        ('ppline', 'exclusive'),
+
+        # pppragma: pragma
+        #
+        ('pppragma', 'exclusive'),
+    )
+
+    def t_PPHASH(self, t):
+        r'[ \t]*\#'
+        if self.line_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos):
+            t.lexer.begin('ppline')
+            self.pp_line = self.pp_filename = None
+        elif self.pragma_pattern.match(t.lexer.lexdata, pos=t.lexer.lexpos):
+            t.lexer.begin('pppragma')
+        else:
+            t.type = 'PPHASH'
+            return t
+
+    ##
+    ## Rules for the ppline state
+    ##
+    @TOKEN(string_literal)
+    def t_ppline_FILENAME(self, t):
+        if self.pp_line is None:
+            self._error('filename before line number in #line', t)
+        else:
+            self.pp_filename = t.value.lstrip('"').rstrip('"')
+
+    @TOKEN(decimal_constant)
+    def t_ppline_LINE_NUMBER(self, t):
+        if self.pp_line is None:
+            self.pp_line = t.value
+        else:
+            # Ignore: GCC's cpp sometimes inserts a numeric flag
+            # after the file name
+            pass
+
+    def t_ppline_NEWLINE(self, t):
+        r'\n'
+        if self.pp_line is None:
+            self._error('line number missing in #line', t)
+        else:
+            self.lexer.lineno = int(self.pp_line)
+
+            if self.pp_filename is not None:
+                self.filename = self.pp_filename
+
+        t.lexer.begin('INITIAL')
+
+    def t_ppline_PPLINE(self, t):
+        r'line'
+        pass
+
+    t_ppline_ignore = ' \t'
+
+    def t_ppline_error(self, t):
+        self._error('invalid #line directive', t)
+
+    ##
+    ## Rules for the pppragma state
+    ##
+    def t_pppragma_NEWLINE(self, t):
+        r'\n'
+        t.lexer.lineno += 1
+        t.lexer.begin('INITIAL')
+
+    def t_pppragma_PPPRAGMA(self, t):
+        r'pragma'
+        return t
+
+    t_pppragma_ignore = ' \t'
+
+    def t_pppragma_STR(self, t):
+        '.+'
+        t.type = 'PPPRAGMASTR'
+        return t
+
+    def t_pppragma_error(self, t):
+        self._error('invalid #pragma directive', t)
+
+    ##
+    ## Rules for the normal state
+    ##
+    t_ignore = ' \t'
+
+    # Newlines
+    def t_NEWLINE(self, t):
+        r'\n+'
+        t.lexer.lineno += t.value.count("\n")
+
+    # Operators
+    t_PLUS              = r'\+'
+    t_MINUS             = r'-'
+    t_TIMES             = r'\*'
+    t_DIVIDE            = r'/'
+    t_MOD               = r'%'
+    t_OR                = r'\|'
+    t_AND               = r'&'
+    t_NOT               = r'~'
+    t_XOR               = r'\^'
+    t_LSHIFT            = r'<<'
+    t_RSHIFT            = r'>>'
+    t_LOR               = r'\|\|'
+    t_LAND              = r'&&'
+    t_LNOT              = r'!'
+    t_LT                = r'<'
+    t_GT                = r'>'
+    t_LE                = r'<='
+    t_GE                = r'>='
+    t_EQ                = r'=='
+    t_NE                = r'!='
+
+    # Assignment operators
+    t_EQUALS            = r'='
+    t_TIMESEQUAL        = r'\*='
+    t_DIVEQUAL          = r'/='
+    t_MODEQUAL          = r'%='
+    t_PLUSEQUAL         = r'\+='
+    t_MINUSEQUAL        = r'-='
+    t_LSHIFTEQUAL       = r'<<='
+    t_RSHIFTEQUAL       = r'>>='
+    t_ANDEQUAL          = r'&='
+    t_OREQUAL           = r'\|='
+    t_XOREQUAL          = r'\^='
+
+    # Increment/decrement
+    t_PLUSPLUS          = r'\+\+'
+    t_MINUSMINUS        = r'--'
+
+    # ->
+    t_ARROW             = r'->'
+
+    # ?
+    t_CONDOP            = r'\?'
+
+    # Delimiters
+    t_LPAREN            = r'\('
+    t_RPAREN            = r'\)'
+    t_LBRACKET          = r'\['
+    t_RBRACKET          = r'\]'
+    t_COMMA             = r','
+    t_PERIOD            = r'\.'
+    t_SEMI              = r';'
+    t_COLON             = r':'
+    t_ELLIPSIS          = r'\.\.\.'
+
+    # Scope delimiters
+    # To see why on_lbrace_func is needed, consider:
+    #   typedef char TT;
+    #   void foo(int TT) { TT = 10; }
+    #   TT x = 5;
+    # Outside the function, TT is a typedef, but inside (starting and ending
+    # with the braces) it's a parameter.  The trouble begins with yacc's
+    # lookahead token.  If we open a new scope in brace_open, then TT has
+    # already been read and incorrectly interpreted as TYPEID.  So, we need
+    # to open and close scopes from within the lexer.
+    # Similar for the TT immediately outside the end of the function.
+    #
+    @TOKEN(r'\{')
+    def t_LBRACE(self, t):
+        self.on_lbrace_func()
+        return t
+    @TOKEN(r'\}')
+    def t_RBRACE(self, t):
+        self.on_rbrace_func()
+        return t
+
+    t_STRING_LITERAL = string_literal
+
+    # The following floating and integer constants are defined as
+    # functions to impose a strict order (otherwise, decimal
+    # is placed before the others because its regex is longer,
+    # and this is bad)
+    #
+    @TOKEN(floating_constant)
+    def t_FLOAT_CONST(self, t):
+        return t
+
+    @TOKEN(hex_floating_constant)
+    def t_HEX_FLOAT_CONST(self, t):
+        return t
+
+    @TOKEN(hex_constant)
+    def t_INT_CONST_HEX(self, t):
+        return t
+
+    @TOKEN(bin_constant)
+    def t_INT_CONST_BIN(self, t):
+        return t
+
+    @TOKEN(bad_octal_constant)
+    def t_BAD_CONST_OCT(self, t):
+        msg = "Invalid octal constant"
+        self._error(msg, t)
+
+    @TOKEN(octal_constant)
+    def t_INT_CONST_OCT(self, t):
+        return t
+
+    @TOKEN(decimal_constant)
+    def t_INT_CONST_DEC(self, t):
+        return t
+
+    # Must come before bad_char_const, to prevent it from
+    # catching valid char constants as invalid
+    #
+    @TOKEN(multicharacter_constant)
+    def t_INT_CONST_CHAR(self, t):
+        return t
+
+    @TOKEN(char_const)
+    def t_CHAR_CONST(self, t):
+        return t
+
+    @TOKEN(wchar_const)
+    def t_WCHAR_CONST(self, t):
+        return t
+
+    @TOKEN(u8char_const)
+    def t_U8CHAR_CONST(self, t):
+        return t
+
+    @TOKEN(u16char_const)
+    def t_U16CHAR_CONST(self, t):
+        return t
+
+    @TOKEN(u32char_const)
+    def t_U32CHAR_CONST(self, t):
+        return t
+
+    @TOKEN(unmatched_quote)
+    def t_UNMATCHED_QUOTE(self, t):
+        msg = "Unmatched '"
+        self._error(msg, t)
+
+    @TOKEN(bad_char_const)
+    def t_BAD_CHAR_CONST(self, t):
+        msg = "Invalid char constant %s" % t.value
+        self._error(msg, t)
+
+    @TOKEN(wstring_literal)
+    def t_WSTRING_LITERAL(self, t):
+        return t
+
+    @TOKEN(u8string_literal)
+    def t_U8STRING_LITERAL(self, t):
+        return t
+
+    @TOKEN(u16string_literal)
+    def t_U16STRING_LITERAL(self, t):
+        return t
+
+    @TOKEN(u32string_literal)
+    def t_U32STRING_LITERAL(self, t):
+        return t
+
+    # unmatched string literals are caught by the preprocessor
+
+    @TOKEN(bad_string_literal)
+    def t_BAD_STRING_LITERAL(self, t):
+        msg = "String contains invalid escape code"
+        self._error(msg, t)
+
+    @TOKEN(identifier)
+    def t_ID(self, t):
+        t.type = self.keyword_map.get(t.value, "ID")
+        if t.type == 'ID' and self.type_lookup_func(t.value):
+            t.type = "TYPEID"
+        return t
+
+    def t_error(self, t):
+        msg = 'Illegal character %s' % repr(t.value[0])
+        self._error(msg, t)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/c_parser.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_parser.py
new file mode 100644
index 0000000000000000000000000000000000000000..640a75940672d12bb06e00960eaf5cca331dacad
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/c_parser.py
@@ -0,0 +1,1936 @@
+#------------------------------------------------------------------------------
+# pycparser: c_parser.py
+#
+# CParser class: Parser and AST builder for the C language
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#------------------------------------------------------------------------------
+from .ply import yacc
+
+from . import c_ast
+from .c_lexer import CLexer
+from .plyparser import PLYParser, ParseError, parameterized, template
+from .ast_transforms import fix_switch_cases, fix_atomic_specifiers
+
+
+@template
+class CParser(PLYParser):
+    def __init__(
+            self,
+            lex_optimize=True,
+            lexer=CLexer,
+            lextab='pycparser.lextab',
+            yacc_optimize=True,
+            yacctab='pycparser.yacctab',
+            yacc_debug=False,
+            taboutputdir=''):
+        """ Create a new CParser.
+
+            Some arguments for controlling the debug/optimization
+            level of the parser are provided. The defaults are
+            tuned for release/performance mode.
+            The simple rules for using them are:
+            *) When tweaking CParser/CLexer, set these to False
+            *) When releasing a stable parser, set to True
+
+            lex_optimize:
+                Set to False when you're modifying the lexer.
+                Otherwise, changes in the lexer won't be used, if
+                some lextab.py file exists.
+                When releasing with a stable lexer, set to True
+                to save the re-generation of the lexer table on
+                each run.
+
+            lexer:
+                Set this parameter to define the lexer to use if
+                you're not using the default CLexer.
+
+            lextab:
+                Points to the lex table that's used for optimized
+                mode. Only if you're modifying the lexer and want
+                some tests to avoid re-generating the table, make
+                this point to a local lex table file (that's been
+                earlier generated with lex_optimize=True)
+
+            yacc_optimize:
+                Set to False when you're modifying the parser.
+                Otherwise, changes in the parser won't be used, if
+                some parsetab.py file exists.
+                When releasing with a stable parser, set to True
+                to save the re-generation of the parser table on
+                each run.
+
+            yacctab:
+                Points to the yacc table that's used for optimized
+                mode. Only if you're modifying the parser, make
+                this point to a local yacc table file
+
+            yacc_debug:
+                Generate a parser.out file that explains how yacc
+                built the parsing table from the grammar.
+
+            taboutputdir:
+                Set this parameter to control the location of generated
+                lextab and yacctab files.
+        """
+        self.clex = lexer(
+            error_func=self._lex_error_func,
+            on_lbrace_func=self._lex_on_lbrace_func,
+            on_rbrace_func=self._lex_on_rbrace_func,
+            type_lookup_func=self._lex_type_lookup_func)
+
+        self.clex.build(
+            optimize=lex_optimize,
+            lextab=lextab,
+            outputdir=taboutputdir)
+        self.tokens = self.clex.tokens
+
+        rules_with_opt = [
+            'abstract_declarator',
+            'assignment_expression',
+            'declaration_list',
+            'declaration_specifiers_no_type',
+            'designation',
+            'expression',
+            'identifier_list',
+            'init_declarator_list',
+            'id_init_declarator_list',
+            'initializer_list',
+            'parameter_type_list',
+            'block_item_list',
+            'type_qualifier_list',
+            'struct_declarator_list'
+        ]
+
+        for rule in rules_with_opt:
+            self._create_opt_rule(rule)
+
+        self.cparser = yacc.yacc(
+            module=self,
+            start='translation_unit_or_empty',
+            debug=yacc_debug,
+            optimize=yacc_optimize,
+            tabmodule=yacctab,
+            outputdir=taboutputdir)
+
+        # Stack of scopes for keeping track of symbols. _scope_stack[-1] is
+        # the current (topmost) scope. Each scope is a dictionary that
+        # specifies whether a name is a type. If _scope_stack[n][name] is
+        # True, 'name' is currently a type in the scope. If it's False,
+        # 'name' is used in the scope but not as a type (for instance, if we
+        # saw: int name;
+        # If 'name' is not a key in _scope_stack[n] then 'name' was not defined
+        # in this scope at all.
+        self._scope_stack = [dict()]
+
+        # Keeps track of the last token given to yacc (the lookahead token)
+        self._last_yielded_token = None
+
+    def parse(self, text, filename='', debug=False):
+        """ Parses C code and returns an AST.
+
+            text:
+                A string containing the C source code
+
+            filename:
+                Name of the file being parsed (for meaningful
+                error messages)
+
+            debug:
+                Debug flag to YACC
+        """
+        self.clex.filename = filename
+        self.clex.reset_lineno()
+        self._scope_stack = [dict()]
+        self._last_yielded_token = None
+        return self.cparser.parse(
+                input=text,
+                lexer=self.clex,
+                debug=debug)
+
+    ######################--   PRIVATE   --######################
+
+    def _push_scope(self):
+        self._scope_stack.append(dict())
+
+    def _pop_scope(self):
+        assert len(self._scope_stack) > 1
+        self._scope_stack.pop()
+
+    def _add_typedef_name(self, name, coord):
+        """ Add a new typedef name (ie a TYPEID) to the current scope
+        """
+        if not self._scope_stack[-1].get(name, True):
+            self._parse_error(
+                "Typedef %r previously declared as non-typedef "
+                "in this scope" % name, coord)
+        self._scope_stack[-1][name] = True
+
+    def _add_identifier(self, name, coord):
+        """ Add a new object, function, or enum member name (ie an ID) to the
+            current scope
+        """
+        if self._scope_stack[-1].get(name, False):
+            self._parse_error(
+                "Non-typedef %r previously declared as typedef "
+                "in this scope" % name, coord)
+        self._scope_stack[-1][name] = False
+
+    def _is_type_in_scope(self, name):
+        """ Is *name* a typedef-name in the current scope?
+        """
+        for scope in reversed(self._scope_stack):
+            # If name is an identifier in this scope it shadows typedefs in
+            # higher scopes.
+            in_scope = scope.get(name)
+            if in_scope is not None: return in_scope
+        return False
+
+    def _lex_error_func(self, msg, line, column):
+        self._parse_error(msg, self._coord(line, column))
+
+    def _lex_on_lbrace_func(self):
+        self._push_scope()
+
+    def _lex_on_rbrace_func(self):
+        self._pop_scope()
+
+    def _lex_type_lookup_func(self, name):
+        """ Looks up types that were previously defined with
+            typedef.
+            Passed to the lexer for recognizing identifiers that
+            are types.
+        """
+        is_type = self._is_type_in_scope(name)
+        return is_type
+
+    def _get_yacc_lookahead_token(self):
+        """ We need access to yacc's lookahead token in certain cases.
+            This is the last token yacc requested from the lexer, so we
+            ask the lexer.
+        """
+        return self.clex.last_token
+
+    # To understand what's going on here, read sections A.8.5 and
+    # A.8.6 of K&R2 very carefully.
+    #
+    # A C type consists of a basic type declaration, with a list
+    # of modifiers. For example:
+    #
+    # int *c[5];
+    #
+    # The basic declaration here is 'int c', and the pointer and
+    # the array are the modifiers.
+    #
+    # Basic declarations are represented by TypeDecl (from module c_ast) and the
+    # modifiers are FuncDecl, PtrDecl and ArrayDecl.
+    #
+    # The standard states that whenever a new modifier is parsed, it should be
+    # added to the end of the list of modifiers. For example:
+    #
+    # K&R2 A.8.6.2: Array Declarators
+    #
+    # In a declaration T D where D has the form
+    #   D1 [constant-expression-opt]
+    # and the type of the identifier in the declaration T D1 is
+    # "type-modifier T", the type of the
+    # identifier of D is "type-modifier array of T"
+    #
+    # This is what this method does. The declarator it receives
+    # can be a list of declarators ending with TypeDecl. It
+    # tacks the modifier to the end of this list, just before
+    # the TypeDecl.
+    #
+    # Additionally, the modifier may be a list itself. This is
+    # useful for pointers, that can come as a chain from the rule
+    # p_pointer. In this case, the whole modifier list is spliced
+    # into the new location.
+    def _type_modify_decl(self, decl, modifier):
+        """ Tacks a type modifier on a declarator, and returns
+            the modified declarator.
+
+            Note: the declarator and modifier may be modified
+        """
+        #~ print '****'
+        #~ decl.show(offset=3)
+        #~ modifier.show(offset=3)
+        #~ print '****'
+
+        modifier_head = modifier
+        modifier_tail = modifier
+
+        # The modifier may be a nested list. Reach its tail.
+        while modifier_tail.type:
+            modifier_tail = modifier_tail.type
+
+        # If the decl is a basic type, just tack the modifier onto it.
+        if isinstance(decl, c_ast.TypeDecl):
+            modifier_tail.type = decl
+            return modifier
+        else:
+            # Otherwise, the decl is a list of modifiers. Reach
+            # its tail and splice the modifier onto the tail,
+            # pointing to the underlying basic type.
+            decl_tail = decl
+
+            while not isinstance(decl_tail.type, c_ast.TypeDecl):
+                decl_tail = decl_tail.type
+
+            modifier_tail.type = decl_tail.type
+            decl_tail.type = modifier_head
+            return decl
+
+    # Due to the order in which declarators are constructed,
+    # they have to be fixed in order to look like a normal AST.
+    #
+    # When a declaration arrives from syntax construction, it has
+    # these problems:
+    # * The innermost TypeDecl has no type (because the basic
+    #   type is only known at the uppermost declaration level)
+    # * The declaration has no variable name, since that is saved
+    #   in the innermost TypeDecl
+    # * The typename of the declaration is a list of type
+    #   specifiers, and not a node. Here, basic identifier types
+    #   should be separated from more complex types like enums
+    #   and structs.
+    #
+    # This method fixes these problems.
+    def _fix_decl_name_type(self, decl, typename):
+        """ Fixes a declaration. Modifies decl.
+        """
+        # Reach the underlying basic type
+        #
+        type = decl
+        while not isinstance(type, c_ast.TypeDecl):
+            type = type.type
+
+        decl.name = type.declname
+        type.quals = decl.quals[:]
+
+        # The typename is a list of types. If any type in this
+        # list isn't an IdentifierType, it must be the only
+        # type in the list (it's illegal to declare "int enum ..")
+        # If all the types are basic, they're collected in the
+        # IdentifierType holder.
+        for tn in typename:
+            if not isinstance(tn, c_ast.IdentifierType):
+                if len(typename) > 1:
+                    self._parse_error(
+                        "Invalid multiple types specified", tn.coord)
+                else:
+                    type.type = tn
+                    return decl
+
+        if not typename:
+            # Functions default to returning int
+            #
+            if not isinstance(decl.type, c_ast.FuncDecl):
+                self._parse_error(
+                        "Missing type in declaration", decl.coord)
+            type.type = c_ast.IdentifierType(
+                    ['int'],
+                    coord=decl.coord)
+        else:
+            # At this point, we know that typename is a list of IdentifierType
+            # nodes. Concatenate all the names into a single list.
+            #
+            type.type = c_ast.IdentifierType(
+                [name for id in typename for name in id.names],
+                coord=typename[0].coord)
+        return decl
+
+    def _add_declaration_specifier(self, declspec, newspec, kind, append=False):
+        """ Declaration specifiers are represented by a dictionary
+            with the entries:
+            * qual: a list of type qualifiers
+            * storage: a list of storage type qualifiers
+            * type: a list of type specifiers
+            * function: a list of function specifiers
+            * alignment: a list of alignment specifiers
+
+            This method is given a declaration specifier, and a
+            new specifier of a given kind.
+            If `append` is True, the new specifier is added to the end of
+            the specifiers list, otherwise it's added at the beginning.
+            Returns the declaration specifier, with the new
+            specifier incorporated.
+        """
+        spec = declspec or dict(qual=[], storage=[], type=[], function=[], alignment=[])
+
+        if append:
+            spec[kind].append(newspec)
+        else:
+            spec[kind].insert(0, newspec)
+
+        return spec
+
+    def _build_declarations(self, spec, decls, typedef_namespace=False):
+        """ Builds a list of declarations all sharing the given specifiers.
+            If typedef_namespace is true, each declared name is added
+            to the "typedef namespace", which also includes objects,
+            functions, and enum constants.
+        """
+        is_typedef = 'typedef' in spec['storage']
+        declarations = []
+
+        # Bit-fields are allowed to be unnamed.
+        if decls[0].get('bitsize') is not None:
+            pass
+
+        # When redeclaring typedef names as identifiers in inner scopes, a
+        # problem can occur where the identifier gets grouped into
+        # spec['type'], leaving decl as None.  This can only occur for the
+        # first declarator.
+        elif decls[0]['decl'] is None:
+            if len(spec['type']) < 2 or len(spec['type'][-1].names) != 1 or \
+                    not self._is_type_in_scope(spec['type'][-1].names[0]):
+                coord = '?'
+                for t in spec['type']:
+                    if hasattr(t, 'coord'):
+                        coord = t.coord
+                        break
+                self._parse_error('Invalid declaration', coord)
+
+            # Make this look as if it came from "direct_declarator:ID"
+            decls[0]['decl'] = c_ast.TypeDecl(
+                declname=spec['type'][-1].names[0],
+                type=None,
+                quals=None,
+                align=spec['alignment'],
+                coord=spec['type'][-1].coord)
+            # Remove the "new" type's name from the end of spec['type']
+            del spec['type'][-1]
+
+        # A similar problem can occur where the declaration ends up looking
+        # like an abstract declarator.  Give it a name if this is the case.
+        elif not isinstance(decls[0]['decl'], (
+                c_ast.Enum, c_ast.Struct, c_ast.Union, c_ast.IdentifierType)):
+            decls_0_tail = decls[0]['decl']
+            while not isinstance(decls_0_tail, c_ast.TypeDecl):
+                decls_0_tail = decls_0_tail.type
+            if decls_0_tail.declname is None:
+                decls_0_tail.declname = spec['type'][-1].names[0]
+                del spec['type'][-1]
+
+        for decl in decls:
+            assert decl['decl'] is not None
+            if is_typedef:
+                declaration = c_ast.Typedef(
+                    name=None,
+                    quals=spec['qual'],
+                    storage=spec['storage'],
+                    type=decl['decl'],
+                    coord=decl['decl'].coord)
+            else:
+                declaration = c_ast.Decl(
+                    name=None,
+                    quals=spec['qual'],
+                    align=spec['alignment'],
+                    storage=spec['storage'],
+                    funcspec=spec['function'],
+                    type=decl['decl'],
+                    init=decl.get('init'),
+                    bitsize=decl.get('bitsize'),
+                    coord=decl['decl'].coord)
+
+            if isinstance(declaration.type, (
+                    c_ast.Enum, c_ast.Struct, c_ast.Union,
+                    c_ast.IdentifierType)):
+                fixed_decl = declaration
+            else:
+                fixed_decl = self._fix_decl_name_type(declaration, spec['type'])
+
+            # Add the type name defined by typedef to a
+            # symbol table (for usage in the lexer)
+            if typedef_namespace:
+                if is_typedef:
+                    self._add_typedef_name(fixed_decl.name, fixed_decl.coord)
+                else:
+                    self._add_identifier(fixed_decl.name, fixed_decl.coord)
+
+            fixed_decl = fix_atomic_specifiers(fixed_decl)
+            declarations.append(fixed_decl)
+
+        return declarations
+
+    def _build_function_definition(self, spec, decl, param_decls, body):
+        """ Builds a function definition.
+        """
+        if 'typedef' in spec['storage']:
+            self._parse_error("Invalid typedef", decl.coord)
+
+        declaration = self._build_declarations(
+            spec=spec,
+            decls=[dict(decl=decl, init=None)],
+            typedef_namespace=True)[0]
+
+        return c_ast.FuncDef(
+            decl=declaration,
+            param_decls=param_decls,
+            body=body,
+            coord=decl.coord)
+
+    def _select_struct_union_class(self, token):
+        """ Given a token (either STRUCT or UNION), selects the
+            appropriate AST class.
+        """
+        if token == 'struct':
+            return c_ast.Struct
+        else:
+            return c_ast.Union
+
+    ##
+    ## Precedence and associativity of operators
+    ##
+    # If this changes, c_generator.CGenerator.precedence_map needs to change as
+    # well
+    precedence = (
+        ('left', 'LOR'),
+        ('left', 'LAND'),
+        ('left', 'OR'),
+        ('left', 'XOR'),
+        ('left', 'AND'),
+        ('left', 'EQ', 'NE'),
+        ('left', 'GT', 'GE', 'LT', 'LE'),
+        ('left', 'RSHIFT', 'LSHIFT'),
+        ('left', 'PLUS', 'MINUS'),
+        ('left', 'TIMES', 'DIVIDE', 'MOD')
+    )
+
+    ##
+    ## Grammar productions
+    ## Implementation of the BNF defined in K&R2 A.13
+    ##
+
+    # Wrapper around a translation unit, to allow for empty input.
+    # Not strictly part of the C99 Grammar, but useful in practice.
+    def p_translation_unit_or_empty(self, p):
+        """ translation_unit_or_empty   : translation_unit
+                                        | empty
+        """
+        if p[1] is None:
+            p[0] = c_ast.FileAST([])
+        else:
+            p[0] = c_ast.FileAST(p[1])
+
+    def p_translation_unit_1(self, p):
+        """ translation_unit    : external_declaration
+        """
+        # Note: external_declaration is already a list
+        p[0] = p[1]
+
+    def p_translation_unit_2(self, p):
+        """ translation_unit    : translation_unit external_declaration
+        """
+        p[1].extend(p[2])
+        p[0] = p[1]
+
+    # Declarations always come as lists (because they can be
+    # several in one line), so we wrap the function definition
+    # into a list as well, to make the return value of
+    # external_declaration homogeneous.
+    def p_external_declaration_1(self, p):
+        """ external_declaration    : function_definition
+        """
+        p[0] = [p[1]]
+
+    def p_external_declaration_2(self, p):
+        """ external_declaration    : declaration
+        """
+        p[0] = p[1]
+
+    def p_external_declaration_3(self, p):
+        """ external_declaration    : pp_directive
+                                    | pppragma_directive
+        """
+        p[0] = [p[1]]
+
+    def p_external_declaration_4(self, p):
+        """ external_declaration    : SEMI
+        """
+        p[0] = []
+
+    def p_external_declaration_5(self, p):
+        """ external_declaration    : static_assert
+        """
+        p[0] = p[1]
+
+    def p_static_assert_declaration(self, p):
+        """ static_assert           : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN
+                                    | _STATIC_ASSERT LPAREN constant_expression RPAREN
+        """
+        if len(p) == 5:
+            p[0] = [c_ast.StaticAssert(p[3], None, self._token_coord(p, 1))]
+        else:
+            p[0] = [c_ast.StaticAssert(p[3], p[5], self._token_coord(p, 1))]
+
+    def p_pp_directive(self, p):
+        """ pp_directive  : PPHASH
+        """
+        self._parse_error('Directives not supported yet',
+                          self._token_coord(p, 1))
+
+    def p_pppragma_directive(self, p):
+        """ pppragma_directive      : PPPRAGMA
+                                    | PPPRAGMA PPPRAGMASTR
+        """
+        if len(p) == 3:
+            p[0] = c_ast.Pragma(p[2], self._token_coord(p, 2))
+        else:
+            p[0] = c_ast.Pragma("", self._token_coord(p, 1))
+
+    # In function definitions, the declarator can be followed by
+    # a declaration list, for old "K&R style" function definitios.
+    def p_function_definition_1(self, p):
+        """ function_definition : id_declarator declaration_list_opt compound_statement
+        """
+        # no declaration specifiers - 'int' becomes the default type
+        spec = dict(
+            qual=[],
+            alignment=[],
+            storage=[],
+            type=[c_ast.IdentifierType(['int'],
+                                       coord=self._token_coord(p, 1))],
+            function=[])
+
+        p[0] = self._build_function_definition(
+            spec=spec,
+            decl=p[1],
+            param_decls=p[2],
+            body=p[3])
+
+    def p_function_definition_2(self, p):
+        """ function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement
+        """
+        spec = p[1]
+
+        p[0] = self._build_function_definition(
+            spec=spec,
+            decl=p[2],
+            param_decls=p[3],
+            body=p[4])
+
+    # Note, according to C18 A.2.2 6.7.10 static_assert-declaration _Static_assert
+    # is a declaration, not a statement. We additionally recognise it as a statement
+    # to fix parsing of _Static_assert inside the functions.
+    #
+    def p_statement(self, p):
+        """ statement   : labeled_statement
+                        | expression_statement
+                        | compound_statement
+                        | selection_statement
+                        | iteration_statement
+                        | jump_statement
+                        | pppragma_directive
+                        | static_assert
+        """
+        p[0] = p[1]
+
+    # A pragma is generally considered a decorator rather than an actual
+    # statement. Still, for the purposes of analyzing an abstract syntax tree of
+    # C code, pragma's should not be ignored and were previously treated as a
+    # statement. This presents a problem for constructs that take a statement
+    # such as labeled_statements, selection_statements, and
+    # iteration_statements, causing a misleading structure in the AST. For
+    # example, consider the following C code.
+    #
+    #   for (int i = 0; i < 3; i++)
+    #       #pragma omp critical
+    #       sum += 1;
+    #
+    # This code will compile and execute "sum += 1;" as the body of the for
+    # loop. Previous implementations of PyCParser would render the AST for this
+    # block of code as follows:
+    #
+    #   For:
+    #     DeclList:
+    #       Decl: i, [], [], []
+    #         TypeDecl: i, []
+    #           IdentifierType: ['int']
+    #         Constant: int, 0
+    #     BinaryOp: <
+    #       ID: i
+    #       Constant: int, 3
+    #     UnaryOp: p++
+    #       ID: i
+    #     Pragma: omp critical
+    #   Assignment: +=
+    #     ID: sum
+    #     Constant: int, 1
+    #
+    # This AST misleadingly takes the Pragma as the body of the loop and the
+    # assignment then becomes a sibling of the loop.
+    #
+    # To solve edge cases like these, the pragmacomp_or_statement rule groups
+    # a pragma and its following statement (which would otherwise be orphaned)
+    # using a compound block, effectively turning the above code into:
+    #
+    #   for (int i = 0; i < 3; i++) {
+    #       #pragma omp critical
+    #       sum += 1;
+    #   }
+    def p_pragmacomp_or_statement(self, p):
+        """ pragmacomp_or_statement     : pppragma_directive statement
+                                        | statement
+        """
+        if isinstance(p[1], c_ast.Pragma) and len(p) == 3:
+            p[0] = c_ast.Compound(
+                block_items=[p[1], p[2]],
+                coord=self._token_coord(p, 1))
+        else:
+            p[0] = p[1]
+
+    # In C, declarations can come several in a line:
+    #   int x, *px, romulo = 5;
+    #
+    # However, for the AST, we will split them to separate Decl
+    # nodes.
+    #
+    # This rule splits its declarations and always returns a list
+    # of Decl nodes, even if it's one element long.
+    #
+    def p_decl_body(self, p):
+        """ decl_body : declaration_specifiers init_declarator_list_opt
+                      | declaration_specifiers_no_type id_init_declarator_list_opt
+        """
+        spec = p[1]
+
+        # p[2] (init_declarator_list_opt) is either a list or None
+        #
+        if p[2] is None:
+            # By the standard, you must have at least one declarator unless
+            # declaring a structure tag, a union tag, or the members of an
+            # enumeration.
+            #
+            ty = spec['type']
+            s_u_or_e = (c_ast.Struct, c_ast.Union, c_ast.Enum)
+            if len(ty) == 1 and isinstance(ty[0], s_u_or_e):
+                decls = [c_ast.Decl(
+                    name=None,
+                    quals=spec['qual'],
+                    align=spec['alignment'],
+                    storage=spec['storage'],
+                    funcspec=spec['function'],
+                    type=ty[0],
+                    init=None,
+                    bitsize=None,
+                    coord=ty[0].coord)]
+
+            # However, this case can also occur on redeclared identifiers in
+            # an inner scope.  The trouble is that the redeclared type's name
+            # gets grouped into declaration_specifiers; _build_declarations
+            # compensates for this.
+            #
+            else:
+                decls = self._build_declarations(
+                    spec=spec,
+                    decls=[dict(decl=None, init=None)],
+                    typedef_namespace=True)
+
+        else:
+            decls = self._build_declarations(
+                spec=spec,
+                decls=p[2],
+                typedef_namespace=True)
+
+        p[0] = decls
+
+    # The declaration has been split to a decl_body sub-rule and
+    # SEMI, because having them in a single rule created a problem
+    # for defining typedefs.
+    #
+    # If a typedef line was directly followed by a line using the
+    # type defined with the typedef, the type would not be
+    # recognized. This is because to reduce the declaration rule,
+    # the parser's lookahead asked for the token after SEMI, which
+    # was the type from the next line, and the lexer had no chance
+    # to see the updated type symbol table.
+    #
+    # Splitting solves this problem, because after seeing SEMI,
+    # the parser reduces decl_body, which actually adds the new
+    # type into the table to be seen by the lexer before the next
+    # line is reached.
+    def p_declaration(self, p):
+        """ declaration : decl_body SEMI
+        """
+        p[0] = p[1]
+
+    # Since each declaration is a list of declarations, this
+    # rule will combine all the declarations and return a single
+    # list
+    #
+    def p_declaration_list(self, p):
+        """ declaration_list    : declaration
+                                | declaration_list declaration
+        """
+        p[0] = p[1] if len(p) == 2 else p[1] + p[2]
+
+    # To know when declaration-specifiers end and declarators begin,
+    # we require declaration-specifiers to have at least one
+    # type-specifier, and disallow typedef-names after we've seen any
+    # type-specifier. These are both required by the spec.
+    #
+    def p_declaration_specifiers_no_type_1(self, p):
+        """ declaration_specifiers_no_type  : type_qualifier declaration_specifiers_no_type_opt
+        """
+        p[0] = self._add_declaration_specifier(p[2], p[1], 'qual')
+
+    def p_declaration_specifiers_no_type_2(self, p):
+        """ declaration_specifiers_no_type  : storage_class_specifier declaration_specifiers_no_type_opt
+        """
+        p[0] = self._add_declaration_specifier(p[2], p[1], 'storage')
+
+    def p_declaration_specifiers_no_type_3(self, p):
+        """ declaration_specifiers_no_type  : function_specifier declaration_specifiers_no_type_opt
+        """
+        p[0] = self._add_declaration_specifier(p[2], p[1], 'function')
+
+    # Without this, `typedef _Atomic(T) U` will parse incorrectly because the
+    # _Atomic qualifier will match, instead of the specifier.
+    def p_declaration_specifiers_no_type_4(self, p):
+        """ declaration_specifiers_no_type  : atomic_specifier declaration_specifiers_no_type_opt
+        """
+        p[0] = self._add_declaration_specifier(p[2], p[1], 'type')
+
+    def p_declaration_specifiers_no_type_5(self, p):
+        """ declaration_specifiers_no_type  : alignment_specifier declaration_specifiers_no_type_opt
+        """
+        p[0] = self._add_declaration_specifier(p[2], p[1], 'alignment')
+
+    def p_declaration_specifiers_1(self, p):
+        """ declaration_specifiers  : declaration_specifiers type_qualifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True)
+
+    def p_declaration_specifiers_2(self, p):
+        """ declaration_specifiers  : declaration_specifiers storage_class_specifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'storage', append=True)
+
+    def p_declaration_specifiers_3(self, p):
+        """ declaration_specifiers  : declaration_specifiers function_specifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'function', append=True)
+
+    def p_declaration_specifiers_4(self, p):
+        """ declaration_specifiers  : declaration_specifiers type_specifier_no_typeid
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True)
+
+    def p_declaration_specifiers_5(self, p):
+        """ declaration_specifiers  : type_specifier
+        """
+        p[0] = self._add_declaration_specifier(None, p[1], 'type')
+
+    def p_declaration_specifiers_6(self, p):
+        """ declaration_specifiers  : declaration_specifiers_no_type type_specifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True)
+
+    def p_declaration_specifiers_7(self, p):
+        """ declaration_specifiers  : declaration_specifiers alignment_specifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment', append=True)
+
+    def p_storage_class_specifier(self, p):
+        """ storage_class_specifier : AUTO
+                                    | REGISTER
+                                    | STATIC
+                                    | EXTERN
+                                    | TYPEDEF
+                                    | _THREAD_LOCAL
+        """
+        p[0] = p[1]
+
+    def p_function_specifier(self, p):
+        """ function_specifier  : INLINE
+                                | _NORETURN
+        """
+        p[0] = p[1]
+
+    def p_type_specifier_no_typeid(self, p):
+        """ type_specifier_no_typeid  : VOID
+                                      | _BOOL
+                                      | CHAR
+                                      | SHORT
+                                      | INT
+                                      | LONG
+                                      | FLOAT
+                                      | DOUBLE
+                                      | _COMPLEX
+                                      | SIGNED
+                                      | UNSIGNED
+                                      | __INT128
+        """
+        p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1))
+
+    def p_type_specifier(self, p):
+        """ type_specifier  : typedef_name
+                            | enum_specifier
+                            | struct_or_union_specifier
+                            | type_specifier_no_typeid
+                            | atomic_specifier
+        """
+        p[0] = p[1]
+
+    # See section 6.7.2.4 of the C11 standard.
+    def p_atomic_specifier(self, p):
+        """ atomic_specifier  : _ATOMIC LPAREN type_name RPAREN
+        """
+        typ = p[3]
+        typ.quals.append('_Atomic')
+        p[0] = typ
+
+    def p_type_qualifier(self, p):
+        """ type_qualifier  : CONST
+                            | RESTRICT
+                            | VOLATILE
+                            | _ATOMIC
+        """
+        p[0] = p[1]
+
+    def p_init_declarator_list(self, p):
+        """ init_declarator_list    : init_declarator
+                                    | init_declarator_list COMMA init_declarator
+        """
+        p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]]
+
+    # Returns a {decl=<declarator> : init=<initializer>} dictionary
+    # If there's no initializer, uses None
+    #
+    def p_init_declarator(self, p):
+        """ init_declarator : declarator
+                            | declarator EQUALS initializer
+        """
+        p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None))
+
+    def p_id_init_declarator_list(self, p):
+        """ id_init_declarator_list    : id_init_declarator
+                                       | id_init_declarator_list COMMA init_declarator
+        """
+        p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]]
+
+    def p_id_init_declarator(self, p):
+        """ id_init_declarator : id_declarator
+                               | id_declarator EQUALS initializer
+        """
+        p[0] = dict(decl=p[1], init=(p[3] if len(p) > 2 else None))
+
+    # Require at least one type specifier in a specifier-qualifier-list
+    #
+    def p_specifier_qualifier_list_1(self, p):
+        """ specifier_qualifier_list    : specifier_qualifier_list type_specifier_no_typeid
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'type', append=True)
+
+    def p_specifier_qualifier_list_2(self, p):
+        """ specifier_qualifier_list    : specifier_qualifier_list type_qualifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'qual', append=True)
+
+    def p_specifier_qualifier_list_3(self, p):
+        """ specifier_qualifier_list  : type_specifier
+        """
+        p[0] = self._add_declaration_specifier(None, p[1], 'type')
+
+    def p_specifier_qualifier_list_4(self, p):
+        """ specifier_qualifier_list  : type_qualifier_list type_specifier
+        """
+        p[0] = dict(qual=p[1], alignment=[], storage=[], type=[p[2]], function=[])
+
+    def p_specifier_qualifier_list_5(self, p):
+        """ specifier_qualifier_list  : alignment_specifier
+        """
+        p[0] = dict(qual=[], alignment=[p[1]], storage=[], type=[], function=[])
+
+    def p_specifier_qualifier_list_6(self, p):
+        """ specifier_qualifier_list  : specifier_qualifier_list alignment_specifier
+        """
+        p[0] = self._add_declaration_specifier(p[1], p[2], 'alignment')
+
+    # TYPEID is allowed here (and in other struct/enum related tag names), because
+    # struct/enum tags reside in their own namespace and can be named the same as types
+    #
+    def p_struct_or_union_specifier_1(self, p):
+        """ struct_or_union_specifier   : struct_or_union ID
+                                        | struct_or_union TYPEID
+        """
+        klass = self._select_struct_union_class(p[1])
+        # None means no list of members
+        p[0] = klass(
+            name=p[2],
+            decls=None,
+            coord=self._token_coord(p, 2))
+
+    def p_struct_or_union_specifier_2(self, p):
+        """ struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close
+                                      | struct_or_union brace_open brace_close
+        """
+        klass = self._select_struct_union_class(p[1])
+        if len(p) == 4:
+            # Empty sequence means an empty list of members
+            p[0] = klass(
+                name=None,
+                decls=[],
+                coord=self._token_coord(p, 2))
+        else:
+            p[0] = klass(
+                name=None,
+                decls=p[3],
+                coord=self._token_coord(p, 2))
+
+
+    def p_struct_or_union_specifier_3(self, p):
+        """ struct_or_union_specifier   : struct_or_union ID brace_open struct_declaration_list brace_close
+                                        | struct_or_union ID brace_open brace_close
+                                        | struct_or_union TYPEID brace_open struct_declaration_list brace_close
+                                        | struct_or_union TYPEID brace_open brace_close
+        """
+        klass = self._select_struct_union_class(p[1])
+        if len(p) == 5:
+            # Empty sequence means an empty list of members
+            p[0] = klass(
+                name=p[2],
+                decls=[],
+                coord=self._token_coord(p, 2))
+        else:
+            p[0] = klass(
+                name=p[2],
+                decls=p[4],
+                coord=self._token_coord(p, 2))
+
+    def p_struct_or_union(self, p):
+        """ struct_or_union : STRUCT
+                            | UNION
+        """
+        p[0] = p[1]
+
+    # Combine all declarations into a single list
+    #
+    def p_struct_declaration_list(self, p):
+        """ struct_declaration_list     : struct_declaration
+                                        | struct_declaration_list struct_declaration
+        """
+        if len(p) == 2:
+            p[0] = p[1] or []
+        else:
+            p[0] = p[1] + (p[2] or [])
+
+    def p_struct_declaration_1(self, p):
+        """ struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI
+        """
+        spec = p[1]
+        assert 'typedef' not in spec['storage']
+
+        if p[2] is not None:
+            decls = self._build_declarations(
+                spec=spec,
+                decls=p[2])
+
+        elif len(spec['type']) == 1:
+            # Anonymous struct/union, gcc extension, C1x feature.
+            # Although the standard only allows structs/unions here, I see no
+            # reason to disallow other types since some compilers have typedefs
+            # here, and pycparser isn't about rejecting all invalid code.
+            #
+            node = spec['type'][0]
+            if isinstance(node, c_ast.Node):
+                decl_type = node
+            else:
+                decl_type = c_ast.IdentifierType(node)
+
+            decls = self._build_declarations(
+                spec=spec,
+                decls=[dict(decl=decl_type)])
+
+        else:
+            # Structure/union members can have the same names as typedefs.
+            # The trouble is that the member's name gets grouped into
+            # specifier_qualifier_list; _build_declarations compensates.
+            #
+            decls = self._build_declarations(
+                spec=spec,
+                decls=[dict(decl=None, init=None)])
+
+        p[0] = decls
+
+    def p_struct_declaration_2(self, p):
+        """ struct_declaration : SEMI
+        """
+        p[0] = None
+
+    def p_struct_declaration_3(self, p):
+        """ struct_declaration : pppragma_directive
+        """
+        p[0] = [p[1]]
+
+    def p_struct_declarator_list(self, p):
+        """ struct_declarator_list  : struct_declarator
+                                    | struct_declarator_list COMMA struct_declarator
+        """
+        p[0] = p[1] + [p[3]] if len(p) == 4 else [p[1]]
+
+    # struct_declarator passes up a dict with the keys: decl (for
+    # the underlying declarator) and bitsize (for the bitsize)
+    #
+    def p_struct_declarator_1(self, p):
+        """ struct_declarator : declarator
+        """
+        p[0] = {'decl': p[1], 'bitsize': None}
+
+    def p_struct_declarator_2(self, p):
+        """ struct_declarator   : declarator COLON constant_expression
+                                | COLON constant_expression
+        """
+        if len(p) > 3:
+            p[0] = {'decl': p[1], 'bitsize': p[3]}
+        else:
+            p[0] = {'decl': c_ast.TypeDecl(None, None, None, None), 'bitsize': p[2]}
+
+    def p_enum_specifier_1(self, p):
+        """ enum_specifier  : ENUM ID
+                            | ENUM TYPEID
+        """
+        p[0] = c_ast.Enum(p[2], None, self._token_coord(p, 1))
+
+    def p_enum_specifier_2(self, p):
+        """ enum_specifier  : ENUM brace_open enumerator_list brace_close
+        """
+        p[0] = c_ast.Enum(None, p[3], self._token_coord(p, 1))
+
+    def p_enum_specifier_3(self, p):
+        """ enum_specifier  : ENUM ID brace_open enumerator_list brace_close
+                            | ENUM TYPEID brace_open enumerator_list brace_close
+        """
+        p[0] = c_ast.Enum(p[2], p[4], self._token_coord(p, 1))
+
+    def p_enumerator_list(self, p):
+        """ enumerator_list : enumerator
+                            | enumerator_list COMMA
+                            | enumerator_list COMMA enumerator
+        """
+        if len(p) == 2:
+            p[0] = c_ast.EnumeratorList([p[1]], p[1].coord)
+        elif len(p) == 3:
+            p[0] = p[1]
+        else:
+            p[1].enumerators.append(p[3])
+            p[0] = p[1]
+
+    def p_alignment_specifier(self, p):
+        """ alignment_specifier  : _ALIGNAS LPAREN type_name RPAREN
+                                 | _ALIGNAS LPAREN constant_expression RPAREN
+        """
+        p[0] = c_ast.Alignas(p[3], self._token_coord(p, 1))
+
+    def p_enumerator(self, p):
+        """ enumerator  : ID
+                        | ID EQUALS constant_expression
+        """
+        if len(p) == 2:
+            enumerator = c_ast.Enumerator(
+                        p[1], None,
+                        self._token_coord(p, 1))
+        else:
+            enumerator = c_ast.Enumerator(
+                        p[1], p[3],
+                        self._token_coord(p, 1))
+        self._add_identifier(enumerator.name, enumerator.coord)
+
+        p[0] = enumerator
+
+    def p_declarator(self, p):
+        """ declarator  : id_declarator
+                        | typeid_declarator
+        """
+        p[0] = p[1]
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_xxx_declarator_1(self, p):
+        """ xxx_declarator  : direct_xxx_declarator
+        """
+        p[0] = p[1]
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_xxx_declarator_2(self, p):
+        """ xxx_declarator  : pointer direct_xxx_declarator
+        """
+        p[0] = self._type_modify_decl(p[2], p[1])
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_direct_xxx_declarator_1(self, p):
+        """ direct_xxx_declarator   : yyy
+        """
+        p[0] = c_ast.TypeDecl(
+            declname=p[1],
+            type=None,
+            quals=None,
+            align=None,
+            coord=self._token_coord(p, 1))
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'))
+    def p_direct_xxx_declarator_2(self, p):
+        """ direct_xxx_declarator   : LPAREN xxx_declarator RPAREN
+        """
+        p[0] = p[2]
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_direct_xxx_declarator_3(self, p):
+        """ direct_xxx_declarator   : direct_xxx_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET
+        """
+        quals = (p[3] if len(p) > 5 else []) or []
+        # Accept dimension qualifiers
+        # Per C99 6.7.5.3 p7
+        arr = c_ast.ArrayDecl(
+            type=None,
+            dim=p[4] if len(p) > 5 else p[3],
+            dim_quals=quals,
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_direct_xxx_declarator_4(self, p):
+        """ direct_xxx_declarator   : direct_xxx_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET
+                                    | direct_xxx_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET
+        """
+        # Using slice notation for PLY objects doesn't work in Python 3 for the
+        # version of PLY embedded with pycparser; see PLY Google Code issue 30.
+        # Work around that here by listing the two elements separately.
+        listed_quals = [item if isinstance(item, list) else [item]
+            for item in [p[3],p[4]]]
+        dim_quals = [qual for sublist in listed_quals for qual in sublist
+            if qual is not None]
+        arr = c_ast.ArrayDecl(
+            type=None,
+            dim=p[5],
+            dim_quals=dim_quals,
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
+
+    # Special for VLAs
+    #
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_direct_xxx_declarator_5(self, p):
+        """ direct_xxx_declarator   : direct_xxx_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET
+        """
+        arr = c_ast.ArrayDecl(
+            type=None,
+            dim=c_ast.ID(p[4], self._token_coord(p, 4)),
+            dim_quals=p[3] if p[3] is not None else [],
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
+
+    @parameterized(('id', 'ID'), ('typeid', 'TYPEID'), ('typeid_noparen', 'TYPEID'))
+    def p_direct_xxx_declarator_6(self, p):
+        """ direct_xxx_declarator   : direct_xxx_declarator LPAREN parameter_type_list RPAREN
+                                    | direct_xxx_declarator LPAREN identifier_list_opt RPAREN
+        """
+        func = c_ast.FuncDecl(
+            args=p[3],
+            type=None,
+            coord=p[1].coord)
+
+        # To see why _get_yacc_lookahead_token is needed, consider:
+        #   typedef char TT;
+        #   void foo(int TT) { TT = 10; }
+        # Outside the function, TT is a typedef, but inside (starting and
+        # ending with the braces) it's a parameter.  The trouble begins with
+        # yacc's lookahead token.  We don't know if we're declaring or
+        # defining a function until we see LBRACE, but if we wait for yacc to
+        # trigger a rule on that token, then TT will have already been read
+        # and incorrectly interpreted as TYPEID.  We need to add the
+        # parameters to the scope the moment the lexer sees LBRACE.
+        #
+        if self._get_yacc_lookahead_token().type == "LBRACE":
+            if func.args is not None:
+                for param in func.args.params:
+                    if isinstance(param, c_ast.EllipsisParam): break
+                    self._add_identifier(param.name, param.coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=func)
+
+    def p_pointer(self, p):
+        """ pointer : TIMES type_qualifier_list_opt
+                    | TIMES type_qualifier_list_opt pointer
+        """
+        coord = self._token_coord(p, 1)
+        # Pointer decls nest from inside out. This is important when different
+        # levels have different qualifiers. For example:
+        #
+        #  char * const * p;
+        #
+        # Means "pointer to const pointer to char"
+        #
+        # While:
+        #
+        #  char ** const p;
+        #
+        # Means "const pointer to pointer to char"
+        #
+        # So when we construct PtrDecl nestings, the leftmost pointer goes in
+        # as the most nested type.
+        nested_type = c_ast.PtrDecl(quals=p[2] or [], type=None, coord=coord)
+        if len(p) > 3:
+            tail_type = p[3]
+            while tail_type.type is not None:
+                tail_type = tail_type.type
+            tail_type.type = nested_type
+            p[0] = p[3]
+        else:
+            p[0] = nested_type
+
+    def p_type_qualifier_list(self, p):
+        """ type_qualifier_list : type_qualifier
+                                | type_qualifier_list type_qualifier
+        """
+        p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]]
+
+    def p_parameter_type_list(self, p):
+        """ parameter_type_list : parameter_list
+                                | parameter_list COMMA ELLIPSIS
+        """
+        if len(p) > 2:
+            p[1].params.append(c_ast.EllipsisParam(self._token_coord(p, 3)))
+
+        p[0] = p[1]
+
+    def p_parameter_list(self, p):
+        """ parameter_list  : parameter_declaration
+                            | parameter_list COMMA parameter_declaration
+        """
+        if len(p) == 2: # single parameter
+            p[0] = c_ast.ParamList([p[1]], p[1].coord)
+        else:
+            p[1].params.append(p[3])
+            p[0] = p[1]
+
+    # From ISO/IEC 9899:TC2, 6.7.5.3.11:
+    # "If, in a parameter declaration, an identifier can be treated either
+    #  as a typedef name or as a parameter name, it shall be taken as a
+    #  typedef name."
+    #
+    # Inside a parameter declaration, once we've reduced declaration specifiers,
+    # if we shift in an LPAREN and see a TYPEID, it could be either an abstract
+    # declarator or a declarator nested inside parens. This rule tells us to
+    # always treat it as an abstract declarator. Therefore, we only accept
+    # `id_declarator`s and `typeid_noparen_declarator`s.
+    def p_parameter_declaration_1(self, p):
+        """ parameter_declaration   : declaration_specifiers id_declarator
+                                    | declaration_specifiers typeid_noparen_declarator
+        """
+        spec = p[1]
+        if not spec['type']:
+            spec['type'] = [c_ast.IdentifierType(['int'],
+                coord=self._token_coord(p, 1))]
+        p[0] = self._build_declarations(
+            spec=spec,
+            decls=[dict(decl=p[2])])[0]
+
+    def p_parameter_declaration_2(self, p):
+        """ parameter_declaration   : declaration_specifiers abstract_declarator_opt
+        """
+        spec = p[1]
+        if not spec['type']:
+            spec['type'] = [c_ast.IdentifierType(['int'],
+                coord=self._token_coord(p, 1))]
+
+        # Parameters can have the same names as typedefs.  The trouble is that
+        # the parameter's name gets grouped into declaration_specifiers, making
+        # it look like an old-style declaration; compensate.
+        #
+        if len(spec['type']) > 1 and len(spec['type'][-1].names) == 1 and \
+                self._is_type_in_scope(spec['type'][-1].names[0]):
+            decl = self._build_declarations(
+                    spec=spec,
+                    decls=[dict(decl=p[2], init=None)])[0]
+
+        # This truly is an old-style parameter declaration
+        #
+        else:
+            decl = c_ast.Typename(
+                name='',
+                quals=spec['qual'],
+                align=None,
+                type=p[2] or c_ast.TypeDecl(None, None, None, None),
+                coord=self._token_coord(p, 2))
+            typename = spec['type']
+            decl = self._fix_decl_name_type(decl, typename)
+
+        p[0] = decl
+
+    def p_identifier_list(self, p):
+        """ identifier_list : identifier
+                            | identifier_list COMMA identifier
+        """
+        if len(p) == 2: # single parameter
+            p[0] = c_ast.ParamList([p[1]], p[1].coord)
+        else:
+            p[1].params.append(p[3])
+            p[0] = p[1]
+
+    def p_initializer_1(self, p):
+        """ initializer : assignment_expression
+        """
+        p[0] = p[1]
+
+    def p_initializer_2(self, p):
+        """ initializer : brace_open initializer_list_opt brace_close
+                        | brace_open initializer_list COMMA brace_close
+        """
+        if p[2] is None:
+            p[0] = c_ast.InitList([], self._token_coord(p, 1))
+        else:
+            p[0] = p[2]
+
+    def p_initializer_list(self, p):
+        """ initializer_list    : designation_opt initializer
+                                | initializer_list COMMA designation_opt initializer
+        """
+        if len(p) == 3: # single initializer
+            init = p[2] if p[1] is None else c_ast.NamedInitializer(p[1], p[2])
+            p[0] = c_ast.InitList([init], p[2].coord)
+        else:
+            init = p[4] if p[3] is None else c_ast.NamedInitializer(p[3], p[4])
+            p[1].exprs.append(init)
+            p[0] = p[1]
+
+    def p_designation(self, p):
+        """ designation : designator_list EQUALS
+        """
+        p[0] = p[1]
+
+    # Designators are represented as a list of nodes, in the order in which
+    # they're written in the code.
+    #
+    def p_designator_list(self, p):
+        """ designator_list : designator
+                            | designator_list designator
+        """
+        p[0] = [p[1]] if len(p) == 2 else p[1] + [p[2]]
+
+    def p_designator(self, p):
+        """ designator  : LBRACKET constant_expression RBRACKET
+                        | PERIOD identifier
+        """
+        p[0] = p[2]
+
+    def p_type_name(self, p):
+        """ type_name   : specifier_qualifier_list abstract_declarator_opt
+        """
+        typename = c_ast.Typename(
+            name='',
+            quals=p[1]['qual'][:],
+            align=None,
+            type=p[2] or c_ast.TypeDecl(None, None, None, None),
+            coord=self._token_coord(p, 2))
+
+        p[0] = self._fix_decl_name_type(typename, p[1]['type'])
+
+    def p_abstract_declarator_1(self, p):
+        """ abstract_declarator     : pointer
+        """
+        dummytype = c_ast.TypeDecl(None, None, None, None)
+        p[0] = self._type_modify_decl(
+            decl=dummytype,
+            modifier=p[1])
+
+    def p_abstract_declarator_2(self, p):
+        """ abstract_declarator     : pointer direct_abstract_declarator
+        """
+        p[0] = self._type_modify_decl(p[2], p[1])
+
+    def p_abstract_declarator_3(self, p):
+        """ abstract_declarator     : direct_abstract_declarator
+        """
+        p[0] = p[1]
+
+    # Creating and using direct_abstract_declarator_opt here
+    # instead of listing both direct_abstract_declarator and the
+    # lack of it in the beginning of _1 and _2 caused two
+    # shift/reduce errors.
+    #
+    def p_direct_abstract_declarator_1(self, p):
+        """ direct_abstract_declarator  : LPAREN abstract_declarator RPAREN """
+        p[0] = p[2]
+
+    def p_direct_abstract_declarator_2(self, p):
+        """ direct_abstract_declarator  : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET
+        """
+        arr = c_ast.ArrayDecl(
+            type=None,
+            dim=p[3],
+            dim_quals=[],
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
+
+    def p_direct_abstract_declarator_3(self, p):
+        """ direct_abstract_declarator  : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET
+        """
+        quals = (p[2] if len(p) > 4 else []) or []
+        p[0] = c_ast.ArrayDecl(
+            type=c_ast.TypeDecl(None, None, None, None),
+            dim=p[3] if len(p) > 4 else p[2],
+            dim_quals=quals,
+            coord=self._token_coord(p, 1))
+
+    def p_direct_abstract_declarator_4(self, p):
+        """ direct_abstract_declarator  : direct_abstract_declarator LBRACKET TIMES RBRACKET
+        """
+        arr = c_ast.ArrayDecl(
+            type=None,
+            dim=c_ast.ID(p[3], self._token_coord(p, 3)),
+            dim_quals=[],
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=arr)
+
+    def p_direct_abstract_declarator_5(self, p):
+        """ direct_abstract_declarator  : LBRACKET TIMES RBRACKET
+        """
+        p[0] = c_ast.ArrayDecl(
+            type=c_ast.TypeDecl(None, None, None, None),
+            dim=c_ast.ID(p[3], self._token_coord(p, 3)),
+            dim_quals=[],
+            coord=self._token_coord(p, 1))
+
+    def p_direct_abstract_declarator_6(self, p):
+        """ direct_abstract_declarator  : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN
+        """
+        func = c_ast.FuncDecl(
+            args=p[3],
+            type=None,
+            coord=p[1].coord)
+
+        p[0] = self._type_modify_decl(decl=p[1], modifier=func)
+
+    def p_direct_abstract_declarator_7(self, p):
+        """ direct_abstract_declarator  : LPAREN parameter_type_list_opt RPAREN
+        """
+        p[0] = c_ast.FuncDecl(
+            args=p[2],
+            type=c_ast.TypeDecl(None, None, None, None),
+            coord=self._token_coord(p, 1))
+
+    # declaration is a list, statement isn't. To make it consistent, block_item
+    # will always be a list
+    #
+    def p_block_item(self, p):
+        """ block_item  : declaration
+                        | statement
+        """
+        p[0] = p[1] if isinstance(p[1], list) else [p[1]]
+
+    # Since we made block_item a list, this just combines lists
+    #
+    def p_block_item_list(self, p):
+        """ block_item_list : block_item
+                            | block_item_list block_item
+        """
+        # Empty block items (plain ';') produce [None], so ignore them
+        p[0] = p[1] if (len(p) == 2 or p[2] == [None]) else p[1] + p[2]
+
+    def p_compound_statement_1(self, p):
+        """ compound_statement : brace_open block_item_list_opt brace_close """
+        p[0] = c_ast.Compound(
+            block_items=p[2],
+            coord=self._token_coord(p, 1))
+
+    def p_labeled_statement_1(self, p):
+        """ labeled_statement : ID COLON pragmacomp_or_statement """
+        p[0] = c_ast.Label(p[1], p[3], self._token_coord(p, 1))
+
+    def p_labeled_statement_2(self, p):
+        """ labeled_statement : CASE constant_expression COLON pragmacomp_or_statement """
+        p[0] = c_ast.Case(p[2], [p[4]], self._token_coord(p, 1))
+
+    def p_labeled_statement_3(self, p):
+        """ labeled_statement : DEFAULT COLON pragmacomp_or_statement """
+        p[0] = c_ast.Default([p[3]], self._token_coord(p, 1))
+
+    def p_selection_statement_1(self, p):
+        """ selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement """
+        p[0] = c_ast.If(p[3], p[5], None, self._token_coord(p, 1))
+
+    def p_selection_statement_2(self, p):
+        """ selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement """
+        p[0] = c_ast.If(p[3], p[5], p[7], self._token_coord(p, 1))
+
+    def p_selection_statement_3(self, p):
+        """ selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement """
+        p[0] = fix_switch_cases(
+                c_ast.Switch(p[3], p[5], self._token_coord(p, 1)))
+
+    def p_iteration_statement_1(self, p):
+        """ iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement """
+        p[0] = c_ast.While(p[3], p[5], self._token_coord(p, 1))
+
+    def p_iteration_statement_2(self, p):
+        """ iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI """
+        p[0] = c_ast.DoWhile(p[5], p[2], self._token_coord(p, 1))
+
+    def p_iteration_statement_3(self, p):
+        """ iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """
+        p[0] = c_ast.For(p[3], p[5], p[7], p[9], self._token_coord(p, 1))
+
+    def p_iteration_statement_4(self, p):
+        """ iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement """
+        p[0] = c_ast.For(c_ast.DeclList(p[3], self._token_coord(p, 1)),
+                         p[4], p[6], p[8], self._token_coord(p, 1))
+
+    def p_jump_statement_1(self, p):
+        """ jump_statement  : GOTO ID SEMI """
+        p[0] = c_ast.Goto(p[2], self._token_coord(p, 1))
+
+    def p_jump_statement_2(self, p):
+        """ jump_statement  : BREAK SEMI """
+        p[0] = c_ast.Break(self._token_coord(p, 1))
+
+    def p_jump_statement_3(self, p):
+        """ jump_statement  : CONTINUE SEMI """
+        p[0] = c_ast.Continue(self._token_coord(p, 1))
+
+    def p_jump_statement_4(self, p):
+        """ jump_statement  : RETURN expression SEMI
+                            | RETURN SEMI
+        """
+        p[0] = c_ast.Return(p[2] if len(p) == 4 else None, self._token_coord(p, 1))
+
+    def p_expression_statement(self, p):
+        """ expression_statement : expression_opt SEMI """
+        if p[1] is None:
+            p[0] = c_ast.EmptyStatement(self._token_coord(p, 2))
+        else:
+            p[0] = p[1]
+
+    def p_expression(self, p):
+        """ expression  : assignment_expression
+                        | expression COMMA assignment_expression
+        """
+        if len(p) == 2:
+            p[0] = p[1]
+        else:
+            if not isinstance(p[1], c_ast.ExprList):
+                p[1] = c_ast.ExprList([p[1]], p[1].coord)
+
+            p[1].exprs.append(p[3])
+            p[0] = p[1]
+
+    def p_parenthesized_compound_expression(self, p):
+        """ assignment_expression : LPAREN compound_statement RPAREN """
+        p[0] = p[2]
+
+    def p_typedef_name(self, p):
+        """ typedef_name : TYPEID """
+        p[0] = c_ast.IdentifierType([p[1]], coord=self._token_coord(p, 1))
+
+    def p_assignment_expression(self, p):
+        """ assignment_expression   : conditional_expression
+                                    | unary_expression assignment_operator assignment_expression
+        """
+        if len(p) == 2:
+            p[0] = p[1]
+        else:
+            p[0] = c_ast.Assignment(p[2], p[1], p[3], p[1].coord)
+
+    # K&R2 defines these as many separate rules, to encode
+    # precedence and associativity. Why work hard ? I'll just use
+    # the built in precedence/associativity specification feature
+    # of PLY. (see precedence declaration above)
+    #
+    def p_assignment_operator(self, p):
+        """ assignment_operator : EQUALS
+                                | XOREQUAL
+                                | TIMESEQUAL
+                                | DIVEQUAL
+                                | MODEQUAL
+                                | PLUSEQUAL
+                                | MINUSEQUAL
+                                | LSHIFTEQUAL
+                                | RSHIFTEQUAL
+                                | ANDEQUAL
+                                | OREQUAL
+        """
+        p[0] = p[1]
+
+    def p_constant_expression(self, p):
+        """ constant_expression : conditional_expression """
+        p[0] = p[1]
+
+    def p_conditional_expression(self, p):
+        """ conditional_expression  : binary_expression
+                                    | binary_expression CONDOP expression COLON conditional_expression
+        """
+        if len(p) == 2:
+            p[0] = p[1]
+        else:
+            p[0] = c_ast.TernaryOp(p[1], p[3], p[5], p[1].coord)
+
+    def p_binary_expression(self, p):
+        """ binary_expression   : cast_expression
+                                | binary_expression TIMES binary_expression
+                                | binary_expression DIVIDE binary_expression
+                                | binary_expression MOD binary_expression
+                                | binary_expression PLUS binary_expression
+                                | binary_expression MINUS binary_expression
+                                | binary_expression RSHIFT binary_expression
+                                | binary_expression LSHIFT binary_expression
+                                | binary_expression LT binary_expression
+                                | binary_expression LE binary_expression
+                                | binary_expression GE binary_expression
+                                | binary_expression GT binary_expression
+                                | binary_expression EQ binary_expression
+                                | binary_expression NE binary_expression
+                                | binary_expression AND binary_expression
+                                | binary_expression OR binary_expression
+                                | binary_expression XOR binary_expression
+                                | binary_expression LAND binary_expression
+                                | binary_expression LOR binary_expression
+        """
+        if len(p) == 2:
+            p[0] = p[1]
+        else:
+            p[0] = c_ast.BinaryOp(p[2], p[1], p[3], p[1].coord)
+
+    def p_cast_expression_1(self, p):
+        """ cast_expression : unary_expression """
+        p[0] = p[1]
+
+    def p_cast_expression_2(self, p):
+        """ cast_expression : LPAREN type_name RPAREN cast_expression """
+        p[0] = c_ast.Cast(p[2], p[4], self._token_coord(p, 1))
+
+    def p_unary_expression_1(self, p):
+        """ unary_expression    : postfix_expression """
+        p[0] = p[1]
+
+    def p_unary_expression_2(self, p):
+        """ unary_expression    : PLUSPLUS unary_expression
+                                | MINUSMINUS unary_expression
+                                | unary_operator cast_expression
+        """
+        p[0] = c_ast.UnaryOp(p[1], p[2], p[2].coord)
+
+    def p_unary_expression_3(self, p):
+        """ unary_expression    : SIZEOF unary_expression
+                                | SIZEOF LPAREN type_name RPAREN
+                                | _ALIGNOF LPAREN type_name RPAREN
+        """
+        p[0] = c_ast.UnaryOp(
+            p[1],
+            p[2] if len(p) == 3 else p[3],
+            self._token_coord(p, 1))
+
+    def p_unary_operator(self, p):
+        """ unary_operator  : AND
+                            | TIMES
+                            | PLUS
+                            | MINUS
+                            | NOT
+                            | LNOT
+        """
+        p[0] = p[1]
+
+    def p_postfix_expression_1(self, p):
+        """ postfix_expression  : primary_expression """
+        p[0] = p[1]
+
+    def p_postfix_expression_2(self, p):
+        """ postfix_expression  : postfix_expression LBRACKET expression RBRACKET """
+        p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord)
+
+    def p_postfix_expression_3(self, p):
+        """ postfix_expression  : postfix_expression LPAREN argument_expression_list RPAREN
+                                | postfix_expression LPAREN RPAREN
+        """
+        p[0] = c_ast.FuncCall(p[1], p[3] if len(p) == 5 else None, p[1].coord)
+
+    def p_postfix_expression_4(self, p):
+        """ postfix_expression  : postfix_expression PERIOD ID
+                                | postfix_expression PERIOD TYPEID
+                                | postfix_expression ARROW ID
+                                | postfix_expression ARROW TYPEID
+        """
+        field = c_ast.ID(p[3], self._token_coord(p, 3))
+        p[0] = c_ast.StructRef(p[1], p[2], field, p[1].coord)
+
+    def p_postfix_expression_5(self, p):
+        """ postfix_expression  : postfix_expression PLUSPLUS
+                                | postfix_expression MINUSMINUS
+        """
+        p[0] = c_ast.UnaryOp('p' + p[2], p[1], p[1].coord)
+
+    def p_postfix_expression_6(self, p):
+        """ postfix_expression  : LPAREN type_name RPAREN brace_open initializer_list brace_close
+                                | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close
+        """
+        p[0] = c_ast.CompoundLiteral(p[2], p[5])
+
+    def p_primary_expression_1(self, p):
+        """ primary_expression  : identifier """
+        p[0] = p[1]
+
+    def p_primary_expression_2(self, p):
+        """ primary_expression  : constant """
+        p[0] = p[1]
+
+    def p_primary_expression_3(self, p):
+        """ primary_expression  : unified_string_literal
+                                | unified_wstring_literal
+        """
+        p[0] = p[1]
+
+    def p_primary_expression_4(self, p):
+        """ primary_expression  : LPAREN expression RPAREN """
+        p[0] = p[2]
+
+    def p_primary_expression_5(self, p):
+        """ primary_expression  : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN
+        """
+        coord = self._token_coord(p, 1)
+        p[0] = c_ast.FuncCall(c_ast.ID(p[1], coord),
+                              c_ast.ExprList([p[3], p[5]], coord),
+                              coord)
+
+    def p_offsetof_member_designator(self, p):
+        """ offsetof_member_designator : identifier
+                                         | offsetof_member_designator PERIOD identifier
+                                         | offsetof_member_designator LBRACKET expression RBRACKET
+        """
+        if len(p) == 2:
+            p[0] = p[1]
+        elif len(p) == 4:
+            p[0] = c_ast.StructRef(p[1], p[2], p[3], p[1].coord)
+        elif len(p) == 5:
+            p[0] = c_ast.ArrayRef(p[1], p[3], p[1].coord)
+        else:
+            raise NotImplementedError("Unexpected parsing state. len(p): %u" % len(p))
+
+    def p_argument_expression_list(self, p):
+        """ argument_expression_list    : assignment_expression
+                                        | argument_expression_list COMMA assignment_expression
+        """
+        if len(p) == 2: # single expr
+            p[0] = c_ast.ExprList([p[1]], p[1].coord)
+        else:
+            p[1].exprs.append(p[3])
+            p[0] = p[1]
+
+    def p_identifier(self, p):
+        """ identifier  : ID """
+        p[0] = c_ast.ID(p[1], self._token_coord(p, 1))
+
+    def p_constant_1(self, p):
+        """ constant    : INT_CONST_DEC
+                        | INT_CONST_OCT
+                        | INT_CONST_HEX
+                        | INT_CONST_BIN
+                        | INT_CONST_CHAR
+        """
+        uCount = 0
+        lCount = 0
+        for x in p[1][-3:]:
+            if x in ('l', 'L'):
+                lCount += 1
+            elif x in ('u', 'U'):
+                uCount += 1
+        t = ''
+        if uCount > 1:
+             raise ValueError('Constant cannot have more than one u/U suffix.')
+        elif lCount > 2:
+             raise ValueError('Constant cannot have more than two l/L suffix.')
+        prefix = 'unsigned ' * uCount + 'long ' * lCount
+        p[0] = c_ast.Constant(
+            prefix + 'int', p[1], self._token_coord(p, 1))
+
+    def p_constant_2(self, p):
+        """ constant    : FLOAT_CONST
+                        | HEX_FLOAT_CONST
+        """
+        if 'x' in p[1].lower():
+            t = 'float'
+        else:
+            if p[1][-1] in ('f', 'F'):
+                t = 'float'
+            elif p[1][-1] in ('l', 'L'):
+                t = 'long double'
+            else:
+                t = 'double'
+
+        p[0] = c_ast.Constant(
+            t, p[1], self._token_coord(p, 1))
+
+    def p_constant_3(self, p):
+        """ constant    : CHAR_CONST
+                        | WCHAR_CONST
+                        | U8CHAR_CONST
+                        | U16CHAR_CONST
+                        | U32CHAR_CONST
+        """
+        p[0] = c_ast.Constant(
+            'char', p[1], self._token_coord(p, 1))
+
+    # The "unified" string and wstring literal rules are for supporting
+    # concatenation of adjacent string literals.
+    # I.e. "hello " "world" is seen by the C compiler as a single string literal
+    # with the value "hello world"
+    #
+    def p_unified_string_literal(self, p):
+        """ unified_string_literal  : STRING_LITERAL
+                                    | unified_string_literal STRING_LITERAL
+        """
+        if len(p) == 2: # single literal
+            p[0] = c_ast.Constant(
+                'string', p[1], self._token_coord(p, 1))
+        else:
+            p[1].value = p[1].value[:-1] + p[2][1:]
+            p[0] = p[1]
+
+    def p_unified_wstring_literal(self, p):
+        """ unified_wstring_literal : WSTRING_LITERAL
+                                    | U8STRING_LITERAL
+                                    | U16STRING_LITERAL
+                                    | U32STRING_LITERAL
+                                    | unified_wstring_literal WSTRING_LITERAL
+                                    | unified_wstring_literal U8STRING_LITERAL
+                                    | unified_wstring_literal U16STRING_LITERAL
+                                    | unified_wstring_literal U32STRING_LITERAL
+        """
+        if len(p) == 2: # single literal
+            p[0] = c_ast.Constant(
+                'string', p[1], self._token_coord(p, 1))
+        else:
+            p[1].value = p[1].value.rstrip()[:-1] + p[2][2:]
+            p[0] = p[1]
+
+    def p_brace_open(self, p):
+        """ brace_open  :   LBRACE
+        """
+        p[0] = p[1]
+        p.set_lineno(0, p.lineno(1))
+
+    def p_brace_close(self, p):
+        """ brace_close :   RBRACE
+        """
+        p[0] = p[1]
+        p.set_lineno(0, p.lineno(1))
+
+    def p_empty(self, p):
+        'empty : '
+        p[0] = None
+
+    def p_error(self, p):
+        # If error recovery is added here in the future, make sure
+        # _get_yacc_lookahead_token still works!
+        #
+        if p:
+            self._parse_error(
+                'before: %s' % p.value,
+                self._coord(lineno=p.lineno,
+                            column=self.clex.find_tok_column(p)))
+        else:
+            self._parse_error('At end of input', self.clex.filename)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/lextab.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/lextab.py
new file mode 100644
index 0000000000000000000000000000000000000000..444b4656d5cec7bcbcf52a05823ec3d2fd6f29af
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/lextab.py
@@ -0,0 +1,10 @@
+# lextab.py. This file automatically created by PLY (version 3.10). Don't edit!
+_tabversion   = '3.10'
+_lextokens    = set(('INT_CONST_CHAR', 'VOID', 'LBRACKET', 'WCHAR_CONST', 'FLOAT_CONST', 'MINUS', 'RPAREN', 'STRUCT', 'LONG', 'PLUS', 'ELLIPSIS', 'U32STRING_LITERAL', 'GT', 'GOTO', 'ENUM', 'PERIOD', 'GE', 'INT_CONST_DEC', 'ARROW', '_STATIC_ASSERT', '__INT128', 'HEX_FLOAT_CONST', 'DOUBLE', 'MINUSEQUAL', 'INT_CONST_OCT', 'TIMESEQUAL', 'OR', 'SHORT', 'RETURN', 'RSHIFTEQUAL', '_ALIGNAS', 'RESTRICT', 'STATIC', 'SIZEOF', 'UNSIGNED', 'PLUSPLUS', 'COLON', 'WSTRING_LITERAL', 'DIVIDE', 'FOR', 'UNION', 'EQUALS', 'ELSE', 'ANDEQUAL', 'EQ', 'AND', 'TYPEID', 'LBRACE', 'PPHASH', 'INT', 'SIGNED', 'CONTINUE', 'NOT', 'OREQUAL', 'MOD', 'RSHIFT', 'DEFAULT', '_NORETURN', 'CHAR', 'WHILE', 'DIVEQUAL', '_ALIGNOF', 'EXTERN', 'LNOT', 'CASE', 'LAND', 'REGISTER', 'MODEQUAL', 'NE', 'SWITCH', 'INT_CONST_HEX', '_COMPLEX', 'PPPRAGMASTR', 'PLUSEQUAL', 'U32CHAR_CONST', 'CONDOP', 'U8STRING_LITERAL', 'BREAK', 'VOLATILE', 'PPPRAGMA', 'INLINE', 'INT_CONST_BIN', 'DO', 'U8CHAR_CONST', 'CONST', 'U16STRING_LITERAL', 'LOR', 'CHAR_CONST', 'LSHIFT', 'RBRACE', '_BOOL', 'LE', 'SEMI', '_THREAD_LOCAL', 'LT', 'COMMA', 'U16CHAR_CONST', 'OFFSETOF', '_ATOMIC', 'TYPEDEF', 'XOR', 'AUTO', 'TIMES', 'LPAREN', 'MINUSMINUS', 'ID', 'IF', 'STRING_LITERAL', 'FLOAT', 'XOREQUAL', 'LSHIFTEQUAL', 'RBRACKET'))
+_lexreflags   = 64
+_lexliterals  = ''
+_lexstateinfo = {'ppline': 'exclusive', 'pppragma': 'exclusive', 'INITIAL': 'inclusive'}
+_lexstatere   = {'ppline': [('(?P<t_ppline_FILENAME>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ppline_LINE_NUMBER>(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P<t_ppline_NEWLINE>\\n)|(?P<t_ppline_PPLINE>line)', [None, ('t_ppline_FILENAME', 'FILENAME'), None, None, ('t_ppline_LINE_NUMBER', 'LINE_NUMBER'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_ppline_NEWLINE', 'NEWLINE'), ('t_ppline_PPLINE', 'PPLINE')])], 'pppragma': [('(?P<t_pppragma_NEWLINE>\\n)|(?P<t_pppragma_PPPRAGMA>pragma)|(?P<t_pppragma_STR>.+)', [None, ('t_pppragma_NEWLINE', 'NEWLINE'), ('t_pppragma_PPPRAGMA', 'PPPRAGMA'), ('t_pppragma_STR', 'STR')])], 'INITIAL': [('(?P<t_PPHASH>[ \\t]*\\#)|(?P<t_NEWLINE>\\n+)|(?P<t_LBRACE>\\{)|(?P<t_RBRACE>\\})|(?P<t_FLOAT_CONST>((((([0-9]*\\.[0-9]+)|([0-9]+\\.))([eE][-+]?[0-9]+)?)|([0-9]+([eE][-+]?[0-9]+)))[FfLl]?))|(?P<t_HEX_FLOAT_CONST>(0[xX]([0-9a-fA-F]+|((([0-9a-fA-F]+)?\\.[0-9a-fA-F]+)|([0-9a-fA-F]+\\.)))([pP][+-]?[0-9]+)[FfLl]?))|(?P<t_INT_CONST_HEX>0[xX][0-9a-fA-F]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P<t_INT_CONST_BIN>0[bB][01]+(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)', [None, ('t_PPHASH', 'PPHASH'), ('t_NEWLINE', 'NEWLINE'), ('t_LBRACE', 'LBRACE'), ('t_RBRACE', 'RBRACE'), ('t_FLOAT_CONST', 'FLOAT_CONST'), None, None, None, None, None, None, None, None, None, ('t_HEX_FLOAT_CONST', 'HEX_FLOAT_CONST'), None, None, None, None, None, None, None, ('t_INT_CONST_HEX', 'INT_CONST_HEX'), None, None, None, None, None, None, None, ('t_INT_CONST_BIN', 'INT_CONST_BIN')]), ('(?P<t_BAD_CONST_OCT>0[0-7]*[89])|(?P<t_INT_CONST_OCT>0[0-7]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|(?P<t_INT_CONST_DEC>(0(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?)|([1-9][0-9]*(([uU]ll)|([uU]LL)|(ll[uU]?)|(LL[uU]?)|([uU][lL])|([lL][uU]?)|[uU])?))|(?P<t_INT_CONST_CHAR>\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F])))){2,4}\')|(?P<t_CHAR_CONST>\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_WCHAR_CONST>L\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U8CHAR_CONST>u8\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U16CHAR_CONST>u\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')|(?P<t_U32CHAR_CONST>U\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))\')', [None, ('t_BAD_CONST_OCT', 'BAD_CONST_OCT'), ('t_INT_CONST_OCT', 'INT_CONST_OCT'), None, None, None, None, None, None, None, ('t_INT_CONST_DEC', 'INT_CONST_DEC'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_INT_CONST_CHAR', 'INT_CONST_CHAR'), None, None, None, None, None, None, ('t_CHAR_CONST', 'CHAR_CONST'), None, None, None, None, None, None, ('t_WCHAR_CONST', 'WCHAR_CONST'), None, None, None, None, None, None, ('t_U8CHAR_CONST', 'U8CHAR_CONST'), None, None, None, None, None, None, ('t_U16CHAR_CONST', 'U16CHAR_CONST'), None, None, None, None, None, None, ('t_U32CHAR_CONST', 'U32CHAR_CONST')]), ('(?P<t_UNMATCHED_QUOTE>(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*\\n)|(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))*$))|(?P<t_BAD_CHAR_CONST>(\'([^\'\\\\\\n]|(\\\\(([a-wyzA-Z._~!=&\\^\\-\\\\?\'"]|x(?![0-9a-fA-F]))|(\\d+)(?!\\d)|(x[0-9a-fA-F]+)(?![0-9a-fA-F]))))[^\'\n]+\')|(\'\')|(\'([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])[^\'\\n]*\'))|(?P<t_WSTRING_LITERAL>L"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U8STRING_LITERAL>u8"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U16STRING_LITERAL>u"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_U32STRING_LITERAL>U"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_BAD_STRING_LITERAL>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*([\\\\][^a-zA-Z._~^!=&\\^\\-\\\\?\'"x0-9])([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ID>[a-zA-Z_$][0-9a-zA-Z_$]*)|(?P<t_STRING_LITERAL>"([^"\\\\\\n]|(\\\\[0-9a-zA-Z._~!=&\\^\\-\\\\?\'"]))*")|(?P<t_ELLIPSIS>\\.\\.\\.)|(?P<t_PLUSPLUS>\\+\\+)|(?P<t_LOR>\\|\\|)|(?P<t_XOREQUAL>\\^=)|(?P<t_OREQUAL>\\|=)|(?P<t_LSHIFTEQUAL><<=)|(?P<t_RSHIFTEQUAL>>>=)|(?P<t_PLUSEQUAL>\\+=)|(?P<t_TIMESEQUAL>\\*=)', [None, ('t_UNMATCHED_QUOTE', 'UNMATCHED_QUOTE'), None, None, None, None, None, None, None, None, None, None, None, None, None, None, ('t_BAD_CHAR_CONST', 'BAD_CHAR_CONST'), None, None, None, None, None, None, None, None, None, None, ('t_WSTRING_LITERAL', 'WSTRING_LITERAL'), None, None, ('t_U8STRING_LITERAL', 'U8STRING_LITERAL'), None, None, ('t_U16STRING_LITERAL', 'U16STRING_LITERAL'), None, None, ('t_U32STRING_LITERAL', 'U32STRING_LITERAL'), None, None, ('t_BAD_STRING_LITERAL', 'BAD_STRING_LITERAL'), None, None, None, None, None, ('t_ID', 'ID'), (None, 'STRING_LITERAL'), None, None, (None, 'ELLIPSIS'), (None, 'PLUSPLUS'), (None, 'LOR'), (None, 'XOREQUAL'), (None, 'OREQUAL'), (None, 'LSHIFTEQUAL'), (None, 'RSHIFTEQUAL'), (None, 'PLUSEQUAL'), (None, 'TIMESEQUAL')]), ('(?P<t_PLUS>\\+)|(?P<t_MODEQUAL>%=)|(?P<t_DIVEQUAL>/=)|(?P<t_RBRACKET>\\])|(?P<t_CONDOP>\\?)|(?P<t_XOR>\\^)|(?P<t_LSHIFT><<)|(?P<t_LE><=)|(?P<t_LPAREN>\\()|(?P<t_ARROW>->)|(?P<t_EQ>==)|(?P<t_NE>!=)|(?P<t_MINUSMINUS>--)|(?P<t_OR>\\|)|(?P<t_TIMES>\\*)|(?P<t_LBRACKET>\\[)|(?P<t_GE>>=)|(?P<t_RPAREN>\\))|(?P<t_LAND>&&)|(?P<t_RSHIFT>>>)|(?P<t_MINUSEQUAL>-=)|(?P<t_PERIOD>\\.)|(?P<t_ANDEQUAL>&=)|(?P<t_EQUALS>=)|(?P<t_LT><)|(?P<t_COMMA>,)|(?P<t_DIVIDE>/)|(?P<t_AND>&)|(?P<t_MOD>%)|(?P<t_SEMI>;)|(?P<t_MINUS>-)|(?P<t_GT>>)|(?P<t_COLON>:)|(?P<t_NOT>~)|(?P<t_LNOT>!)', [None, (None, 'PLUS'), (None, 'MODEQUAL'), (None, 'DIVEQUAL'), (None, 'RBRACKET'), (None, 'CONDOP'), (None, 'XOR'), (None, 'LSHIFT'), (None, 'LE'), (None, 'LPAREN'), (None, 'ARROW'), (None, 'EQ'), (None, 'NE'), (None, 'MINUSMINUS'), (None, 'OR'), (None, 'TIMES'), (None, 'LBRACKET'), (None, 'GE'), (None, 'RPAREN'), (None, 'LAND'), (None, 'RSHIFT'), (None, 'MINUSEQUAL'), (None, 'PERIOD'), (None, 'ANDEQUAL'), (None, 'EQUALS'), (None, 'LT'), (None, 'COMMA'), (None, 'DIVIDE'), (None, 'AND'), (None, 'MOD'), (None, 'SEMI'), (None, 'MINUS'), (None, 'GT'), (None, 'COLON'), (None, 'NOT'), (None, 'LNOT')])]}
+_lexstateignore = {'ppline': ' \t', 'pppragma': ' \t', 'INITIAL': ' \t'}
+_lexstateerrorf = {'ppline': 't_ppline_error', 'pppragma': 't_pppragma_error', 'INITIAL': 't_error'}
+_lexstateeoff = {}
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__init__.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..6e53cddcf6740cfb5317ce75efd7930c19e66f17
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__init__.py
@@ -0,0 +1,5 @@
+# PLY package
+# Author: David Beazley (dave@dabeaz.com)
+
+__version__ = '3.9'
+__all__ = ['lex','yacc']
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..da84ad0bcb25bf087dba00575df42d9c793496b0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/cpp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/cpp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d0af76890c166ab255e2705e1c3854377dfe473f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/cpp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ctokens.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ctokens.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7eaaae54b229fd7917508529666fbad0ec32b0bd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ctokens.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/lex.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/lex.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9c7113c6f7842d3a9997d79772e2177351eee91f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/lex.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/yacc.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/yacc.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..16478d867348ef94cbc0be082b3fb16a527d1986
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/yacc.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ygen.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ygen.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..892f8a5b85bce34284c531d0714cc71d71c0dc85
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/__pycache__/ygen.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/cpp.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/cpp.py
new file mode 100644
index 0000000000000000000000000000000000000000..86273eac77a5b404cb41cf4d2650d8a37415fb67
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/cpp.py
@@ -0,0 +1,905 @@
+# -----------------------------------------------------------------------------
+# cpp.py
+#
+# Author:  David Beazley (http://www.dabeaz.com)
+# Copyright (C) 2017
+# All rights reserved
+#
+# This module implements an ANSI-C style lexical preprocessor for PLY.
+# -----------------------------------------------------------------------------
+import sys
+
+# Some Python 3 compatibility shims
+if sys.version_info.major < 3:
+    STRING_TYPES = (str, unicode)
+else:
+    STRING_TYPES = str
+    xrange = range
+
+# -----------------------------------------------------------------------------
+# Default preprocessor lexer definitions.   These tokens are enough to get
+# a basic preprocessor working.   Other modules may import these if they want
+# -----------------------------------------------------------------------------
+
+tokens = (
+   'CPP_ID','CPP_INTEGER', 'CPP_FLOAT', 'CPP_STRING', 'CPP_CHAR', 'CPP_WS', 'CPP_COMMENT1', 'CPP_COMMENT2', 'CPP_POUND','CPP_DPOUND'
+)
+
+literals = "+-*/%|&~^<>=!?()[]{}.,;:\\\'\""
+
+# Whitespace
+def t_CPP_WS(t):
+    r'\s+'
+    t.lexer.lineno += t.value.count("\n")
+    return t
+
+t_CPP_POUND = r'\#'
+t_CPP_DPOUND = r'\#\#'
+
+# Identifier
+t_CPP_ID = r'[A-Za-z_][\w_]*'
+
+# Integer literal
+def CPP_INTEGER(t):
+    r'(((((0x)|(0X))[0-9a-fA-F]+)|(\d+))([uU][lL]|[lL][uU]|[uU]|[lL])?)'
+    return t
+
+t_CPP_INTEGER = CPP_INTEGER
+
+# Floating literal
+t_CPP_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?'
+
+# String literal
+def t_CPP_STRING(t):
+    r'\"([^\\\n]|(\\(.|\n)))*?\"'
+    t.lexer.lineno += t.value.count("\n")
+    return t
+
+# Character constant 'c' or L'c'
+def t_CPP_CHAR(t):
+    r'(L)?\'([^\\\n]|(\\(.|\n)))*?\''
+    t.lexer.lineno += t.value.count("\n")
+    return t
+
+# Comment
+def t_CPP_COMMENT1(t):
+    r'(/\*(.|\n)*?\*/)'
+    ncr = t.value.count("\n")
+    t.lexer.lineno += ncr
+    # replace with one space or a number of '\n'
+    t.type = 'CPP_WS'; t.value = '\n' * ncr if ncr else ' '
+    return t
+
+# Line comment
+def t_CPP_COMMENT2(t):
+    r'(//.*?(\n|$))'
+    # replace with '/n'
+    t.type = 'CPP_WS'; t.value = '\n'
+    return t
+
+def t_error(t):
+    t.type = t.value[0]
+    t.value = t.value[0]
+    t.lexer.skip(1)
+    return t
+
+import re
+import copy
+import time
+import os.path
+
+# -----------------------------------------------------------------------------
+# trigraph()
+#
+# Given an input string, this function replaces all trigraph sequences.
+# The following mapping is used:
+#
+#     ??=    #
+#     ??/    \
+#     ??'    ^
+#     ??(    [
+#     ??)    ]
+#     ??!    |
+#     ??<    {
+#     ??>    }
+#     ??-    ~
+# -----------------------------------------------------------------------------
+
+_trigraph_pat = re.compile(r'''\?\?[=/\'\(\)\!<>\-]''')
+_trigraph_rep = {
+    '=':'#',
+    '/':'\\',
+    "'":'^',
+    '(':'[',
+    ')':']',
+    '!':'|',
+    '<':'{',
+    '>':'}',
+    '-':'~'
+}
+
+def trigraph(input):
+    return _trigraph_pat.sub(lambda g: _trigraph_rep[g.group()[-1]],input)
+
+# ------------------------------------------------------------------
+# Macro object
+#
+# This object holds information about preprocessor macros
+#
+#    .name      - Macro name (string)
+#    .value     - Macro value (a list of tokens)
+#    .arglist   - List of argument names
+#    .variadic  - Boolean indicating whether or not variadic macro
+#    .vararg    - Name of the variadic parameter
+#
+# When a macro is created, the macro replacement token sequence is
+# pre-scanned and used to create patch lists that are later used
+# during macro expansion
+# ------------------------------------------------------------------
+
+class Macro(object):
+    def __init__(self,name,value,arglist=None,variadic=False):
+        self.name = name
+        self.value = value
+        self.arglist = arglist
+        self.variadic = variadic
+        if variadic:
+            self.vararg = arglist[-1]
+        self.source = None
+
+# ------------------------------------------------------------------
+# Preprocessor object
+#
+# Object representing a preprocessor.  Contains macro definitions,
+# include directories, and other information
+# ------------------------------------------------------------------
+
+class Preprocessor(object):
+    def __init__(self,lexer=None):
+        if lexer is None:
+            lexer = lex.lexer
+        self.lexer = lexer
+        self.macros = { }
+        self.path = []
+        self.temp_path = []
+
+        # Probe the lexer for selected tokens
+        self.lexprobe()
+
+        tm = time.localtime()
+        self.define("__DATE__ \"%s\"" % time.strftime("%b %d %Y",tm))
+        self.define("__TIME__ \"%s\"" % time.strftime("%H:%M:%S",tm))
+        self.parser = None
+
+    # -----------------------------------------------------------------------------
+    # tokenize()
+    #
+    # Utility function. Given a string of text, tokenize into a list of tokens
+    # -----------------------------------------------------------------------------
+
+    def tokenize(self,text):
+        tokens = []
+        self.lexer.input(text)
+        while True:
+            tok = self.lexer.token()
+            if not tok: break
+            tokens.append(tok)
+        return tokens
+
+    # ---------------------------------------------------------------------
+    # error()
+    #
+    # Report a preprocessor error/warning of some kind
+    # ----------------------------------------------------------------------
+
+    def error(self,file,line,msg):
+        print("%s:%d %s" % (file,line,msg))
+
+    # ----------------------------------------------------------------------
+    # lexprobe()
+    #
+    # This method probes the preprocessor lexer object to discover
+    # the token types of symbols that are important to the preprocessor.
+    # If this works right, the preprocessor will simply "work"
+    # with any suitable lexer regardless of how tokens have been named.
+    # ----------------------------------------------------------------------
+
+    def lexprobe(self):
+
+        # Determine the token type for identifiers
+        self.lexer.input("identifier")
+        tok = self.lexer.token()
+        if not tok or tok.value != "identifier":
+            print("Couldn't determine identifier type")
+        else:
+            self.t_ID = tok.type
+
+        # Determine the token type for integers
+        self.lexer.input("12345")
+        tok = self.lexer.token()
+        if not tok or int(tok.value) != 12345:
+            print("Couldn't determine integer type")
+        else:
+            self.t_INTEGER = tok.type
+            self.t_INTEGER_TYPE = type(tok.value)
+
+        # Determine the token type for strings enclosed in double quotes
+        self.lexer.input("\"filename\"")
+        tok = self.lexer.token()
+        if not tok or tok.value != "\"filename\"":
+            print("Couldn't determine string type")
+        else:
+            self.t_STRING = tok.type
+
+        # Determine the token type for whitespace--if any
+        self.lexer.input("  ")
+        tok = self.lexer.token()
+        if not tok or tok.value != "  ":
+            self.t_SPACE = None
+        else:
+            self.t_SPACE = tok.type
+
+        # Determine the token type for newlines
+        self.lexer.input("\n")
+        tok = self.lexer.token()
+        if not tok or tok.value != "\n":
+            self.t_NEWLINE = None
+            print("Couldn't determine token for newlines")
+        else:
+            self.t_NEWLINE = tok.type
+
+        self.t_WS = (self.t_SPACE, self.t_NEWLINE)
+
+        # Check for other characters used by the preprocessor
+        chars = [ '<','>','#','##','\\','(',')',',','.']
+        for c in chars:
+            self.lexer.input(c)
+            tok = self.lexer.token()
+            if not tok or tok.value != c:
+                print("Unable to lex '%s' required for preprocessor" % c)
+
+    # ----------------------------------------------------------------------
+    # add_path()
+    #
+    # Adds a search path to the preprocessor.
+    # ----------------------------------------------------------------------
+
+    def add_path(self,path):
+        self.path.append(path)
+
+    # ----------------------------------------------------------------------
+    # group_lines()
+    #
+    # Given an input string, this function splits it into lines.  Trailing whitespace
+    # is removed.   Any line ending with \ is grouped with the next line.  This
+    # function forms the lowest level of the preprocessor---grouping into text into
+    # a line-by-line format.
+    # ----------------------------------------------------------------------
+
+    def group_lines(self,input):
+        lex = self.lexer.clone()
+        lines = [x.rstrip() for x in input.splitlines()]
+        for i in xrange(len(lines)):
+            j = i+1
+            while lines[i].endswith('\\') and (j < len(lines)):
+                lines[i] = lines[i][:-1]+lines[j]
+                lines[j] = ""
+                j += 1
+
+        input = "\n".join(lines)
+        lex.input(input)
+        lex.lineno = 1
+
+        current_line = []
+        while True:
+            tok = lex.token()
+            if not tok:
+                break
+            current_line.append(tok)
+            if tok.type in self.t_WS and '\n' in tok.value:
+                yield current_line
+                current_line = []
+
+        if current_line:
+            yield current_line
+
+    # ----------------------------------------------------------------------
+    # tokenstrip()
+    #
+    # Remove leading/trailing whitespace tokens from a token list
+    # ----------------------------------------------------------------------
+
+    def tokenstrip(self,tokens):
+        i = 0
+        while i < len(tokens) and tokens[i].type in self.t_WS:
+            i += 1
+        del tokens[:i]
+        i = len(tokens)-1
+        while i >= 0 and tokens[i].type in self.t_WS:
+            i -= 1
+        del tokens[i+1:]
+        return tokens
+
+
+    # ----------------------------------------------------------------------
+    # collect_args()
+    #
+    # Collects comma separated arguments from a list of tokens.   The arguments
+    # must be enclosed in parenthesis.  Returns a tuple (tokencount,args,positions)
+    # where tokencount is the number of tokens consumed, args is a list of arguments,
+    # and positions is a list of integers containing the starting index of each
+    # argument.  Each argument is represented by a list of tokens.
+    #
+    # When collecting arguments, leading and trailing whitespace is removed
+    # from each argument.
+    #
+    # This function properly handles nested parenthesis and commas---these do not
+    # define new arguments.
+    # ----------------------------------------------------------------------
+
+    def collect_args(self,tokenlist):
+        args = []
+        positions = []
+        current_arg = []
+        nesting = 1
+        tokenlen = len(tokenlist)
+
+        # Search for the opening '('.
+        i = 0
+        while (i < tokenlen) and (tokenlist[i].type in self.t_WS):
+            i += 1
+
+        if (i < tokenlen) and (tokenlist[i].value == '('):
+            positions.append(i+1)
+        else:
+            self.error(self.source,tokenlist[0].lineno,"Missing '(' in macro arguments")
+            return 0, [], []
+
+        i += 1
+
+        while i < tokenlen:
+            t = tokenlist[i]
+            if t.value == '(':
+                current_arg.append(t)
+                nesting += 1
+            elif t.value == ')':
+                nesting -= 1
+                if nesting == 0:
+                    if current_arg:
+                        args.append(self.tokenstrip(current_arg))
+                        positions.append(i)
+                    return i+1,args,positions
+                current_arg.append(t)
+            elif t.value == ',' and nesting == 1:
+                args.append(self.tokenstrip(current_arg))
+                positions.append(i+1)
+                current_arg = []
+            else:
+                current_arg.append(t)
+            i += 1
+
+        # Missing end argument
+        self.error(self.source,tokenlist[-1].lineno,"Missing ')' in macro arguments")
+        return 0, [],[]
+
+    # ----------------------------------------------------------------------
+    # macro_prescan()
+    #
+    # Examine the macro value (token sequence) and identify patch points
+    # This is used to speed up macro expansion later on---we'll know
+    # right away where to apply patches to the value to form the expansion
+    # ----------------------------------------------------------------------
+
+    def macro_prescan(self,macro):
+        macro.patch     = []             # Standard macro arguments
+        macro.str_patch = []             # String conversion expansion
+        macro.var_comma_patch = []       # Variadic macro comma patch
+        i = 0
+        while i < len(macro.value):
+            if macro.value[i].type == self.t_ID and macro.value[i].value in macro.arglist:
+                argnum = macro.arglist.index(macro.value[i].value)
+                # Conversion of argument to a string
+                if i > 0 and macro.value[i-1].value == '#':
+                    macro.value[i] = copy.copy(macro.value[i])
+                    macro.value[i].type = self.t_STRING
+                    del macro.value[i-1]
+                    macro.str_patch.append((argnum,i-1))
+                    continue
+                # Concatenation
+                elif (i > 0 and macro.value[i-1].value == '##'):
+                    macro.patch.append(('c',argnum,i-1))
+                    del macro.value[i-1]
+                    continue
+                elif ((i+1) < len(macro.value) and macro.value[i+1].value == '##'):
+                    macro.patch.append(('c',argnum,i))
+                    i += 1
+                    continue
+                # Standard expansion
+                else:
+                    macro.patch.append(('e',argnum,i))
+            elif macro.value[i].value == '##':
+                if macro.variadic and (i > 0) and (macro.value[i-1].value == ',') and \
+                        ((i+1) < len(macro.value)) and (macro.value[i+1].type == self.t_ID) and \
+                        (macro.value[i+1].value == macro.vararg):
+                    macro.var_comma_patch.append(i-1)
+            i += 1
+        macro.patch.sort(key=lambda x: x[2],reverse=True)
+
+    # ----------------------------------------------------------------------
+    # macro_expand_args()
+    #
+    # Given a Macro and list of arguments (each a token list), this method
+    # returns an expanded version of a macro.  The return value is a token sequence
+    # representing the replacement macro tokens
+    # ----------------------------------------------------------------------
+
+    def macro_expand_args(self,macro,args):
+        # Make a copy of the macro token sequence
+        rep = [copy.copy(_x) for _x in macro.value]
+
+        # Make string expansion patches.  These do not alter the length of the replacement sequence
+
+        str_expansion = {}
+        for argnum, i in macro.str_patch:
+            if argnum not in str_expansion:
+                str_expansion[argnum] = ('"%s"' % "".join([x.value for x in args[argnum]])).replace("\\","\\\\")
+            rep[i] = copy.copy(rep[i])
+            rep[i].value = str_expansion[argnum]
+
+        # Make the variadic macro comma patch.  If the variadic macro argument is empty, we get rid
+        comma_patch = False
+        if macro.variadic and not args[-1]:
+            for i in macro.var_comma_patch:
+                rep[i] = None
+                comma_patch = True
+
+        # Make all other patches.   The order of these matters.  It is assumed that the patch list
+        # has been sorted in reverse order of patch location since replacements will cause the
+        # size of the replacement sequence to expand from the patch point.
+
+        expanded = { }
+        for ptype, argnum, i in macro.patch:
+            # Concatenation.   Argument is left unexpanded
+            if ptype == 'c':
+                rep[i:i+1] = args[argnum]
+            # Normal expansion.  Argument is macro expanded first
+            elif ptype == 'e':
+                if argnum not in expanded:
+                    expanded[argnum] = self.expand_macros(args[argnum])
+                rep[i:i+1] = expanded[argnum]
+
+        # Get rid of removed comma if necessary
+        if comma_patch:
+            rep = [_i for _i in rep if _i]
+
+        return rep
+
+
+    # ----------------------------------------------------------------------
+    # expand_macros()
+    #
+    # Given a list of tokens, this function performs macro expansion.
+    # The expanded argument is a dictionary that contains macros already
+    # expanded.  This is used to prevent infinite recursion.
+    # ----------------------------------------------------------------------
+
+    def expand_macros(self,tokens,expanded=None):
+        if expanded is None:
+            expanded = {}
+        i = 0
+        while i < len(tokens):
+            t = tokens[i]
+            if t.type == self.t_ID:
+                if t.value in self.macros and t.value not in expanded:
+                    # Yes, we found a macro match
+                    expanded[t.value] = True
+
+                    m = self.macros[t.value]
+                    if not m.arglist:
+                        # A simple macro
+                        ex = self.expand_macros([copy.copy(_x) for _x in m.value],expanded)
+                        for e in ex:
+                            e.lineno = t.lineno
+                        tokens[i:i+1] = ex
+                        i += len(ex)
+                    else:
+                        # A macro with arguments
+                        j = i + 1
+                        while j < len(tokens) and tokens[j].type in self.t_WS:
+                            j += 1
+                        if tokens[j].value == '(':
+                            tokcount,args,positions = self.collect_args(tokens[j:])
+                            if not m.variadic and len(args) !=  len(m.arglist):
+                                self.error(self.source,t.lineno,"Macro %s requires %d arguments" % (t.value,len(m.arglist)))
+                                i = j + tokcount
+                            elif m.variadic and len(args) < len(m.arglist)-1:
+                                if len(m.arglist) > 2:
+                                    self.error(self.source,t.lineno,"Macro %s must have at least %d arguments" % (t.value, len(m.arglist)-1))
+                                else:
+                                    self.error(self.source,t.lineno,"Macro %s must have at least %d argument" % (t.value, len(m.arglist)-1))
+                                i = j + tokcount
+                            else:
+                                if m.variadic:
+                                    if len(args) == len(m.arglist)-1:
+                                        args.append([])
+                                    else:
+                                        args[len(m.arglist)-1] = tokens[j+positions[len(m.arglist)-1]:j+tokcount-1]
+                                        del args[len(m.arglist):]
+
+                                # Get macro replacement text
+                                rep = self.macro_expand_args(m,args)
+                                rep = self.expand_macros(rep,expanded)
+                                for r in rep:
+                                    r.lineno = t.lineno
+                                tokens[i:j+tokcount] = rep
+                                i += len(rep)
+                    del expanded[t.value]
+                    continue
+                elif t.value == '__LINE__':
+                    t.type = self.t_INTEGER
+                    t.value = self.t_INTEGER_TYPE(t.lineno)
+
+            i += 1
+        return tokens
+
+    # ----------------------------------------------------------------------
+    # evalexpr()
+    #
+    # Evaluate an expression token sequence for the purposes of evaluating
+    # integral expressions.
+    # ----------------------------------------------------------------------
+
+    def evalexpr(self,tokens):
+        # tokens = tokenize(line)
+        # Search for defined macros
+        i = 0
+        while i < len(tokens):
+            if tokens[i].type == self.t_ID and tokens[i].value == 'defined':
+                j = i + 1
+                needparen = False
+                result = "0L"
+                while j < len(tokens):
+                    if tokens[j].type in self.t_WS:
+                        j += 1
+                        continue
+                    elif tokens[j].type == self.t_ID:
+                        if tokens[j].value in self.macros:
+                            result = "1L"
+                        else:
+                            result = "0L"
+                        if not needparen: break
+                    elif tokens[j].value == '(':
+                        needparen = True
+                    elif tokens[j].value == ')':
+                        break
+                    else:
+                        self.error(self.source,tokens[i].lineno,"Malformed defined()")
+                    j += 1
+                tokens[i].type = self.t_INTEGER
+                tokens[i].value = self.t_INTEGER_TYPE(result)
+                del tokens[i+1:j+1]
+            i += 1
+        tokens = self.expand_macros(tokens)
+        for i,t in enumerate(tokens):
+            if t.type == self.t_ID:
+                tokens[i] = copy.copy(t)
+                tokens[i].type = self.t_INTEGER
+                tokens[i].value = self.t_INTEGER_TYPE("0L")
+            elif t.type == self.t_INTEGER:
+                tokens[i] = copy.copy(t)
+                # Strip off any trailing suffixes
+                tokens[i].value = str(tokens[i].value)
+                while tokens[i].value[-1] not in "0123456789abcdefABCDEF":
+                    tokens[i].value = tokens[i].value[:-1]
+
+        expr = "".join([str(x.value) for x in tokens])
+        expr = expr.replace("&&"," and ")
+        expr = expr.replace("||"," or ")
+        expr = expr.replace("!"," not ")
+        try:
+            result = eval(expr)
+        except Exception:
+            self.error(self.source,tokens[0].lineno,"Couldn't evaluate expression")
+            result = 0
+        return result
+
+    # ----------------------------------------------------------------------
+    # parsegen()
+    #
+    # Parse an input string/
+    # ----------------------------------------------------------------------
+    def parsegen(self,input,source=None):
+
+        # Replace trigraph sequences
+        t = trigraph(input)
+        lines = self.group_lines(t)
+
+        if not source:
+            source = ""
+
+        self.define("__FILE__ \"%s\"" % source)
+
+        self.source = source
+        chunk = []
+        enable = True
+        iftrigger = False
+        ifstack = []
+
+        for x in lines:
+            for i,tok in enumerate(x):
+                if tok.type not in self.t_WS: break
+            if tok.value == '#':
+                # Preprocessor directive
+
+                # insert necessary whitespace instead of eaten tokens
+                for tok in x:
+                    if tok.type in self.t_WS and '\n' in tok.value:
+                        chunk.append(tok)
+
+                dirtokens = self.tokenstrip(x[i+1:])
+                if dirtokens:
+                    name = dirtokens[0].value
+                    args = self.tokenstrip(dirtokens[1:])
+                else:
+                    name = ""
+                    args = []
+
+                if name == 'define':
+                    if enable:
+                        for tok in self.expand_macros(chunk):
+                            yield tok
+                        chunk = []
+                        self.define(args)
+                elif name == 'include':
+                    if enable:
+                        for tok in self.expand_macros(chunk):
+                            yield tok
+                        chunk = []
+                        oldfile = self.macros['__FILE__']
+                        for tok in self.include(args):
+                            yield tok
+                        self.macros['__FILE__'] = oldfile
+                        self.source = source
+                elif name == 'undef':
+                    if enable:
+                        for tok in self.expand_macros(chunk):
+                            yield tok
+                        chunk = []
+                        self.undef(args)
+                elif name == 'ifdef':
+                    ifstack.append((enable,iftrigger))
+                    if enable:
+                        if not args[0].value in self.macros:
+                            enable = False
+                            iftrigger = False
+                        else:
+                            iftrigger = True
+                elif name == 'ifndef':
+                    ifstack.append((enable,iftrigger))
+                    if enable:
+                        if args[0].value in self.macros:
+                            enable = False
+                            iftrigger = False
+                        else:
+                            iftrigger = True
+                elif name == 'if':
+                    ifstack.append((enable,iftrigger))
+                    if enable:
+                        result = self.evalexpr(args)
+                        if not result:
+                            enable = False
+                            iftrigger = False
+                        else:
+                            iftrigger = True
+                elif name == 'elif':
+                    if ifstack:
+                        if ifstack[-1][0]:     # We only pay attention if outer "if" allows this
+                            if enable:         # If already true, we flip enable False
+                                enable = False
+                            elif not iftrigger:   # If False, but not triggered yet, we'll check expression
+                                result = self.evalexpr(args)
+                                if result:
+                                    enable  = True
+                                    iftrigger = True
+                    else:
+                        self.error(self.source,dirtokens[0].lineno,"Misplaced #elif")
+
+                elif name == 'else':
+                    if ifstack:
+                        if ifstack[-1][0]:
+                            if enable:
+                                enable = False
+                            elif not iftrigger:
+                                enable = True
+                                iftrigger = True
+                    else:
+                        self.error(self.source,dirtokens[0].lineno,"Misplaced #else")
+
+                elif name == 'endif':
+                    if ifstack:
+                        enable,iftrigger = ifstack.pop()
+                    else:
+                        self.error(self.source,dirtokens[0].lineno,"Misplaced #endif")
+                else:
+                    # Unknown preprocessor directive
+                    pass
+
+            else:
+                # Normal text
+                if enable:
+                    chunk.extend(x)
+
+        for tok in self.expand_macros(chunk):
+            yield tok
+        chunk = []
+
+    # ----------------------------------------------------------------------
+    # include()
+    #
+    # Implementation of file-inclusion
+    # ----------------------------------------------------------------------
+
+    def include(self,tokens):
+        # Try to extract the filename and then process an include file
+        if not tokens:
+            return
+        if tokens:
+            if tokens[0].value != '<' and tokens[0].type != self.t_STRING:
+                tokens = self.expand_macros(tokens)
+
+            if tokens[0].value == '<':
+                # Include <...>
+                i = 1
+                while i < len(tokens):
+                    if tokens[i].value == '>':
+                        break
+                    i += 1
+                else:
+                    print("Malformed #include <...>")
+                    return
+                filename = "".join([x.value for x in tokens[1:i]])
+                path = self.path + [""] + self.temp_path
+            elif tokens[0].type == self.t_STRING:
+                filename = tokens[0].value[1:-1]
+                path = self.temp_path + [""] + self.path
+            else:
+                print("Malformed #include statement")
+                return
+        for p in path:
+            iname = os.path.join(p,filename)
+            try:
+                data = open(iname,"r").read()
+                dname = os.path.dirname(iname)
+                if dname:
+                    self.temp_path.insert(0,dname)
+                for tok in self.parsegen(data,filename):
+                    yield tok
+                if dname:
+                    del self.temp_path[0]
+                break
+            except IOError:
+                pass
+        else:
+            print("Couldn't find '%s'" % filename)
+
+    # ----------------------------------------------------------------------
+    # define()
+    #
+    # Define a new macro
+    # ----------------------------------------------------------------------
+
+    def define(self,tokens):
+        if isinstance(tokens,STRING_TYPES):
+            tokens = self.tokenize(tokens)
+
+        linetok = tokens
+        try:
+            name = linetok[0]
+            if len(linetok) > 1:
+                mtype = linetok[1]
+            else:
+                mtype = None
+            if not mtype:
+                m = Macro(name.value,[])
+                self.macros[name.value] = m
+            elif mtype.type in self.t_WS:
+                # A normal macro
+                m = Macro(name.value,self.tokenstrip(linetok[2:]))
+                self.macros[name.value] = m
+            elif mtype.value == '(':
+                # A macro with arguments
+                tokcount, args, positions = self.collect_args(linetok[1:])
+                variadic = False
+                for a in args:
+                    if variadic:
+                        print("No more arguments may follow a variadic argument")
+                        break
+                    astr = "".join([str(_i.value) for _i in a])
+                    if astr == "...":
+                        variadic = True
+                        a[0].type = self.t_ID
+                        a[0].value = '__VA_ARGS__'
+                        variadic = True
+                        del a[1:]
+                        continue
+                    elif astr[-3:] == "..." and a[0].type == self.t_ID:
+                        variadic = True
+                        del a[1:]
+                        # If, for some reason, "." is part of the identifier, strip off the name for the purposes
+                        # of macro expansion
+                        if a[0].value[-3:] == '...':
+                            a[0].value = a[0].value[:-3]
+                        continue
+                    if len(a) > 1 or a[0].type != self.t_ID:
+                        print("Invalid macro argument")
+                        break
+                else:
+                    mvalue = self.tokenstrip(linetok[1+tokcount:])
+                    i = 0
+                    while i < len(mvalue):
+                        if i+1 < len(mvalue):
+                            if mvalue[i].type in self.t_WS and mvalue[i+1].value == '##':
+                                del mvalue[i]
+                                continue
+                            elif mvalue[i].value == '##' and mvalue[i+1].type in self.t_WS:
+                                del mvalue[i+1]
+                        i += 1
+                    m = Macro(name.value,mvalue,[x[0].value for x in args],variadic)
+                    self.macro_prescan(m)
+                    self.macros[name.value] = m
+            else:
+                print("Bad macro definition")
+        except LookupError:
+            print("Bad macro definition")
+
+    # ----------------------------------------------------------------------
+    # undef()
+    #
+    # Undefine a macro
+    # ----------------------------------------------------------------------
+
+    def undef(self,tokens):
+        id = tokens[0].value
+        try:
+            del self.macros[id]
+        except LookupError:
+            pass
+
+    # ----------------------------------------------------------------------
+    # parse()
+    #
+    # Parse input text.
+    # ----------------------------------------------------------------------
+    def parse(self,input,source=None,ignore={}):
+        self.ignore = ignore
+        self.parser = self.parsegen(input,source)
+
+    # ----------------------------------------------------------------------
+    # token()
+    #
+    # Method to return individual tokens
+    # ----------------------------------------------------------------------
+    def token(self):
+        try:
+            while True:
+                tok = next(self.parser)
+                if tok.type not in self.ignore: return tok
+        except StopIteration:
+            self.parser = None
+            return None
+
+if __name__ == '__main__':
+    import ply.lex as lex
+    lexer = lex.lex()
+
+    # Run a preprocessor
+    import sys
+    f = open(sys.argv[1])
+    input = f.read()
+
+    p = Preprocessor(lexer)
+    p.parse(input,sys.argv[1])
+    while True:
+        tok = p.token()
+        if not tok: break
+        print(p.source, tok)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ctokens.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ctokens.py
new file mode 100644
index 0000000000000000000000000000000000000000..f6f6952d605ee5fa0a25eff03f18769b6b445fae
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ctokens.py
@@ -0,0 +1,133 @@
+# ----------------------------------------------------------------------
+# ctokens.py
+#
+# Token specifications for symbols in ANSI C and C++.  This file is
+# meant to be used as a library in other tokenizers.
+# ----------------------------------------------------------------------
+
+# Reserved words
+
+tokens = [
+    # Literals (identifier, integer constant, float constant, string constant, char const)
+    'ID', 'TYPEID', 'INTEGER', 'FLOAT', 'STRING', 'CHARACTER',
+
+    # Operators (+,-,*,/,%,|,&,~,^,<<,>>, ||, &&, !, <, <=, >, >=, ==, !=)
+    'PLUS', 'MINUS', 'TIMES', 'DIVIDE', 'MODULO',
+    'OR', 'AND', 'NOT', 'XOR', 'LSHIFT', 'RSHIFT',
+    'LOR', 'LAND', 'LNOT',
+    'LT', 'LE', 'GT', 'GE', 'EQ', 'NE',
+    
+    # Assignment (=, *=, /=, %=, +=, -=, <<=, >>=, &=, ^=, |=)
+    'EQUALS', 'TIMESEQUAL', 'DIVEQUAL', 'MODEQUAL', 'PLUSEQUAL', 'MINUSEQUAL',
+    'LSHIFTEQUAL','RSHIFTEQUAL', 'ANDEQUAL', 'XOREQUAL', 'OREQUAL',
+
+    # Increment/decrement (++,--)
+    'INCREMENT', 'DECREMENT',
+
+    # Structure dereference (->)
+    'ARROW',
+
+    # Ternary operator (?)
+    'TERNARY',
+    
+    # Delimeters ( ) [ ] { } , . ; :
+    'LPAREN', 'RPAREN',
+    'LBRACKET', 'RBRACKET',
+    'LBRACE', 'RBRACE',
+    'COMMA', 'PERIOD', 'SEMI', 'COLON',
+
+    # Ellipsis (...)
+    'ELLIPSIS',
+]
+    
+# Operators
+t_PLUS             = r'\+'
+t_MINUS            = r'-'
+t_TIMES            = r'\*'
+t_DIVIDE           = r'/'
+t_MODULO           = r'%'
+t_OR               = r'\|'
+t_AND              = r'&'
+t_NOT              = r'~'
+t_XOR              = r'\^'
+t_LSHIFT           = r'<<'
+t_RSHIFT           = r'>>'
+t_LOR              = r'\|\|'
+t_LAND             = r'&&'
+t_LNOT             = r'!'
+t_LT               = r'<'
+t_GT               = r'>'
+t_LE               = r'<='
+t_GE               = r'>='
+t_EQ               = r'=='
+t_NE               = r'!='
+
+# Assignment operators
+
+t_EQUALS           = r'='
+t_TIMESEQUAL       = r'\*='
+t_DIVEQUAL         = r'/='
+t_MODEQUAL         = r'%='
+t_PLUSEQUAL        = r'\+='
+t_MINUSEQUAL       = r'-='
+t_LSHIFTEQUAL      = r'<<='
+t_RSHIFTEQUAL      = r'>>='
+t_ANDEQUAL         = r'&='
+t_OREQUAL          = r'\|='
+t_XOREQUAL         = r'\^='
+
+# Increment/decrement
+t_INCREMENT        = r'\+\+'
+t_DECREMENT        = r'--'
+
+# ->
+t_ARROW            = r'->'
+
+# ?
+t_TERNARY          = r'\?'
+
+# Delimeters
+t_LPAREN           = r'\('
+t_RPAREN           = r'\)'
+t_LBRACKET         = r'\['
+t_RBRACKET         = r'\]'
+t_LBRACE           = r'\{'
+t_RBRACE           = r'\}'
+t_COMMA            = r','
+t_PERIOD           = r'\.'
+t_SEMI             = r';'
+t_COLON            = r':'
+t_ELLIPSIS         = r'\.\.\.'
+
+# Identifiers
+t_ID = r'[A-Za-z_][A-Za-z0-9_]*'
+
+# Integer literal
+t_INTEGER = r'\d+([uU]|[lL]|[uU][lL]|[lL][uU])?'
+
+# Floating literal
+t_FLOAT = r'((\d+)(\.\d+)(e(\+|-)?(\d+))? | (\d+)e(\+|-)?(\d+))([lL]|[fF])?'
+
+# String literal
+t_STRING = r'\"([^\\\n]|(\\.))*?\"'
+
+# Character constant 'c' or L'c'
+t_CHARACTER = r'(L)?\'([^\\\n]|(\\.))*?\''
+
+# Comment (C-Style)
+def t_COMMENT(t):
+    r'/\*(.|\n)*?\*/'
+    t.lexer.lineno += t.value.count('\n')
+    return t
+
+# Comment (C++-Style)
+def t_CPPCOMMENT(t):
+    r'//.*\n'
+    t.lexer.lineno += 1
+    return t
+
+
+    
+
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/lex.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/lex.py
new file mode 100644
index 0000000000000000000000000000000000000000..4bdd76ca06d1aee995142be8a3183894776df6fa
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/lex.py
@@ -0,0 +1,1099 @@
+# -----------------------------------------------------------------------------
+# ply: lex.py
+#
+# Copyright (C) 2001-2017
+# David M. Beazley (Dabeaz LLC)
+# 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 David Beazley or Dabeaz LLC 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
+# OWNER 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.
+# -----------------------------------------------------------------------------
+
+__version__    = '3.10'
+__tabversion__ = '3.10'
+
+import re
+import sys
+import types
+import copy
+import os
+import inspect
+
+# This tuple contains known string types
+try:
+    # Python 2.6
+    StringTypes = (types.StringType, types.UnicodeType)
+except AttributeError:
+    # Python 3.0
+    StringTypes = (str, bytes)
+
+# This regular expression is used to match valid token names
+_is_identifier = re.compile(r'^[a-zA-Z0-9_]+$')
+
+# Exception thrown when invalid token encountered and no default error
+# handler is defined.
+class LexError(Exception):
+    def __init__(self, message, s):
+        self.args = (message,)
+        self.text = s
+
+
+# Token class.  This class is used to represent the tokens produced.
+class LexToken(object):
+    def __str__(self):
+        return 'LexToken(%s,%r,%d,%d)' % (self.type, self.value, self.lineno, self.lexpos)
+
+    def __repr__(self):
+        return str(self)
+
+
+# This object is a stand-in for a logging object created by the
+# logging module.
+
+class PlyLogger(object):
+    def __init__(self, f):
+        self.f = f
+
+    def critical(self, msg, *args, **kwargs):
+        self.f.write((msg % args) + '\n')
+
+    def warning(self, msg, *args, **kwargs):
+        self.f.write('WARNING: ' + (msg % args) + '\n')
+
+    def error(self, msg, *args, **kwargs):
+        self.f.write('ERROR: ' + (msg % args) + '\n')
+
+    info = critical
+    debug = critical
+
+
+# Null logger is used when no output is generated. Does nothing.
+class NullLogger(object):
+    def __getattribute__(self, name):
+        return self
+
+    def __call__(self, *args, **kwargs):
+        return self
+
+
+# -----------------------------------------------------------------------------
+#                        === Lexing Engine ===
+#
+# The following Lexer class implements the lexer runtime.   There are only
+# a few public methods and attributes:
+#
+#    input()          -  Store a new string in the lexer
+#    token()          -  Get the next token
+#    clone()          -  Clone the lexer
+#
+#    lineno           -  Current line number
+#    lexpos           -  Current position in the input string
+# -----------------------------------------------------------------------------
+
+class Lexer:
+    def __init__(self):
+        self.lexre = None             # Master regular expression. This is a list of
+                                      # tuples (re, findex) where re is a compiled
+                                      # regular expression and findex is a list
+                                      # mapping regex group numbers to rules
+        self.lexretext = None         # Current regular expression strings
+        self.lexstatere = {}          # Dictionary mapping lexer states to master regexs
+        self.lexstateretext = {}      # Dictionary mapping lexer states to regex strings
+        self.lexstaterenames = {}     # Dictionary mapping lexer states to symbol names
+        self.lexstate = 'INITIAL'     # Current lexer state
+        self.lexstatestack = []       # Stack of lexer states
+        self.lexstateinfo = None      # State information
+        self.lexstateignore = {}      # Dictionary of ignored characters for each state
+        self.lexstateerrorf = {}      # Dictionary of error functions for each state
+        self.lexstateeoff = {}        # Dictionary of eof functions for each state
+        self.lexreflags = 0           # Optional re compile flags
+        self.lexdata = None           # Actual input data (as a string)
+        self.lexpos = 0               # Current position in input text
+        self.lexlen = 0               # Length of the input text
+        self.lexerrorf = None         # Error rule (if any)
+        self.lexeoff = None           # EOF rule (if any)
+        self.lextokens = None         # List of valid tokens
+        self.lexignore = ''           # Ignored characters
+        self.lexliterals = ''         # Literal characters that can be passed through
+        self.lexmodule = None         # Module
+        self.lineno = 1               # Current line number
+        self.lexoptimize = False      # Optimized mode
+
+    def clone(self, object=None):
+        c = copy.copy(self)
+
+        # If the object parameter has been supplied, it means we are attaching the
+        # lexer to a new object.  In this case, we have to rebind all methods in
+        # the lexstatere and lexstateerrorf tables.
+
+        if object:
+            newtab = {}
+            for key, ritem in self.lexstatere.items():
+                newre = []
+                for cre, findex in ritem:
+                    newfindex = []
+                    for f in findex:
+                        if not f or not f[0]:
+                            newfindex.append(f)
+                            continue
+                        newfindex.append((getattr(object, f[0].__name__), f[1]))
+                newre.append((cre, newfindex))
+                newtab[key] = newre
+            c.lexstatere = newtab
+            c.lexstateerrorf = {}
+            for key, ef in self.lexstateerrorf.items():
+                c.lexstateerrorf[key] = getattr(object, ef.__name__)
+            c.lexmodule = object
+        return c
+
+    # ------------------------------------------------------------
+    # writetab() - Write lexer information to a table file
+    # ------------------------------------------------------------
+    def writetab(self, lextab, outputdir=''):
+        if isinstance(lextab, types.ModuleType):
+            raise IOError("Won't overwrite existing lextab module")
+        basetabmodule = lextab.split('.')[-1]
+        filename = os.path.join(outputdir, basetabmodule) + '.py'
+        with open(filename, 'w') as tf:
+            tf.write('# %s.py. This file automatically created by PLY (version %s). Don\'t edit!\n' % (basetabmodule, __version__))
+            tf.write('_tabversion   = %s\n' % repr(__tabversion__))
+            tf.write('_lextokens    = set(%s)\n' % repr(tuple(self.lextokens)))
+            tf.write('_lexreflags   = %s\n' % repr(self.lexreflags))
+            tf.write('_lexliterals  = %s\n' % repr(self.lexliterals))
+            tf.write('_lexstateinfo = %s\n' % repr(self.lexstateinfo))
+
+            # Rewrite the lexstatere table, replacing function objects with function names
+            tabre = {}
+            for statename, lre in self.lexstatere.items():
+                titem = []
+                for (pat, func), retext, renames in zip(lre, self.lexstateretext[statename], self.lexstaterenames[statename]):
+                    titem.append((retext, _funcs_to_names(func, renames)))
+                tabre[statename] = titem
+
+            tf.write('_lexstatere   = %s\n' % repr(tabre))
+            tf.write('_lexstateignore = %s\n' % repr(self.lexstateignore))
+
+            taberr = {}
+            for statename, ef in self.lexstateerrorf.items():
+                taberr[statename] = ef.__name__ if ef else None
+            tf.write('_lexstateerrorf = %s\n' % repr(taberr))
+
+            tabeof = {}
+            for statename, ef in self.lexstateeoff.items():
+                tabeof[statename] = ef.__name__ if ef else None
+            tf.write('_lexstateeoff = %s\n' % repr(tabeof))
+
+    # ------------------------------------------------------------
+    # readtab() - Read lexer information from a tab file
+    # ------------------------------------------------------------
+    def readtab(self, tabfile, fdict):
+        if isinstance(tabfile, types.ModuleType):
+            lextab = tabfile
+        else:
+            exec('import %s' % tabfile)
+            lextab = sys.modules[tabfile]
+
+        if getattr(lextab, '_tabversion', '0.0') != __tabversion__:
+            raise ImportError('Inconsistent PLY version')
+
+        self.lextokens      = lextab._lextokens
+        self.lexreflags     = lextab._lexreflags
+        self.lexliterals    = lextab._lexliterals
+        self.lextokens_all  = self.lextokens | set(self.lexliterals)
+        self.lexstateinfo   = lextab._lexstateinfo
+        self.lexstateignore = lextab._lexstateignore
+        self.lexstatere     = {}
+        self.lexstateretext = {}
+        for statename, lre in lextab._lexstatere.items():
+            titem = []
+            txtitem = []
+            for pat, func_name in lre:
+                titem.append((re.compile(pat, lextab._lexreflags), _names_to_funcs(func_name, fdict)))
+
+            self.lexstatere[statename] = titem
+            self.lexstateretext[statename] = txtitem
+
+        self.lexstateerrorf = {}
+        for statename, ef in lextab._lexstateerrorf.items():
+            self.lexstateerrorf[statename] = fdict[ef]
+
+        self.lexstateeoff = {}
+        for statename, ef in lextab._lexstateeoff.items():
+            self.lexstateeoff[statename] = fdict[ef]
+
+        self.begin('INITIAL')
+
+    # ------------------------------------------------------------
+    # input() - Push a new string into the lexer
+    # ------------------------------------------------------------
+    def input(self, s):
+        # Pull off the first character to see if s looks like a string
+        c = s[:1]
+        if not isinstance(c, StringTypes):
+            raise ValueError('Expected a string')
+        self.lexdata = s
+        self.lexpos = 0
+        self.lexlen = len(s)
+
+    # ------------------------------------------------------------
+    # begin() - Changes the lexing state
+    # ------------------------------------------------------------
+    def begin(self, state):
+        if state not in self.lexstatere:
+            raise ValueError('Undefined state')
+        self.lexre = self.lexstatere[state]
+        self.lexretext = self.lexstateretext[state]
+        self.lexignore = self.lexstateignore.get(state, '')
+        self.lexerrorf = self.lexstateerrorf.get(state, None)
+        self.lexeoff = self.lexstateeoff.get(state, None)
+        self.lexstate = state
+
+    # ------------------------------------------------------------
+    # push_state() - Changes the lexing state and saves old on stack
+    # ------------------------------------------------------------
+    def push_state(self, state):
+        self.lexstatestack.append(self.lexstate)
+        self.begin(state)
+
+    # ------------------------------------------------------------
+    # pop_state() - Restores the previous state
+    # ------------------------------------------------------------
+    def pop_state(self):
+        self.begin(self.lexstatestack.pop())
+
+    # ------------------------------------------------------------
+    # current_state() - Returns the current lexing state
+    # ------------------------------------------------------------
+    def current_state(self):
+        return self.lexstate
+
+    # ------------------------------------------------------------
+    # skip() - Skip ahead n characters
+    # ------------------------------------------------------------
+    def skip(self, n):
+        self.lexpos += n
+
+    # ------------------------------------------------------------
+    # opttoken() - Return the next token from the Lexer
+    #
+    # Note: This function has been carefully implemented to be as fast
+    # as possible.  Don't make changes unless you really know what
+    # you are doing
+    # ------------------------------------------------------------
+    def token(self):
+        # Make local copies of frequently referenced attributes
+        lexpos    = self.lexpos
+        lexlen    = self.lexlen
+        lexignore = self.lexignore
+        lexdata   = self.lexdata
+
+        while lexpos < lexlen:
+            # This code provides some short-circuit code for whitespace, tabs, and other ignored characters
+            if lexdata[lexpos] in lexignore:
+                lexpos += 1
+                continue
+
+            # Look for a regular expression match
+            for lexre, lexindexfunc in self.lexre:
+                m = lexre.match(lexdata, lexpos)
+                if not m:
+                    continue
+
+                # Create a token for return
+                tok = LexToken()
+                tok.value = m.group()
+                tok.lineno = self.lineno
+                tok.lexpos = lexpos
+
+                i = m.lastindex
+                func, tok.type = lexindexfunc[i]
+
+                if not func:
+                    # If no token type was set, it's an ignored token
+                    if tok.type:
+                        self.lexpos = m.end()
+                        return tok
+                    else:
+                        lexpos = m.end()
+                        break
+
+                lexpos = m.end()
+
+                # If token is processed by a function, call it
+
+                tok.lexer = self      # Set additional attributes useful in token rules
+                self.lexmatch = m
+                self.lexpos = lexpos
+
+                newtok = func(tok)
+
+                # Every function must return a token, if nothing, we just move to next token
+                if not newtok:
+                    lexpos    = self.lexpos         # This is here in case user has updated lexpos.
+                    lexignore = self.lexignore      # This is here in case there was a state change
+                    break
+
+                # Verify type of the token.  If not in the token map, raise an error
+                if not self.lexoptimize:
+                    if newtok.type not in self.lextokens_all:
+                        raise LexError("%s:%d: Rule '%s' returned an unknown token type '%s'" % (
+                            func.__code__.co_filename, func.__code__.co_firstlineno,
+                            func.__name__, newtok.type), lexdata[lexpos:])
+
+                return newtok
+            else:
+                # No match, see if in literals
+                if lexdata[lexpos] in self.lexliterals:
+                    tok = LexToken()
+                    tok.value = lexdata[lexpos]
+                    tok.lineno = self.lineno
+                    tok.type = tok.value
+                    tok.lexpos = lexpos
+                    self.lexpos = lexpos + 1
+                    return tok
+
+                # No match. Call t_error() if defined.
+                if self.lexerrorf:
+                    tok = LexToken()
+                    tok.value = self.lexdata[lexpos:]
+                    tok.lineno = self.lineno
+                    tok.type = 'error'
+                    tok.lexer = self
+                    tok.lexpos = lexpos
+                    self.lexpos = lexpos
+                    newtok = self.lexerrorf(tok)
+                    if lexpos == self.lexpos:
+                        # Error method didn't change text position at all. This is an error.
+                        raise LexError("Scanning error. Illegal character '%s'" % (lexdata[lexpos]), lexdata[lexpos:])
+                    lexpos = self.lexpos
+                    if not newtok:
+                        continue
+                    return newtok
+
+                self.lexpos = lexpos
+                raise LexError("Illegal character '%s' at index %d" % (lexdata[lexpos], lexpos), lexdata[lexpos:])
+
+        if self.lexeoff:
+            tok = LexToken()
+            tok.type = 'eof'
+            tok.value = ''
+            tok.lineno = self.lineno
+            tok.lexpos = lexpos
+            tok.lexer = self
+            self.lexpos = lexpos
+            newtok = self.lexeoff(tok)
+            return newtok
+
+        self.lexpos = lexpos + 1
+        if self.lexdata is None:
+            raise RuntimeError('No input string given with input()')
+        return None
+
+    # Iterator interface
+    def __iter__(self):
+        return self
+
+    def next(self):
+        t = self.token()
+        if t is None:
+            raise StopIteration
+        return t
+
+    __next__ = next
+
+# -----------------------------------------------------------------------------
+#                           ==== Lex Builder ===
+#
+# The functions and classes below are used to collect lexing information
+# and build a Lexer object from it.
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# _get_regex(func)
+#
+# Returns the regular expression assigned to a function either as a doc string
+# or as a .regex attribute attached by the @TOKEN decorator.
+# -----------------------------------------------------------------------------
+def _get_regex(func):
+    return getattr(func, 'regex', func.__doc__)
+
+# -----------------------------------------------------------------------------
+# get_caller_module_dict()
+#
+# This function returns a dictionary containing all of the symbols defined within
+# a caller further down the call stack.  This is used to get the environment
+# associated with the yacc() call if none was provided.
+# -----------------------------------------------------------------------------
+def get_caller_module_dict(levels):
+    f = sys._getframe(levels)
+    ldict = f.f_globals.copy()
+    if f.f_globals != f.f_locals:
+        ldict.update(f.f_locals)
+    return ldict
+
+# -----------------------------------------------------------------------------
+# _funcs_to_names()
+#
+# Given a list of regular expression functions, this converts it to a list
+# suitable for output to a table file
+# -----------------------------------------------------------------------------
+def _funcs_to_names(funclist, namelist):
+    result = []
+    for f, name in zip(funclist, namelist):
+        if f and f[0]:
+            result.append((name, f[1]))
+        else:
+            result.append(f)
+    return result
+
+# -----------------------------------------------------------------------------
+# _names_to_funcs()
+#
+# Given a list of regular expression function names, this converts it back to
+# functions.
+# -----------------------------------------------------------------------------
+def _names_to_funcs(namelist, fdict):
+    result = []
+    for n in namelist:
+        if n and n[0]:
+            result.append((fdict[n[0]], n[1]))
+        else:
+            result.append(n)
+    return result
+
+# -----------------------------------------------------------------------------
+# _form_master_re()
+#
+# This function takes a list of all of the regex components and attempts to
+# form the master regular expression.  Given limitations in the Python re
+# module, it may be necessary to break the master regex into separate expressions.
+# -----------------------------------------------------------------------------
+def _form_master_re(relist, reflags, ldict, toknames):
+    if not relist:
+        return []
+    regex = '|'.join(relist)
+    try:
+        lexre = re.compile(regex, reflags)
+
+        # Build the index to function map for the matching engine
+        lexindexfunc = [None] * (max(lexre.groupindex.values()) + 1)
+        lexindexnames = lexindexfunc[:]
+
+        for f, i in lexre.groupindex.items():
+            handle = ldict.get(f, None)
+            if type(handle) in (types.FunctionType, types.MethodType):
+                lexindexfunc[i] = (handle, toknames[f])
+                lexindexnames[i] = f
+            elif handle is not None:
+                lexindexnames[i] = f
+                if f.find('ignore_') > 0:
+                    lexindexfunc[i] = (None, None)
+                else:
+                    lexindexfunc[i] = (None, toknames[f])
+
+        return [(lexre, lexindexfunc)], [regex], [lexindexnames]
+    except Exception:
+        m = int(len(relist)/2)
+        if m == 0:
+            m = 1
+        llist, lre, lnames = _form_master_re(relist[:m], reflags, ldict, toknames)
+        rlist, rre, rnames = _form_master_re(relist[m:], reflags, ldict, toknames)
+        return (llist+rlist), (lre+rre), (lnames+rnames)
+
+# -----------------------------------------------------------------------------
+# def _statetoken(s,names)
+#
+# Given a declaration name s of the form "t_" and a dictionary whose keys are
+# state names, this function returns a tuple (states,tokenname) where states
+# is a tuple of state names and tokenname is the name of the token.  For example,
+# calling this with s = "t_foo_bar_SPAM" might return (('foo','bar'),'SPAM')
+# -----------------------------------------------------------------------------
+def _statetoken(s, names):
+    nonstate = 1
+    parts = s.split('_')
+    for i, part in enumerate(parts[1:], 1):
+        if part not in names and part != 'ANY':
+            break
+
+    if i > 1:
+        states = tuple(parts[1:i])
+    else:
+        states = ('INITIAL',)
+
+    if 'ANY' in states:
+        states = tuple(names)
+
+    tokenname = '_'.join(parts[i:])
+    return (states, tokenname)
+
+
+# -----------------------------------------------------------------------------
+# LexerReflect()
+#
+# This class represents information needed to build a lexer as extracted from a
+# user's input file.
+# -----------------------------------------------------------------------------
+class LexerReflect(object):
+    def __init__(self, ldict, log=None, reflags=0):
+        self.ldict      = ldict
+        self.error_func = None
+        self.tokens     = []
+        self.reflags    = reflags
+        self.stateinfo  = {'INITIAL': 'inclusive'}
+        self.modules    = set()
+        self.error      = False
+        self.log        = PlyLogger(sys.stderr) if log is None else log
+
+    # Get all of the basic information
+    def get_all(self):
+        self.get_tokens()
+        self.get_literals()
+        self.get_states()
+        self.get_rules()
+
+    # Validate all of the information
+    def validate_all(self):
+        self.validate_tokens()
+        self.validate_literals()
+        self.validate_rules()
+        return self.error
+
+    # Get the tokens map
+    def get_tokens(self):
+        tokens = self.ldict.get('tokens', None)
+        if not tokens:
+            self.log.error('No token list is defined')
+            self.error = True
+            return
+
+        if not isinstance(tokens, (list, tuple)):
+            self.log.error('tokens must be a list or tuple')
+            self.error = True
+            return
+
+        if not tokens:
+            self.log.error('tokens is empty')
+            self.error = True
+            return
+
+        self.tokens = tokens
+
+    # Validate the tokens
+    def validate_tokens(self):
+        terminals = {}
+        for n in self.tokens:
+            if not _is_identifier.match(n):
+                self.log.error("Bad token name '%s'", n)
+                self.error = True
+            if n in terminals:
+                self.log.warning("Token '%s' multiply defined", n)
+            terminals[n] = 1
+
+    # Get the literals specifier
+    def get_literals(self):
+        self.literals = self.ldict.get('literals', '')
+        if not self.literals:
+            self.literals = ''
+
+    # Validate literals
+    def validate_literals(self):
+        try:
+            for c in self.literals:
+                if not isinstance(c, StringTypes) or len(c) > 1:
+                    self.log.error('Invalid literal %s. Must be a single character', repr(c))
+                    self.error = True
+
+        except TypeError:
+            self.log.error('Invalid literals specification. literals must be a sequence of characters')
+            self.error = True
+
+    def get_states(self):
+        self.states = self.ldict.get('states', None)
+        # Build statemap
+        if self.states:
+            if not isinstance(self.states, (tuple, list)):
+                self.log.error('states must be defined as a tuple or list')
+                self.error = True
+            else:
+                for s in self.states:
+                    if not isinstance(s, tuple) or len(s) != 2:
+                        self.log.error("Invalid state specifier %s. Must be a tuple (statename,'exclusive|inclusive')", repr(s))
+                        self.error = True
+                        continue
+                    name, statetype = s
+                    if not isinstance(name, StringTypes):
+                        self.log.error('State name %s must be a string', repr(name))
+                        self.error = True
+                        continue
+                    if not (statetype == 'inclusive' or statetype == 'exclusive'):
+                        self.log.error("State type for state %s must be 'inclusive' or 'exclusive'", name)
+                        self.error = True
+                        continue
+                    if name in self.stateinfo:
+                        self.log.error("State '%s' already defined", name)
+                        self.error = True
+                        continue
+                    self.stateinfo[name] = statetype
+
+    # Get all of the symbols with a t_ prefix and sort them into various
+    # categories (functions, strings, error functions, and ignore characters)
+
+    def get_rules(self):
+        tsymbols = [f for f in self.ldict if f[:2] == 't_']
+
+        # Now build up a list of functions and a list of strings
+        self.toknames = {}        # Mapping of symbols to token names
+        self.funcsym  = {}        # Symbols defined as functions
+        self.strsym   = {}        # Symbols defined as strings
+        self.ignore   = {}        # Ignore strings by state
+        self.errorf   = {}        # Error functions by state
+        self.eoff     = {}        # EOF functions by state
+
+        for s in self.stateinfo:
+            self.funcsym[s] = []
+            self.strsym[s] = []
+
+        if len(tsymbols) == 0:
+            self.log.error('No rules of the form t_rulename are defined')
+            self.error = True
+            return
+
+        for f in tsymbols:
+            t = self.ldict[f]
+            states, tokname = _statetoken(f, self.stateinfo)
+            self.toknames[f] = tokname
+
+            if hasattr(t, '__call__'):
+                if tokname == 'error':
+                    for s in states:
+                        self.errorf[s] = t
+                elif tokname == 'eof':
+                    for s in states:
+                        self.eoff[s] = t
+                elif tokname == 'ignore':
+                    line = t.__code__.co_firstlineno
+                    file = t.__code__.co_filename
+                    self.log.error("%s:%d: Rule '%s' must be defined as a string", file, line, t.__name__)
+                    self.error = True
+                else:
+                    for s in states:
+                        self.funcsym[s].append((f, t))
+            elif isinstance(t, StringTypes):
+                if tokname == 'ignore':
+                    for s in states:
+                        self.ignore[s] = t
+                    if '\\' in t:
+                        self.log.warning("%s contains a literal backslash '\\'", f)
+
+                elif tokname == 'error':
+                    self.log.error("Rule '%s' must be defined as a function", f)
+                    self.error = True
+                else:
+                    for s in states:
+                        self.strsym[s].append((f, t))
+            else:
+                self.log.error('%s not defined as a function or string', f)
+                self.error = True
+
+        # Sort the functions by line number
+        for f in self.funcsym.values():
+            f.sort(key=lambda x: x[1].__code__.co_firstlineno)
+
+        # Sort the strings by regular expression length
+        for s in self.strsym.values():
+            s.sort(key=lambda x: len(x[1]), reverse=True)
+
+    # Validate all of the t_rules collected
+    def validate_rules(self):
+        for state in self.stateinfo:
+            # Validate all rules defined by functions
+
+            for fname, f in self.funcsym[state]:
+                line = f.__code__.co_firstlineno
+                file = f.__code__.co_filename
+                module = inspect.getmodule(f)
+                self.modules.add(module)
+
+                tokname = self.toknames[fname]
+                if isinstance(f, types.MethodType):
+                    reqargs = 2
+                else:
+                    reqargs = 1
+                nargs = f.__code__.co_argcount
+                if nargs > reqargs:
+                    self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__)
+                    self.error = True
+                    continue
+
+                if nargs < reqargs:
+                    self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__)
+                    self.error = True
+                    continue
+
+                if not _get_regex(f):
+                    self.log.error("%s:%d: No regular expression defined for rule '%s'", file, line, f.__name__)
+                    self.error = True
+                    continue
+
+                try:
+                    c = re.compile('(?P<%s>%s)' % (fname, _get_regex(f)), self.reflags)
+                    if c.match(''):
+                        self.log.error("%s:%d: Regular expression for rule '%s' matches empty string", file, line, f.__name__)
+                        self.error = True
+                except re.error as e:
+                    self.log.error("%s:%d: Invalid regular expression for rule '%s'. %s", file, line, f.__name__, e)
+                    if '#' in _get_regex(f):
+                        self.log.error("%s:%d. Make sure '#' in rule '%s' is escaped with '\\#'", file, line, f.__name__)
+                    self.error = True
+
+            # Validate all rules defined by strings
+            for name, r in self.strsym[state]:
+                tokname = self.toknames[name]
+                if tokname == 'error':
+                    self.log.error("Rule '%s' must be defined as a function", name)
+                    self.error = True
+                    continue
+
+                if tokname not in self.tokens and tokname.find('ignore_') < 0:
+                    self.log.error("Rule '%s' defined for an unspecified token %s", name, tokname)
+                    self.error = True
+                    continue
+
+                try:
+                    c = re.compile('(?P<%s>%s)' % (name, r), self.reflags)
+                    if (c.match('')):
+                        self.log.error("Regular expression for rule '%s' matches empty string", name)
+                        self.error = True
+                except re.error as e:
+                    self.log.error("Invalid regular expression for rule '%s'. %s", name, e)
+                    if '#' in r:
+                        self.log.error("Make sure '#' in rule '%s' is escaped with '\\#'", name)
+                    self.error = True
+
+            if not self.funcsym[state] and not self.strsym[state]:
+                self.log.error("No rules defined for state '%s'", state)
+                self.error = True
+
+            # Validate the error function
+            efunc = self.errorf.get(state, None)
+            if efunc:
+                f = efunc
+                line = f.__code__.co_firstlineno
+                file = f.__code__.co_filename
+                module = inspect.getmodule(f)
+                self.modules.add(module)
+
+                if isinstance(f, types.MethodType):
+                    reqargs = 2
+                else:
+                    reqargs = 1
+                nargs = f.__code__.co_argcount
+                if nargs > reqargs:
+                    self.log.error("%s:%d: Rule '%s' has too many arguments", file, line, f.__name__)
+                    self.error = True
+
+                if nargs < reqargs:
+                    self.log.error("%s:%d: Rule '%s' requires an argument", file, line, f.__name__)
+                    self.error = True
+
+        for module in self.modules:
+            self.validate_module(module)
+
+    # -----------------------------------------------------------------------------
+    # validate_module()
+    #
+    # This checks to see if there are duplicated t_rulename() functions or strings
+    # in the parser input file.  This is done using a simple regular expression
+    # match on each line in the source code of the given module.
+    # -----------------------------------------------------------------------------
+
+    def validate_module(self, module):
+        try:
+            lines, linen = inspect.getsourcelines(module)
+        except IOError:
+            return
+
+        fre = re.compile(r'\s*def\s+(t_[a-zA-Z_0-9]*)\(')
+        sre = re.compile(r'\s*(t_[a-zA-Z_0-9]*)\s*=')
+
+        counthash = {}
+        linen += 1
+        for line in lines:
+            m = fre.match(line)
+            if not m:
+                m = sre.match(line)
+            if m:
+                name = m.group(1)
+                prev = counthash.get(name)
+                if not prev:
+                    counthash[name] = linen
+                else:
+                    filename = inspect.getsourcefile(module)
+                    self.log.error('%s:%d: Rule %s redefined. Previously defined on line %d', filename, linen, name, prev)
+                    self.error = True
+            linen += 1
+
+# -----------------------------------------------------------------------------
+# lex(module)
+#
+# Build all of the regular expression rules from definitions in the supplied module
+# -----------------------------------------------------------------------------
+def lex(module=None, object=None, debug=False, optimize=False, lextab='lextab',
+        reflags=int(re.VERBOSE), nowarn=False, outputdir=None, debuglog=None, errorlog=None):
+
+    if lextab is None:
+        lextab = 'lextab'
+
+    global lexer
+
+    ldict = None
+    stateinfo  = {'INITIAL': 'inclusive'}
+    lexobj = Lexer()
+    lexobj.lexoptimize = optimize
+    global token, input
+
+    if errorlog is None:
+        errorlog = PlyLogger(sys.stderr)
+
+    if debug:
+        if debuglog is None:
+            debuglog = PlyLogger(sys.stderr)
+
+    # Get the module dictionary used for the lexer
+    if object:
+        module = object
+
+    # Get the module dictionary used for the parser
+    if module:
+        _items = [(k, getattr(module, k)) for k in dir(module)]
+        ldict = dict(_items)
+        # If no __file__ attribute is available, try to obtain it from the __module__ instead
+        if '__file__' not in ldict:
+            ldict['__file__'] = sys.modules[ldict['__module__']].__file__
+    else:
+        ldict = get_caller_module_dict(2)
+
+    # Determine if the module is package of a package or not.
+    # If so, fix the tabmodule setting so that tables load correctly
+    pkg = ldict.get('__package__')
+    if pkg and isinstance(lextab, str):
+        if '.' not in lextab:
+            lextab = pkg + '.' + lextab
+
+    # Collect parser information from the dictionary
+    linfo = LexerReflect(ldict, log=errorlog, reflags=reflags)
+    linfo.get_all()
+    if not optimize:
+        if linfo.validate_all():
+            raise SyntaxError("Can't build lexer")
+
+    if optimize and lextab:
+        try:
+            lexobj.readtab(lextab, ldict)
+            token = lexobj.token
+            input = lexobj.input
+            lexer = lexobj
+            return lexobj
+
+        except ImportError:
+            pass
+
+    # Dump some basic debugging information
+    if debug:
+        debuglog.info('lex: tokens   = %r', linfo.tokens)
+        debuglog.info('lex: literals = %r', linfo.literals)
+        debuglog.info('lex: states   = %r', linfo.stateinfo)
+
+    # Build a dictionary of valid token names
+    lexobj.lextokens = set()
+    for n in linfo.tokens:
+        lexobj.lextokens.add(n)
+
+    # Get literals specification
+    if isinstance(linfo.literals, (list, tuple)):
+        lexobj.lexliterals = type(linfo.literals[0])().join(linfo.literals)
+    else:
+        lexobj.lexliterals = linfo.literals
+
+    lexobj.lextokens_all = lexobj.lextokens | set(lexobj.lexliterals)
+
+    # Get the stateinfo dictionary
+    stateinfo = linfo.stateinfo
+
+    regexs = {}
+    # Build the master regular expressions
+    for state in stateinfo:
+        regex_list = []
+
+        # Add rules defined by functions first
+        for fname, f in linfo.funcsym[state]:
+            line = f.__code__.co_firstlineno
+            file = f.__code__.co_filename
+            regex_list.append('(?P<%s>%s)' % (fname, _get_regex(f)))
+            if debug:
+                debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", fname, _get_regex(f), state)
+
+        # Now add all of the simple rules
+        for name, r in linfo.strsym[state]:
+            regex_list.append('(?P<%s>%s)' % (name, r))
+            if debug:
+                debuglog.info("lex: Adding rule %s -> '%s' (state '%s')", name, r, state)
+
+        regexs[state] = regex_list
+
+    # Build the master regular expressions
+
+    if debug:
+        debuglog.info('lex: ==== MASTER REGEXS FOLLOW ====')
+
+    for state in regexs:
+        lexre, re_text, re_names = _form_master_re(regexs[state], reflags, ldict, linfo.toknames)
+        lexobj.lexstatere[state] = lexre
+        lexobj.lexstateretext[state] = re_text
+        lexobj.lexstaterenames[state] = re_names
+        if debug:
+            for i, text in enumerate(re_text):
+                debuglog.info("lex: state '%s' : regex[%d] = '%s'", state, i, text)
+
+    # For inclusive states, we need to add the regular expressions from the INITIAL state
+    for state, stype in stateinfo.items():
+        if state != 'INITIAL' and stype == 'inclusive':
+            lexobj.lexstatere[state].extend(lexobj.lexstatere['INITIAL'])
+            lexobj.lexstateretext[state].extend(lexobj.lexstateretext['INITIAL'])
+            lexobj.lexstaterenames[state].extend(lexobj.lexstaterenames['INITIAL'])
+
+    lexobj.lexstateinfo = stateinfo
+    lexobj.lexre = lexobj.lexstatere['INITIAL']
+    lexobj.lexretext = lexobj.lexstateretext['INITIAL']
+    lexobj.lexreflags = reflags
+
+    # Set up ignore variables
+    lexobj.lexstateignore = linfo.ignore
+    lexobj.lexignore = lexobj.lexstateignore.get('INITIAL', '')
+
+    # Set up error functions
+    lexobj.lexstateerrorf = linfo.errorf
+    lexobj.lexerrorf = linfo.errorf.get('INITIAL', None)
+    if not lexobj.lexerrorf:
+        errorlog.warning('No t_error rule is defined')
+
+    # Set up eof functions
+    lexobj.lexstateeoff = linfo.eoff
+    lexobj.lexeoff = linfo.eoff.get('INITIAL', None)
+
+    # Check state information for ignore and error rules
+    for s, stype in stateinfo.items():
+        if stype == 'exclusive':
+            if s not in linfo.errorf:
+                errorlog.warning("No error rule is defined for exclusive state '%s'", s)
+            if s not in linfo.ignore and lexobj.lexignore:
+                errorlog.warning("No ignore rule is defined for exclusive state '%s'", s)
+        elif stype == 'inclusive':
+            if s not in linfo.errorf:
+                linfo.errorf[s] = linfo.errorf.get('INITIAL', None)
+            if s not in linfo.ignore:
+                linfo.ignore[s] = linfo.ignore.get('INITIAL', '')
+
+    # Create global versions of the token() and input() functions
+    token = lexobj.token
+    input = lexobj.input
+    lexer = lexobj
+
+    # If in optimize mode, we write the lextab
+    if lextab and optimize:
+        if outputdir is None:
+            # If no output directory is set, the location of the output files
+            # is determined according to the following rules:
+            #     - If lextab specifies a package, files go into that package directory
+            #     - Otherwise, files go in the same directory as the specifying module
+            if isinstance(lextab, types.ModuleType):
+                srcfile = lextab.__file__
+            else:
+                if '.' not in lextab:
+                    srcfile = ldict['__file__']
+                else:
+                    parts = lextab.split('.')
+                    pkgname = '.'.join(parts[:-1])
+                    exec('import %s' % pkgname)
+                    srcfile = getattr(sys.modules[pkgname], '__file__', '')
+            outputdir = os.path.dirname(srcfile)
+        try:
+            lexobj.writetab(lextab, outputdir)
+        except IOError as e:
+            errorlog.warning("Couldn't write lextab module %r. %s" % (lextab, e))
+
+    return lexobj
+
+# -----------------------------------------------------------------------------
+# runmain()
+#
+# This runs the lexer as a main program
+# -----------------------------------------------------------------------------
+
+def runmain(lexer=None, data=None):
+    if not data:
+        try:
+            filename = sys.argv[1]
+            f = open(filename)
+            data = f.read()
+            f.close()
+        except IndexError:
+            sys.stdout.write('Reading from standard input (type EOF to end):\n')
+            data = sys.stdin.read()
+
+    if lexer:
+        _input = lexer.input
+    else:
+        _input = input
+    _input(data)
+    if lexer:
+        _token = lexer.token
+    else:
+        _token = token
+
+    while True:
+        tok = _token()
+        if not tok:
+            break
+        sys.stdout.write('(%s,%r,%d,%d)\n' % (tok.type, tok.value, tok.lineno, tok.lexpos))
+
+# -----------------------------------------------------------------------------
+# @TOKEN(regex)
+#
+# This decorator function can be used to set the regex expression on a function
+# when its docstring might need to be set in an alternative way
+# -----------------------------------------------------------------------------
+
+def TOKEN(r):
+    def set_regex(f):
+        if hasattr(r, '__call__'):
+            f.regex = _get_regex(r)
+        else:
+            f.regex = r
+        return f
+    return set_regex
+
+# Alternative spelling of the TOKEN decorator
+Token = TOKEN
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/yacc.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/yacc.py
new file mode 100644
index 0000000000000000000000000000000000000000..20b4f2863cc7193ad4b779a30375c865495fa50c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/yacc.py
@@ -0,0 +1,3494 @@
+# -----------------------------------------------------------------------------
+# ply: yacc.py
+#
+# Copyright (C) 2001-2017
+# David M. Beazley (Dabeaz LLC)
+# 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 David Beazley or Dabeaz LLC 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
+# OWNER 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.
+# -----------------------------------------------------------------------------
+#
+# This implements an LR parser that is constructed from grammar rules defined
+# as Python functions. The grammer is specified by supplying the BNF inside
+# Python documentation strings.  The inspiration for this technique was borrowed
+# from John Aycock's Spark parsing system.  PLY might be viewed as cross between
+# Spark and the GNU bison utility.
+#
+# The current implementation is only somewhat object-oriented. The
+# LR parser itself is defined in terms of an object (which allows multiple
+# parsers to co-exist).  However, most of the variables used during table
+# construction are defined in terms of global variables.  Users shouldn't
+# notice unless they are trying to define multiple parsers at the same
+# time using threads (in which case they should have their head examined).
+#
+# This implementation supports both SLR and LALR(1) parsing.  LALR(1)
+# support was originally implemented by Elias Ioup (ezioup@alumni.uchicago.edu),
+# using the algorithm found in Aho, Sethi, and Ullman "Compilers: Principles,
+# Techniques, and Tools" (The Dragon Book).  LALR(1) has since been replaced
+# by the more efficient DeRemer and Pennello algorithm.
+#
+# :::::::: WARNING :::::::
+#
+# Construction of LR parsing tables is fairly complicated and expensive.
+# To make this module run fast, a *LOT* of work has been put into
+# optimization---often at the expensive of readability and what might
+# consider to be good Python "coding style."   Modify the code at your
+# own risk!
+# ----------------------------------------------------------------------------
+
+import re
+import types
+import sys
+import os.path
+import inspect
+import base64
+import warnings
+
+__version__    = '3.10'
+__tabversion__ = '3.10'
+
+#-----------------------------------------------------------------------------
+#                     === User configurable parameters ===
+#
+# Change these to modify the default behavior of yacc (if you wish)
+#-----------------------------------------------------------------------------
+
+yaccdebug   = True             # Debugging mode.  If set, yacc generates a
+                               # a 'parser.out' file in the current directory
+
+debug_file  = 'parser.out'     # Default name of the debugging file
+tab_module  = 'parsetab'       # Default name of the table module
+default_lr  = 'LALR'           # Default LR table generation method
+
+error_count = 3                # Number of symbols that must be shifted to leave recovery mode
+
+yaccdevel   = False            # Set to True if developing yacc.  This turns off optimized
+                               # implementations of certain functions.
+
+resultlimit = 40               # Size limit of results when running in debug mode.
+
+pickle_protocol = 0            # Protocol to use when writing pickle files
+
+# String type-checking compatibility
+if sys.version_info[0] < 3:
+    string_types = basestring
+else:
+    string_types = str
+
+MAXINT = sys.maxsize
+
+# This object is a stand-in for a logging object created by the
+# logging module.   PLY will use this by default to create things
+# such as the parser.out file.  If a user wants more detailed
+# information, they can create their own logging object and pass
+# it into PLY.
+
+class PlyLogger(object):
+    def __init__(self, f):
+        self.f = f
+
+    def debug(self, msg, *args, **kwargs):
+        self.f.write((msg % args) + '\n')
+
+    info = debug
+
+    def warning(self, msg, *args, **kwargs):
+        self.f.write('WARNING: ' + (msg % args) + '\n')
+
+    def error(self, msg, *args, **kwargs):
+        self.f.write('ERROR: ' + (msg % args) + '\n')
+
+    critical = debug
+
+# Null logger is used when no output is generated. Does nothing.
+class NullLogger(object):
+    def __getattribute__(self, name):
+        return self
+
+    def __call__(self, *args, **kwargs):
+        return self
+
+# Exception raised for yacc-related errors
+class YaccError(Exception):
+    pass
+
+# Format the result message that the parser produces when running in debug mode.
+def format_result(r):
+    repr_str = repr(r)
+    if '\n' in repr_str:
+        repr_str = repr(repr_str)
+    if len(repr_str) > resultlimit:
+        repr_str = repr_str[:resultlimit] + ' ...'
+    result = '<%s @ 0x%x> (%s)' % (type(r).__name__, id(r), repr_str)
+    return result
+
+# Format stack entries when the parser is running in debug mode
+def format_stack_entry(r):
+    repr_str = repr(r)
+    if '\n' in repr_str:
+        repr_str = repr(repr_str)
+    if len(repr_str) < 16:
+        return repr_str
+    else:
+        return '<%s @ 0x%x>' % (type(r).__name__, id(r))
+
+# Panic mode error recovery support.   This feature is being reworked--much of the
+# code here is to offer a deprecation/backwards compatible transition
+
+_errok = None
+_token = None
+_restart = None
+_warnmsg = '''PLY: Don't use global functions errok(), token(), and restart() in p_error().
+Instead, invoke the methods on the associated parser instance:
+
+    def p_error(p):
+        ...
+        # Use parser.errok(), parser.token(), parser.restart()
+        ...
+
+    parser = yacc.yacc()
+'''
+
+def errok():
+    warnings.warn(_warnmsg)
+    return _errok()
+
+def restart():
+    warnings.warn(_warnmsg)
+    return _restart()
+
+def token():
+    warnings.warn(_warnmsg)
+    return _token()
+
+# Utility function to call the p_error() function with some deprecation hacks
+def call_errorfunc(errorfunc, token, parser):
+    global _errok, _token, _restart
+    _errok = parser.errok
+    _token = parser.token
+    _restart = parser.restart
+    r = errorfunc(token)
+    try:
+        del _errok, _token, _restart
+    except NameError:
+        pass
+    return r
+
+#-----------------------------------------------------------------------------
+#                        ===  LR Parsing Engine ===
+#
+# The following classes are used for the LR parser itself.  These are not
+# used during table construction and are independent of the actual LR
+# table generation algorithm
+#-----------------------------------------------------------------------------
+
+# This class is used to hold non-terminal grammar symbols during parsing.
+# It normally has the following attributes set:
+#        .type       = Grammar symbol type
+#        .value      = Symbol value
+#        .lineno     = Starting line number
+#        .endlineno  = Ending line number (optional, set automatically)
+#        .lexpos     = Starting lex position
+#        .endlexpos  = Ending lex position (optional, set automatically)
+
+class YaccSymbol:
+    def __str__(self):
+        return self.type
+
+    def __repr__(self):
+        return str(self)
+
+# This class is a wrapper around the objects actually passed to each
+# grammar rule.   Index lookup and assignment actually assign the
+# .value attribute of the underlying YaccSymbol object.
+# The lineno() method returns the line number of a given
+# item (or 0 if not defined).   The linespan() method returns
+# a tuple of (startline,endline) representing the range of lines
+# for a symbol.  The lexspan() method returns a tuple (lexpos,endlexpos)
+# representing the range of positional information for a symbol.
+
+class YaccProduction:
+    def __init__(self, s, stack=None):
+        self.slice = s
+        self.stack = stack
+        self.lexer = None
+        self.parser = None
+
+    def __getitem__(self, n):
+        if isinstance(n, slice):
+            return [s.value for s in self.slice[n]]
+        elif n >= 0:
+            return self.slice[n].value
+        else:
+            return self.stack[n].value
+
+    def __setitem__(self, n, v):
+        self.slice[n].value = v
+
+    def __getslice__(self, i, j):
+        return [s.value for s in self.slice[i:j]]
+
+    def __len__(self):
+        return len(self.slice)
+
+    def lineno(self, n):
+        return getattr(self.slice[n], 'lineno', 0)
+
+    def set_lineno(self, n, lineno):
+        self.slice[n].lineno = lineno
+
+    def linespan(self, n):
+        startline = getattr(self.slice[n], 'lineno', 0)
+        endline = getattr(self.slice[n], 'endlineno', startline)
+        return startline, endline
+
+    def lexpos(self, n):
+        return getattr(self.slice[n], 'lexpos', 0)
+
+    def lexspan(self, n):
+        startpos = getattr(self.slice[n], 'lexpos', 0)
+        endpos = getattr(self.slice[n], 'endlexpos', startpos)
+        return startpos, endpos
+
+    def error(self):
+        raise SyntaxError
+
+# -----------------------------------------------------------------------------
+#                               == LRParser ==
+#
+# The LR Parsing engine.
+# -----------------------------------------------------------------------------
+
+class LRParser:
+    def __init__(self, lrtab, errorf):
+        self.productions = lrtab.lr_productions
+        self.action = lrtab.lr_action
+        self.goto = lrtab.lr_goto
+        self.errorfunc = errorf
+        self.set_defaulted_states()
+        self.errorok = True
+
+    def errok(self):
+        self.errorok = True
+
+    def restart(self):
+        del self.statestack[:]
+        del self.symstack[:]
+        sym = YaccSymbol()
+        sym.type = '$end'
+        self.symstack.append(sym)
+        self.statestack.append(0)
+
+    # Defaulted state support.
+    # This method identifies parser states where there is only one possible reduction action.
+    # For such states, the parser can make a choose to make a rule reduction without consuming
+    # the next look-ahead token.  This delayed invocation of the tokenizer can be useful in
+    # certain kinds of advanced parsing situations where the lexer and parser interact with
+    # each other or change states (i.e., manipulation of scope, lexer states, etc.).
+    #
+    # See:  https://www.gnu.org/software/bison/manual/html_node/Default-Reductions.html#Default-Reductions
+    def set_defaulted_states(self):
+        self.defaulted_states = {}
+        for state, actions in self.action.items():
+            rules = list(actions.values())
+            if len(rules) == 1 and rules[0] < 0:
+                self.defaulted_states[state] = rules[0]
+
+    def disable_defaulted_states(self):
+        self.defaulted_states = {}
+
+    def parse(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):
+        if debug or yaccdevel:
+            if isinstance(debug, int):
+                debug = PlyLogger(sys.stderr)
+            return self.parsedebug(input, lexer, debug, tracking, tokenfunc)
+        elif tracking:
+            return self.parseopt(input, lexer, debug, tracking, tokenfunc)
+        else:
+            return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
+
+
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    # parsedebug().
+    #
+    # This is the debugging enabled version of parse().  All changes made to the
+    # parsing engine should be made here.   Optimized versions of this function
+    # are automatically created by the ply/ygen.py script.  This script cuts out
+    # sections enclosed in markers such as this:
+    #
+    #      #--! DEBUG
+    #      statements
+    #      #--! DEBUG
+    #
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    def parsedebug(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):
+        #--! parsedebug-start
+        lookahead = None                         # Current lookahead symbol
+        lookaheadstack = []                      # Stack of lookahead symbols
+        actions = self.action                    # Local reference to action table (to avoid lookup on self.)
+        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)
+        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)
+        defaulted_states = self.defaulted_states # Local reference to defaulted states
+        pslice  = YaccProduction(None)           # Production object passed to grammar rules
+        errorcount = 0                           # Used during error recovery
+
+        #--! DEBUG
+        debug.info('PLY: PARSE DEBUG START')
+        #--! DEBUG
+
+        # If no lexer was given, we will try to use the lex module
+        if not lexer:
+            from . import lex
+            lexer = lex.lexer
+
+        # Set up the lexer and parser objects on pslice
+        pslice.lexer = lexer
+        pslice.parser = self
+
+        # If input was supplied, pass to lexer
+        if input is not None:
+            lexer.input(input)
+
+        if tokenfunc is None:
+            # Tokenize function
+            get_token = lexer.token
+        else:
+            get_token = tokenfunc
+
+        # Set the parser() token method (sometimes used in error recovery)
+        self.token = get_token
+
+        # Set up the state and symbol stacks
+
+        statestack = []                # Stack of parsing states
+        self.statestack = statestack
+        symstack   = []                # Stack of grammar symbols
+        self.symstack = symstack
+
+        pslice.stack = symstack         # Put in the production
+        errtoken   = None               # Err token
+
+        # The start state is assumed to be (0,$end)
+
+        statestack.append(0)
+        sym = YaccSymbol()
+        sym.type = '$end'
+        symstack.append(sym)
+        state = 0
+        while True:
+            # Get the next symbol on the input.  If a lookahead symbol
+            # is already set, we just use that. Otherwise, we'll pull
+            # the next token off of the lookaheadstack or from the lexer
+
+            #--! DEBUG
+            debug.debug('')
+            debug.debug('State  : %s', state)
+            #--! DEBUG
+
+            if state not in defaulted_states:
+                if not lookahead:
+                    if not lookaheadstack:
+                        lookahead = get_token()     # Get the next token
+                    else:
+                        lookahead = lookaheadstack.pop()
+                    if not lookahead:
+                        lookahead = YaccSymbol()
+                        lookahead.type = '$end'
+
+                # Check the action table
+                ltype = lookahead.type
+                t = actions[state].get(ltype)
+            else:
+                t = defaulted_states[state]
+                #--! DEBUG
+                debug.debug('Defaulted state %s: Reduce using %d', state, -t)
+                #--! DEBUG
+
+            #--! DEBUG
+            debug.debug('Stack  : %s',
+                        ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())
+            #--! DEBUG
+
+            if t is not None:
+                if t > 0:
+                    # shift a symbol on the stack
+                    statestack.append(t)
+                    state = t
+
+                    #--! DEBUG
+                    debug.debug('Action : Shift and goto state %s', t)
+                    #--! DEBUG
+
+                    symstack.append(lookahead)
+                    lookahead = None
+
+                    # Decrease error count on successful shift
+                    if errorcount:
+                        errorcount -= 1
+                    continue
+
+                if t < 0:
+                    # reduce a symbol on the stack, emit a production
+                    p = prod[-t]
+                    pname = p.name
+                    plen  = p.len
+
+                    # Get production function
+                    sym = YaccSymbol()
+                    sym.type = pname       # Production name
+                    sym.value = None
+
+                    #--! DEBUG
+                    if plen:
+                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str,
+                                   '['+','.join([format_stack_entry(_v.value) for _v in symstack[-plen:]])+']',
+                                   goto[statestack[-1-plen]][pname])
+                    else:
+                        debug.info('Action : Reduce rule [%s] with %s and goto state %d', p.str, [],
+                                   goto[statestack[-1]][pname])
+
+                    #--! DEBUG
+
+                    if plen:
+                        targ = symstack[-plen-1:]
+                        targ[0] = sym
+
+                        #--! TRACKING
+                        if tracking:
+                            t1 = targ[1]
+                            sym.lineno = t1.lineno
+                            sym.lexpos = t1.lexpos
+                            t1 = targ[-1]
+                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)
+                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)
+                        #--! TRACKING
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # below as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            del symstack[-plen:]
+                            self.state = state
+                            p.callable(pslice)
+                            del statestack[-plen:]
+                            #--! DEBUG
+                            debug.info('Result : %s', format_result(pslice[0]))
+                            #--! DEBUG
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                    else:
+
+                        #--! TRACKING
+                        if tracking:
+                            sym.lineno = lexer.lineno
+                            sym.lexpos = lexer.lexpos
+                        #--! TRACKING
+
+                        targ = [sym]
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # above as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            self.state = state
+                            p.callable(pslice)
+                            #--! DEBUG
+                            debug.info('Result : %s', format_result(pslice[0]))
+                            #--! DEBUG
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                if t == 0:
+                    n = symstack[-1]
+                    result = getattr(n, 'value', None)
+                    #--! DEBUG
+                    debug.info('Done   : Returning %s', format_result(result))
+                    debug.info('PLY: PARSE DEBUG END')
+                    #--! DEBUG
+                    return result
+
+            if t is None:
+
+                #--! DEBUG
+                debug.error('Error  : %s',
+                            ('%s . %s' % (' '.join([xx.type for xx in symstack][1:]), str(lookahead))).lstrip())
+                #--! DEBUG
+
+                # We have some kind of parsing error here.  To handle
+                # this, we are going to push the current token onto
+                # the tokenstack and replace it with an 'error' token.
+                # If there are any synchronization rules, they may
+                # catch it.
+                #
+                # In addition to pushing the error token, we call call
+                # the user defined p_error() function if this is the
+                # first syntax error.  This function is only called if
+                # errorcount == 0.
+                if errorcount == 0 or self.errorok:
+                    errorcount = error_count
+                    self.errorok = False
+                    errtoken = lookahead
+                    if errtoken.type == '$end':
+                        errtoken = None               # End of file!
+                    if self.errorfunc:
+                        if errtoken and not hasattr(errtoken, 'lexer'):
+                            errtoken.lexer = lexer
+                        self.state = state
+                        tok = call_errorfunc(self.errorfunc, errtoken, self)
+                        if self.errorok:
+                            # User must have done some kind of panic
+                            # mode recovery on their own.  The
+                            # returned token is the next lookahead
+                            lookahead = tok
+                            errtoken = None
+                            continue
+                    else:
+                        if errtoken:
+                            if hasattr(errtoken, 'lineno'):
+                                lineno = lookahead.lineno
+                            else:
+                                lineno = 0
+                            if lineno:
+                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type))
+                            else:
+                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)
+                        else:
+                            sys.stderr.write('yacc: Parse error in input. EOF\n')
+                            return
+
+                else:
+                    errorcount = error_count
+
+                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the
+                # entire parse has been rolled back and we're completely hosed.   The token is
+                # discarded and we just keep going.
+
+                if len(statestack) <= 1 and lookahead.type != '$end':
+                    lookahead = None
+                    errtoken = None
+                    state = 0
+                    # Nuke the pushback stack
+                    del lookaheadstack[:]
+                    continue
+
+                # case 2: the statestack has a couple of entries on it, but we're
+                # at the end of the file. nuke the top entry and generate an error token
+
+                # Start nuking entries on the stack
+                if lookahead.type == '$end':
+                    # Whoa. We're really hosed here. Bail out
+                    return
+
+                if lookahead.type != 'error':
+                    sym = symstack[-1]
+                    if sym.type == 'error':
+                        # Hmmm. Error is on top of stack, we'll just nuke input
+                        # symbol and continue
+                        #--! TRACKING
+                        if tracking:
+                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)
+                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)
+                        #--! TRACKING
+                        lookahead = None
+                        continue
+
+                    # Create the error symbol for the first time and make it the new lookahead symbol
+                    t = YaccSymbol()
+                    t.type = 'error'
+
+                    if hasattr(lookahead, 'lineno'):
+                        t.lineno = t.endlineno = lookahead.lineno
+                    if hasattr(lookahead, 'lexpos'):
+                        t.lexpos = t.endlexpos = lookahead.lexpos
+                    t.value = lookahead
+                    lookaheadstack.append(lookahead)
+                    lookahead = t
+                else:
+                    sym = symstack.pop()
+                    #--! TRACKING
+                    if tracking:
+                        lookahead.lineno = sym.lineno
+                        lookahead.lexpos = sym.lexpos
+                    #--! TRACKING
+                    statestack.pop()
+                    state = statestack[-1]
+
+                continue
+
+            # Call an error function here
+            raise RuntimeError('yacc: internal parser error!!!\n')
+
+        #--! parsedebug-end
+
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    # parseopt().
+    #
+    # Optimized version of parse() method.  DO NOT EDIT THIS CODE DIRECTLY!
+    # This code is automatically generated by the ply/ygen.py script. Make
+    # changes to the parsedebug() method instead.
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    def parseopt(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):
+        #--! parseopt-start
+        lookahead = None                         # Current lookahead symbol
+        lookaheadstack = []                      # Stack of lookahead symbols
+        actions = self.action                    # Local reference to action table (to avoid lookup on self.)
+        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)
+        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)
+        defaulted_states = self.defaulted_states # Local reference to defaulted states
+        pslice  = YaccProduction(None)           # Production object passed to grammar rules
+        errorcount = 0                           # Used during error recovery
+
+
+        # If no lexer was given, we will try to use the lex module
+        if not lexer:
+            from . import lex
+            lexer = lex.lexer
+
+        # Set up the lexer and parser objects on pslice
+        pslice.lexer = lexer
+        pslice.parser = self
+
+        # If input was supplied, pass to lexer
+        if input is not None:
+            lexer.input(input)
+
+        if tokenfunc is None:
+            # Tokenize function
+            get_token = lexer.token
+        else:
+            get_token = tokenfunc
+
+        # Set the parser() token method (sometimes used in error recovery)
+        self.token = get_token
+
+        # Set up the state and symbol stacks
+
+        statestack = []                # Stack of parsing states
+        self.statestack = statestack
+        symstack   = []                # Stack of grammar symbols
+        self.symstack = symstack
+
+        pslice.stack = symstack         # Put in the production
+        errtoken   = None               # Err token
+
+        # The start state is assumed to be (0,$end)
+
+        statestack.append(0)
+        sym = YaccSymbol()
+        sym.type = '$end'
+        symstack.append(sym)
+        state = 0
+        while True:
+            # Get the next symbol on the input.  If a lookahead symbol
+            # is already set, we just use that. Otherwise, we'll pull
+            # the next token off of the lookaheadstack or from the lexer
+
+
+            if state not in defaulted_states:
+                if not lookahead:
+                    if not lookaheadstack:
+                        lookahead = get_token()     # Get the next token
+                    else:
+                        lookahead = lookaheadstack.pop()
+                    if not lookahead:
+                        lookahead = YaccSymbol()
+                        lookahead.type = '$end'
+
+                # Check the action table
+                ltype = lookahead.type
+                t = actions[state].get(ltype)
+            else:
+                t = defaulted_states[state]
+
+
+            if t is not None:
+                if t > 0:
+                    # shift a symbol on the stack
+                    statestack.append(t)
+                    state = t
+
+
+                    symstack.append(lookahead)
+                    lookahead = None
+
+                    # Decrease error count on successful shift
+                    if errorcount:
+                        errorcount -= 1
+                    continue
+
+                if t < 0:
+                    # reduce a symbol on the stack, emit a production
+                    p = prod[-t]
+                    pname = p.name
+                    plen  = p.len
+
+                    # Get production function
+                    sym = YaccSymbol()
+                    sym.type = pname       # Production name
+                    sym.value = None
+
+
+                    if plen:
+                        targ = symstack[-plen-1:]
+                        targ[0] = sym
+
+                        #--! TRACKING
+                        if tracking:
+                            t1 = targ[1]
+                            sym.lineno = t1.lineno
+                            sym.lexpos = t1.lexpos
+                            t1 = targ[-1]
+                            sym.endlineno = getattr(t1, 'endlineno', t1.lineno)
+                            sym.endlexpos = getattr(t1, 'endlexpos', t1.lexpos)
+                        #--! TRACKING
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # below as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            del symstack[-plen:]
+                            self.state = state
+                            p.callable(pslice)
+                            del statestack[-plen:]
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                    else:
+
+                        #--! TRACKING
+                        if tracking:
+                            sym.lineno = lexer.lineno
+                            sym.lexpos = lexer.lexpos
+                        #--! TRACKING
+
+                        targ = [sym]
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # above as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            self.state = state
+                            p.callable(pslice)
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                if t == 0:
+                    n = symstack[-1]
+                    result = getattr(n, 'value', None)
+                    return result
+
+            if t is None:
+
+
+                # We have some kind of parsing error here.  To handle
+                # this, we are going to push the current token onto
+                # the tokenstack and replace it with an 'error' token.
+                # If there are any synchronization rules, they may
+                # catch it.
+                #
+                # In addition to pushing the error token, we call call
+                # the user defined p_error() function if this is the
+                # first syntax error.  This function is only called if
+                # errorcount == 0.
+                if errorcount == 0 or self.errorok:
+                    errorcount = error_count
+                    self.errorok = False
+                    errtoken = lookahead
+                    if errtoken.type == '$end':
+                        errtoken = None               # End of file!
+                    if self.errorfunc:
+                        if errtoken and not hasattr(errtoken, 'lexer'):
+                            errtoken.lexer = lexer
+                        self.state = state
+                        tok = call_errorfunc(self.errorfunc, errtoken, self)
+                        if self.errorok:
+                            # User must have done some kind of panic
+                            # mode recovery on their own.  The
+                            # returned token is the next lookahead
+                            lookahead = tok
+                            errtoken = None
+                            continue
+                    else:
+                        if errtoken:
+                            if hasattr(errtoken, 'lineno'):
+                                lineno = lookahead.lineno
+                            else:
+                                lineno = 0
+                            if lineno:
+                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type))
+                            else:
+                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)
+                        else:
+                            sys.stderr.write('yacc: Parse error in input. EOF\n')
+                            return
+
+                else:
+                    errorcount = error_count
+
+                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the
+                # entire parse has been rolled back and we're completely hosed.   The token is
+                # discarded and we just keep going.
+
+                if len(statestack) <= 1 and lookahead.type != '$end':
+                    lookahead = None
+                    errtoken = None
+                    state = 0
+                    # Nuke the pushback stack
+                    del lookaheadstack[:]
+                    continue
+
+                # case 2: the statestack has a couple of entries on it, but we're
+                # at the end of the file. nuke the top entry and generate an error token
+
+                # Start nuking entries on the stack
+                if lookahead.type == '$end':
+                    # Whoa. We're really hosed here. Bail out
+                    return
+
+                if lookahead.type != 'error':
+                    sym = symstack[-1]
+                    if sym.type == 'error':
+                        # Hmmm. Error is on top of stack, we'll just nuke input
+                        # symbol and continue
+                        #--! TRACKING
+                        if tracking:
+                            sym.endlineno = getattr(lookahead, 'lineno', sym.lineno)
+                            sym.endlexpos = getattr(lookahead, 'lexpos', sym.lexpos)
+                        #--! TRACKING
+                        lookahead = None
+                        continue
+
+                    # Create the error symbol for the first time and make it the new lookahead symbol
+                    t = YaccSymbol()
+                    t.type = 'error'
+
+                    if hasattr(lookahead, 'lineno'):
+                        t.lineno = t.endlineno = lookahead.lineno
+                    if hasattr(lookahead, 'lexpos'):
+                        t.lexpos = t.endlexpos = lookahead.lexpos
+                    t.value = lookahead
+                    lookaheadstack.append(lookahead)
+                    lookahead = t
+                else:
+                    sym = symstack.pop()
+                    #--! TRACKING
+                    if tracking:
+                        lookahead.lineno = sym.lineno
+                        lookahead.lexpos = sym.lexpos
+                    #--! TRACKING
+                    statestack.pop()
+                    state = statestack[-1]
+
+                continue
+
+            # Call an error function here
+            raise RuntimeError('yacc: internal parser error!!!\n')
+
+        #--! parseopt-end
+
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+    # parseopt_notrack().
+    #
+    # Optimized version of parseopt() with line number tracking removed.
+    # DO NOT EDIT THIS CODE DIRECTLY. This code is automatically generated
+    # by the ply/ygen.py script. Make changes to the parsedebug() method instead.
+    # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+    def parseopt_notrack(self, input=None, lexer=None, debug=False, tracking=False, tokenfunc=None):
+        #--! parseopt-notrack-start
+        lookahead = None                         # Current lookahead symbol
+        lookaheadstack = []                      # Stack of lookahead symbols
+        actions = self.action                    # Local reference to action table (to avoid lookup on self.)
+        goto    = self.goto                      # Local reference to goto table (to avoid lookup on self.)
+        prod    = self.productions               # Local reference to production list (to avoid lookup on self.)
+        defaulted_states = self.defaulted_states # Local reference to defaulted states
+        pslice  = YaccProduction(None)           # Production object passed to grammar rules
+        errorcount = 0                           # Used during error recovery
+
+
+        # If no lexer was given, we will try to use the lex module
+        if not lexer:
+            from . import lex
+            lexer = lex.lexer
+
+        # Set up the lexer and parser objects on pslice
+        pslice.lexer = lexer
+        pslice.parser = self
+
+        # If input was supplied, pass to lexer
+        if input is not None:
+            lexer.input(input)
+
+        if tokenfunc is None:
+            # Tokenize function
+            get_token = lexer.token
+        else:
+            get_token = tokenfunc
+
+        # Set the parser() token method (sometimes used in error recovery)
+        self.token = get_token
+
+        # Set up the state and symbol stacks
+
+        statestack = []                # Stack of parsing states
+        self.statestack = statestack
+        symstack   = []                # Stack of grammar symbols
+        self.symstack = symstack
+
+        pslice.stack = symstack         # Put in the production
+        errtoken   = None               # Err token
+
+        # The start state is assumed to be (0,$end)
+
+        statestack.append(0)
+        sym = YaccSymbol()
+        sym.type = '$end'
+        symstack.append(sym)
+        state = 0
+        while True:
+            # Get the next symbol on the input.  If a lookahead symbol
+            # is already set, we just use that. Otherwise, we'll pull
+            # the next token off of the lookaheadstack or from the lexer
+
+
+            if state not in defaulted_states:
+                if not lookahead:
+                    if not lookaheadstack:
+                        lookahead = get_token()     # Get the next token
+                    else:
+                        lookahead = lookaheadstack.pop()
+                    if not lookahead:
+                        lookahead = YaccSymbol()
+                        lookahead.type = '$end'
+
+                # Check the action table
+                ltype = lookahead.type
+                t = actions[state].get(ltype)
+            else:
+                t = defaulted_states[state]
+
+
+            if t is not None:
+                if t > 0:
+                    # shift a symbol on the stack
+                    statestack.append(t)
+                    state = t
+
+
+                    symstack.append(lookahead)
+                    lookahead = None
+
+                    # Decrease error count on successful shift
+                    if errorcount:
+                        errorcount -= 1
+                    continue
+
+                if t < 0:
+                    # reduce a symbol on the stack, emit a production
+                    p = prod[-t]
+                    pname = p.name
+                    plen  = p.len
+
+                    # Get production function
+                    sym = YaccSymbol()
+                    sym.type = pname       # Production name
+                    sym.value = None
+
+
+                    if plen:
+                        targ = symstack[-plen-1:]
+                        targ[0] = sym
+
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # below as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            del symstack[-plen:]
+                            self.state = state
+                            p.callable(pslice)
+                            del statestack[-plen:]
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            symstack.extend(targ[1:-1])         # Put the production slice back on the stack
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                    else:
+
+
+                        targ = [sym]
+
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+                        # The code enclosed in this section is duplicated
+                        # above as a performance optimization.  Make sure
+                        # changes get made in both locations.
+
+                        pslice.slice = targ
+
+                        try:
+                            # Call the grammar rule with our special slice object
+                            self.state = state
+                            p.callable(pslice)
+                            symstack.append(sym)
+                            state = goto[statestack[-1]][pname]
+                            statestack.append(state)
+                        except SyntaxError:
+                            # If an error was set. Enter error recovery state
+                            lookaheadstack.append(lookahead)    # Save the current lookahead token
+                            statestack.pop()                    # Pop back one state (before the reduce)
+                            state = statestack[-1]
+                            sym.type = 'error'
+                            sym.value = 'error'
+                            lookahead = sym
+                            errorcount = error_count
+                            self.errorok = False
+
+                        continue
+                        # !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+                if t == 0:
+                    n = symstack[-1]
+                    result = getattr(n, 'value', None)
+                    return result
+
+            if t is None:
+
+
+                # We have some kind of parsing error here.  To handle
+                # this, we are going to push the current token onto
+                # the tokenstack and replace it with an 'error' token.
+                # If there are any synchronization rules, they may
+                # catch it.
+                #
+                # In addition to pushing the error token, we call call
+                # the user defined p_error() function if this is the
+                # first syntax error.  This function is only called if
+                # errorcount == 0.
+                if errorcount == 0 or self.errorok:
+                    errorcount = error_count
+                    self.errorok = False
+                    errtoken = lookahead
+                    if errtoken.type == '$end':
+                        errtoken = None               # End of file!
+                    if self.errorfunc:
+                        if errtoken and not hasattr(errtoken, 'lexer'):
+                            errtoken.lexer = lexer
+                        self.state = state
+                        tok = call_errorfunc(self.errorfunc, errtoken, self)
+                        if self.errorok:
+                            # User must have done some kind of panic
+                            # mode recovery on their own.  The
+                            # returned token is the next lookahead
+                            lookahead = tok
+                            errtoken = None
+                            continue
+                    else:
+                        if errtoken:
+                            if hasattr(errtoken, 'lineno'):
+                                lineno = lookahead.lineno
+                            else:
+                                lineno = 0
+                            if lineno:
+                                sys.stderr.write('yacc: Syntax error at line %d, token=%s\n' % (lineno, errtoken.type))
+                            else:
+                                sys.stderr.write('yacc: Syntax error, token=%s' % errtoken.type)
+                        else:
+                            sys.stderr.write('yacc: Parse error in input. EOF\n')
+                            return
+
+                else:
+                    errorcount = error_count
+
+                # case 1:  the statestack only has 1 entry on it.  If we're in this state, the
+                # entire parse has been rolled back and we're completely hosed.   The token is
+                # discarded and we just keep going.
+
+                if len(statestack) <= 1 and lookahead.type != '$end':
+                    lookahead = None
+                    errtoken = None
+                    state = 0
+                    # Nuke the pushback stack
+                    del lookaheadstack[:]
+                    continue
+
+                # case 2: the statestack has a couple of entries on it, but we're
+                # at the end of the file. nuke the top entry and generate an error token
+
+                # Start nuking entries on the stack
+                if lookahead.type == '$end':
+                    # Whoa. We're really hosed here. Bail out
+                    return
+
+                if lookahead.type != 'error':
+                    sym = symstack[-1]
+                    if sym.type == 'error':
+                        # Hmmm. Error is on top of stack, we'll just nuke input
+                        # symbol and continue
+                        lookahead = None
+                        continue
+
+                    # Create the error symbol for the first time and make it the new lookahead symbol
+                    t = YaccSymbol()
+                    t.type = 'error'
+
+                    if hasattr(lookahead, 'lineno'):
+                        t.lineno = t.endlineno = lookahead.lineno
+                    if hasattr(lookahead, 'lexpos'):
+                        t.lexpos = t.endlexpos = lookahead.lexpos
+                    t.value = lookahead
+                    lookaheadstack.append(lookahead)
+                    lookahead = t
+                else:
+                    sym = symstack.pop()
+                    statestack.pop()
+                    state = statestack[-1]
+
+                continue
+
+            # Call an error function here
+            raise RuntimeError('yacc: internal parser error!!!\n')
+
+        #--! parseopt-notrack-end
+
+# -----------------------------------------------------------------------------
+#                          === Grammar Representation ===
+#
+# The following functions, classes, and variables are used to represent and
+# manipulate the rules that make up a grammar.
+# -----------------------------------------------------------------------------
+
+# regex matching identifiers
+_is_identifier = re.compile(r'^[a-zA-Z0-9_-]+$')
+
+# -----------------------------------------------------------------------------
+# class Production:
+#
+# This class stores the raw information about a single production or grammar rule.
+# A grammar rule refers to a specification such as this:
+#
+#       expr : expr PLUS term
+#
+# Here are the basic attributes defined on all productions
+#
+#       name     - Name of the production.  For example 'expr'
+#       prod     - A list of symbols on the right side ['expr','PLUS','term']
+#       prec     - Production precedence level
+#       number   - Production number.
+#       func     - Function that executes on reduce
+#       file     - File where production function is defined
+#       lineno   - Line number where production function is defined
+#
+# The following attributes are defined or optional.
+#
+#       len       - Length of the production (number of symbols on right hand side)
+#       usyms     - Set of unique symbols found in the production
+# -----------------------------------------------------------------------------
+
+class Production(object):
+    reduced = 0
+    def __init__(self, number, name, prod, precedence=('right', 0), func=None, file='', line=0):
+        self.name     = name
+        self.prod     = tuple(prod)
+        self.number   = number
+        self.func     = func
+        self.callable = None
+        self.file     = file
+        self.line     = line
+        self.prec     = precedence
+
+        # Internal settings used during table construction
+
+        self.len  = len(self.prod)   # Length of the production
+
+        # Create a list of unique production symbols used in the production
+        self.usyms = []
+        for s in self.prod:
+            if s not in self.usyms:
+                self.usyms.append(s)
+
+        # List of all LR items for the production
+        self.lr_items = []
+        self.lr_next = None
+
+        # Create a string representation
+        if self.prod:
+            self.str = '%s -> %s' % (self.name, ' '.join(self.prod))
+        else:
+            self.str = '%s -> <empty>' % self.name
+
+    def __str__(self):
+        return self.str
+
+    def __repr__(self):
+        return 'Production(' + str(self) + ')'
+
+    def __len__(self):
+        return len(self.prod)
+
+    def __nonzero__(self):
+        return 1
+
+    def __getitem__(self, index):
+        return self.prod[index]
+
+    # Return the nth lr_item from the production (or None if at the end)
+    def lr_item(self, n):
+        if n > len(self.prod):
+            return None
+        p = LRItem(self, n)
+        # Precompute the list of productions immediately following.
+        try:
+            p.lr_after = Prodnames[p.prod[n+1]]
+        except (IndexError, KeyError):
+            p.lr_after = []
+        try:
+            p.lr_before = p.prod[n-1]
+        except IndexError:
+            p.lr_before = None
+        return p
+
+    # Bind the production function name to a callable
+    def bind(self, pdict):
+        if self.func:
+            self.callable = pdict[self.func]
+
+# This class serves as a minimal standin for Production objects when
+# reading table data from files.   It only contains information
+# actually used by the LR parsing engine, plus some additional
+# debugging information.
+class MiniProduction(object):
+    def __init__(self, str, name, len, func, file, line):
+        self.name     = name
+        self.len      = len
+        self.func     = func
+        self.callable = None
+        self.file     = file
+        self.line     = line
+        self.str      = str
+
+    def __str__(self):
+        return self.str
+
+    def __repr__(self):
+        return 'MiniProduction(%s)' % self.str
+
+    # Bind the production function name to a callable
+    def bind(self, pdict):
+        if self.func:
+            self.callable = pdict[self.func]
+
+
+# -----------------------------------------------------------------------------
+# class LRItem
+#
+# This class represents a specific stage of parsing a production rule.  For
+# example:
+#
+#       expr : expr . PLUS term
+#
+# In the above, the "." represents the current location of the parse.  Here
+# basic attributes:
+#
+#       name       - Name of the production.  For example 'expr'
+#       prod       - A list of symbols on the right side ['expr','.', 'PLUS','term']
+#       number     - Production number.
+#
+#       lr_next      Next LR item. Example, if we are ' expr -> expr . PLUS term'
+#                    then lr_next refers to 'expr -> expr PLUS . term'
+#       lr_index   - LR item index (location of the ".") in the prod list.
+#       lookaheads - LALR lookahead symbols for this item
+#       len        - Length of the production (number of symbols on right hand side)
+#       lr_after    - List of all productions that immediately follow
+#       lr_before   - Grammar symbol immediately before
+# -----------------------------------------------------------------------------
+
+class LRItem(object):
+    def __init__(self, p, n):
+        self.name       = p.name
+        self.prod       = list(p.prod)
+        self.number     = p.number
+        self.lr_index   = n
+        self.lookaheads = {}
+        self.prod.insert(n, '.')
+        self.prod       = tuple(self.prod)
+        self.len        = len(self.prod)
+        self.usyms      = p.usyms
+
+    def __str__(self):
+        if self.prod:
+            s = '%s -> %s' % (self.name, ' '.join(self.prod))
+        else:
+            s = '%s -> <empty>' % self.name
+        return s
+
+    def __repr__(self):
+        return 'LRItem(' + str(self) + ')'
+
+# -----------------------------------------------------------------------------
+# rightmost_terminal()
+#
+# Return the rightmost terminal from a list of symbols.  Used in add_production()
+# -----------------------------------------------------------------------------
+def rightmost_terminal(symbols, terminals):
+    i = len(symbols) - 1
+    while i >= 0:
+        if symbols[i] in terminals:
+            return symbols[i]
+        i -= 1
+    return None
+
+# -----------------------------------------------------------------------------
+#                           === GRAMMAR CLASS ===
+#
+# The following class represents the contents of the specified grammar along
+# with various computed properties such as first sets, follow sets, LR items, etc.
+# This data is used for critical parts of the table generation process later.
+# -----------------------------------------------------------------------------
+
+class GrammarError(YaccError):
+    pass
+
+class Grammar(object):
+    def __init__(self, terminals):
+        self.Productions  = [None]  # A list of all of the productions.  The first
+                                    # entry is always reserved for the purpose of
+                                    # building an augmented grammar
+
+        self.Prodnames    = {}      # A dictionary mapping the names of nonterminals to a list of all
+                                    # productions of that nonterminal.
+
+        self.Prodmap      = {}      # A dictionary that is only used to detect duplicate
+                                    # productions.
+
+        self.Terminals    = {}      # A dictionary mapping the names of terminal symbols to a
+                                    # list of the rules where they are used.
+
+        for term in terminals:
+            self.Terminals[term] = []
+
+        self.Terminals['error'] = []
+
+        self.Nonterminals = {}      # A dictionary mapping names of nonterminals to a list
+                                    # of rule numbers where they are used.
+
+        self.First        = {}      # A dictionary of precomputed FIRST(x) symbols
+
+        self.Follow       = {}      # A dictionary of precomputed FOLLOW(x) symbols
+
+        self.Precedence   = {}      # Precedence rules for each terminal. Contains tuples of the
+                                    # form ('right',level) or ('nonassoc', level) or ('left',level)
+
+        self.UsedPrecedence = set() # Precedence rules that were actually used by the grammer.
+                                    # This is only used to provide error checking and to generate
+                                    # a warning about unused precedence rules.
+
+        self.Start = None           # Starting symbol for the grammar
+
+
+    def __len__(self):
+        return len(self.Productions)
+
+    def __getitem__(self, index):
+        return self.Productions[index]
+
+    # -----------------------------------------------------------------------------
+    # set_precedence()
+    #
+    # Sets the precedence for a given terminal. assoc is the associativity such as
+    # 'left','right', or 'nonassoc'.  level is a numeric level.
+    #
+    # -----------------------------------------------------------------------------
+
+    def set_precedence(self, term, assoc, level):
+        assert self.Productions == [None], 'Must call set_precedence() before add_production()'
+        if term in self.Precedence:
+            raise GrammarError('Precedence already specified for terminal %r' % term)
+        if assoc not in ['left', 'right', 'nonassoc']:
+            raise GrammarError("Associativity must be one of 'left','right', or 'nonassoc'")
+        self.Precedence[term] = (assoc, level)
+
+    # -----------------------------------------------------------------------------
+    # add_production()
+    #
+    # Given an action function, this function assembles a production rule and
+    # computes its precedence level.
+    #
+    # The production rule is supplied as a list of symbols.   For example,
+    # a rule such as 'expr : expr PLUS term' has a production name of 'expr' and
+    # symbols ['expr','PLUS','term'].
+    #
+    # Precedence is determined by the precedence of the right-most non-terminal
+    # or the precedence of a terminal specified by %prec.
+    #
+    # A variety of error checks are performed to make sure production symbols
+    # are valid and that %prec is used correctly.
+    # -----------------------------------------------------------------------------
+
+    def add_production(self, prodname, syms, func=None, file='', line=0):
+
+        if prodname in self.Terminals:
+            raise GrammarError('%s:%d: Illegal rule name %r. Already defined as a token' % (file, line, prodname))
+        if prodname == 'error':
+            raise GrammarError('%s:%d: Illegal rule name %r. error is a reserved word' % (file, line, prodname))
+        if not _is_identifier.match(prodname):
+            raise GrammarError('%s:%d: Illegal rule name %r' % (file, line, prodname))
+
+        # Look for literal tokens
+        for n, s in enumerate(syms):
+            if s[0] in "'\"":
+                try:
+                    c = eval(s)
+                    if (len(c) > 1):
+                        raise GrammarError('%s:%d: Literal token %s in rule %r may only be a single character' %
+                                           (file, line, s, prodname))
+                    if c not in self.Terminals:
+                        self.Terminals[c] = []
+                    syms[n] = c
+                    continue
+                except SyntaxError:
+                    pass
+            if not _is_identifier.match(s) and s != '%prec':
+                raise GrammarError('%s:%d: Illegal name %r in rule %r' % (file, line, s, prodname))
+
+        # Determine the precedence level
+        if '%prec' in syms:
+            if syms[-1] == '%prec':
+                raise GrammarError('%s:%d: Syntax error. Nothing follows %%prec' % (file, line))
+            if syms[-2] != '%prec':
+                raise GrammarError('%s:%d: Syntax error. %%prec can only appear at the end of a grammar rule' %
+                                   (file, line))
+            precname = syms[-1]
+            prodprec = self.Precedence.get(precname)
+            if not prodprec:
+                raise GrammarError('%s:%d: Nothing known about the precedence of %r' % (file, line, precname))
+            else:
+                self.UsedPrecedence.add(precname)
+            del syms[-2:]     # Drop %prec from the rule
+        else:
+            # If no %prec, precedence is determined by the rightmost terminal symbol
+            precname = rightmost_terminal(syms, self.Terminals)
+            prodprec = self.Precedence.get(precname, ('right', 0))
+
+        # See if the rule is already in the rulemap
+        map = '%s -> %s' % (prodname, syms)
+        if map in self.Prodmap:
+            m = self.Prodmap[map]
+            raise GrammarError('%s:%d: Duplicate rule %s. ' % (file, line, m) +
+                               'Previous definition at %s:%d' % (m.file, m.line))
+
+        # From this point on, everything is valid.  Create a new Production instance
+        pnumber  = len(self.Productions)
+        if prodname not in self.Nonterminals:
+            self.Nonterminals[prodname] = []
+
+        # Add the production number to Terminals and Nonterminals
+        for t in syms:
+            if t in self.Terminals:
+                self.Terminals[t].append(pnumber)
+            else:
+                if t not in self.Nonterminals:
+                    self.Nonterminals[t] = []
+                self.Nonterminals[t].append(pnumber)
+
+        # Create a production and add it to the list of productions
+        p = Production(pnumber, prodname, syms, prodprec, func, file, line)
+        self.Productions.append(p)
+        self.Prodmap[map] = p
+
+        # Add to the global productions list
+        try:
+            self.Prodnames[prodname].append(p)
+        except KeyError:
+            self.Prodnames[prodname] = [p]
+
+    # -----------------------------------------------------------------------------
+    # set_start()
+    #
+    # Sets the starting symbol and creates the augmented grammar.  Production
+    # rule 0 is S' -> start where start is the start symbol.
+    # -----------------------------------------------------------------------------
+
+    def set_start(self, start=None):
+        if not start:
+            start = self.Productions[1].name
+        if start not in self.Nonterminals:
+            raise GrammarError('start symbol %s undefined' % start)
+        self.Productions[0] = Production(0, "S'", [start])
+        self.Nonterminals[start].append(0)
+        self.Start = start
+
+    # -----------------------------------------------------------------------------
+    # find_unreachable()
+    #
+    # Find all of the nonterminal symbols that can't be reached from the starting
+    # symbol.  Returns a list of nonterminals that can't be reached.
+    # -----------------------------------------------------------------------------
+
+    def find_unreachable(self):
+
+        # Mark all symbols that are reachable from a symbol s
+        def mark_reachable_from(s):
+            if s in reachable:
+                return
+            reachable.add(s)
+            for p in self.Prodnames.get(s, []):
+                for r in p.prod:
+                    mark_reachable_from(r)
+
+        reachable = set()
+        mark_reachable_from(self.Productions[0].prod[0])
+        return [s for s in self.Nonterminals if s not in reachable]
+
+    # -----------------------------------------------------------------------------
+    # infinite_cycles()
+    #
+    # This function looks at the various parsing rules and tries to detect
+    # infinite recursion cycles (grammar rules where there is no possible way
+    # to derive a string of only terminals).
+    # -----------------------------------------------------------------------------
+
+    def infinite_cycles(self):
+        terminates = {}
+
+        # Terminals:
+        for t in self.Terminals:
+            terminates[t] = True
+
+        terminates['$end'] = True
+
+        # Nonterminals:
+
+        # Initialize to false:
+        for n in self.Nonterminals:
+            terminates[n] = False
+
+        # Then propagate termination until no change:
+        while True:
+            some_change = False
+            for (n, pl) in self.Prodnames.items():
+                # Nonterminal n terminates iff any of its productions terminates.
+                for p in pl:
+                    # Production p terminates iff all of its rhs symbols terminate.
+                    for s in p.prod:
+                        if not terminates[s]:
+                            # The symbol s does not terminate,
+                            # so production p does not terminate.
+                            p_terminates = False
+                            break
+                    else:
+                        # didn't break from the loop,
+                        # so every symbol s terminates
+                        # so production p terminates.
+                        p_terminates = True
+
+                    if p_terminates:
+                        # symbol n terminates!
+                        if not terminates[n]:
+                            terminates[n] = True
+                            some_change = True
+                        # Don't need to consider any more productions for this n.
+                        break
+
+            if not some_change:
+                break
+
+        infinite = []
+        for (s, term) in terminates.items():
+            if not term:
+                if s not in self.Prodnames and s not in self.Terminals and s != 'error':
+                    # s is used-but-not-defined, and we've already warned of that,
+                    # so it would be overkill to say that it's also non-terminating.
+                    pass
+                else:
+                    infinite.append(s)
+
+        return infinite
+
+    # -----------------------------------------------------------------------------
+    # undefined_symbols()
+    #
+    # Find all symbols that were used the grammar, but not defined as tokens or
+    # grammar rules.  Returns a list of tuples (sym, prod) where sym in the symbol
+    # and prod is the production where the symbol was used.
+    # -----------------------------------------------------------------------------
+    def undefined_symbols(self):
+        result = []
+        for p in self.Productions:
+            if not p:
+                continue
+
+            for s in p.prod:
+                if s not in self.Prodnames and s not in self.Terminals and s != 'error':
+                    result.append((s, p))
+        return result
+
+    # -----------------------------------------------------------------------------
+    # unused_terminals()
+    #
+    # Find all terminals that were defined, but not used by the grammar.  Returns
+    # a list of all symbols.
+    # -----------------------------------------------------------------------------
+    def unused_terminals(self):
+        unused_tok = []
+        for s, v in self.Terminals.items():
+            if s != 'error' and not v:
+                unused_tok.append(s)
+
+        return unused_tok
+
+    # ------------------------------------------------------------------------------
+    # unused_rules()
+    #
+    # Find all grammar rules that were defined,  but not used (maybe not reachable)
+    # Returns a list of productions.
+    # ------------------------------------------------------------------------------
+
+    def unused_rules(self):
+        unused_prod = []
+        for s, v in self.Nonterminals.items():
+            if not v:
+                p = self.Prodnames[s][0]
+                unused_prod.append(p)
+        return unused_prod
+
+    # -----------------------------------------------------------------------------
+    # unused_precedence()
+    #
+    # Returns a list of tuples (term,precedence) corresponding to precedence
+    # rules that were never used by the grammar.  term is the name of the terminal
+    # on which precedence was applied and precedence is a string such as 'left' or
+    # 'right' corresponding to the type of precedence.
+    # -----------------------------------------------------------------------------
+
+    def unused_precedence(self):
+        unused = []
+        for termname in self.Precedence:
+            if not (termname in self.Terminals or termname in self.UsedPrecedence):
+                unused.append((termname, self.Precedence[termname][0]))
+
+        return unused
+
+    # -------------------------------------------------------------------------
+    # _first()
+    #
+    # Compute the value of FIRST1(beta) where beta is a tuple of symbols.
+    #
+    # During execution of compute_first1, the result may be incomplete.
+    # Afterward (e.g., when called from compute_follow()), it will be complete.
+    # -------------------------------------------------------------------------
+    def _first(self, beta):
+
+        # We are computing First(x1,x2,x3,...,xn)
+        result = []
+        for x in beta:
+            x_produces_empty = False
+
+            # Add all the non-<empty> symbols of First[x] to the result.
+            for f in self.First[x]:
+                if f == '<empty>':
+                    x_produces_empty = True
+                else:
+                    if f not in result:
+                        result.append(f)
+
+            if x_produces_empty:
+                # We have to consider the next x in beta,
+                # i.e. stay in the loop.
+                pass
+            else:
+                # We don't have to consider any further symbols in beta.
+                break
+        else:
+            # There was no 'break' from the loop,
+            # so x_produces_empty was true for all x in beta,
+            # so beta produces empty as well.
+            result.append('<empty>')
+
+        return result
+
+    # -------------------------------------------------------------------------
+    # compute_first()
+    #
+    # Compute the value of FIRST1(X) for all symbols
+    # -------------------------------------------------------------------------
+    def compute_first(self):
+        if self.First:
+            return self.First
+
+        # Terminals:
+        for t in self.Terminals:
+            self.First[t] = [t]
+
+        self.First['$end'] = ['$end']
+
+        # Nonterminals:
+
+        # Initialize to the empty set:
+        for n in self.Nonterminals:
+            self.First[n] = []
+
+        # Then propagate symbols until no change:
+        while True:
+            some_change = False
+            for n in self.Nonterminals:
+                for p in self.Prodnames[n]:
+                    for f in self._first(p.prod):
+                        if f not in self.First[n]:
+                            self.First[n].append(f)
+                            some_change = True
+            if not some_change:
+                break
+
+        return self.First
+
+    # ---------------------------------------------------------------------
+    # compute_follow()
+    #
+    # Computes all of the follow sets for every non-terminal symbol.  The
+    # follow set is the set of all symbols that might follow a given
+    # non-terminal.  See the Dragon book, 2nd Ed. p. 189.
+    # ---------------------------------------------------------------------
+    def compute_follow(self, start=None):
+        # If already computed, return the result
+        if self.Follow:
+            return self.Follow
+
+        # If first sets not computed yet, do that first.
+        if not self.First:
+            self.compute_first()
+
+        # Add '$end' to the follow list of the start symbol
+        for k in self.Nonterminals:
+            self.Follow[k] = []
+
+        if not start:
+            start = self.Productions[1].name
+
+        self.Follow[start] = ['$end']
+
+        while True:
+            didadd = False
+            for p in self.Productions[1:]:
+                # Here is the production set
+                for i, B in enumerate(p.prod):
+                    if B in self.Nonterminals:
+                        # Okay. We got a non-terminal in a production
+                        fst = self._first(p.prod[i+1:])
+                        hasempty = False
+                        for f in fst:
+                            if f != '<empty>' and f not in self.Follow[B]:
+                                self.Follow[B].append(f)
+                                didadd = True
+                            if f == '<empty>':
+                                hasempty = True
+                        if hasempty or i == (len(p.prod)-1):
+                            # Add elements of follow(a) to follow(b)
+                            for f in self.Follow[p.name]:
+                                if f not in self.Follow[B]:
+                                    self.Follow[B].append(f)
+                                    didadd = True
+            if not didadd:
+                break
+        return self.Follow
+
+
+    # -----------------------------------------------------------------------------
+    # build_lritems()
+    #
+    # This function walks the list of productions and builds a complete set of the
+    # LR items.  The LR items are stored in two ways:  First, they are uniquely
+    # numbered and placed in the list _lritems.  Second, a linked list of LR items
+    # is built for each production.  For example:
+    #
+    #   E -> E PLUS E
+    #
+    # Creates the list
+    #
+    #  [E -> . E PLUS E, E -> E . PLUS E, E -> E PLUS . E, E -> E PLUS E . ]
+    # -----------------------------------------------------------------------------
+
+    def build_lritems(self):
+        for p in self.Productions:
+            lastlri = p
+            i = 0
+            lr_items = []
+            while True:
+                if i > len(p):
+                    lri = None
+                else:
+                    lri = LRItem(p, i)
+                    # Precompute the list of productions immediately following
+                    try:
+                        lri.lr_after = self.Prodnames[lri.prod[i+1]]
+                    except (IndexError, KeyError):
+                        lri.lr_after = []
+                    try:
+                        lri.lr_before = lri.prod[i-1]
+                    except IndexError:
+                        lri.lr_before = None
+
+                lastlri.lr_next = lri
+                if not lri:
+                    break
+                lr_items.append(lri)
+                lastlri = lri
+                i += 1
+            p.lr_items = lr_items
+
+# -----------------------------------------------------------------------------
+#                            == Class LRTable ==
+#
+# This basic class represents a basic table of LR parsing information.
+# Methods for generating the tables are not defined here.  They are defined
+# in the derived class LRGeneratedTable.
+# -----------------------------------------------------------------------------
+
+class VersionError(YaccError):
+    pass
+
+class LRTable(object):
+    def __init__(self):
+        self.lr_action = None
+        self.lr_goto = None
+        self.lr_productions = None
+        self.lr_method = None
+
+    def read_table(self, module):
+        if isinstance(module, types.ModuleType):
+            parsetab = module
+        else:
+            exec('import %s' % module)
+            parsetab = sys.modules[module]
+
+        if parsetab._tabversion != __tabversion__:
+            raise VersionError('yacc table file version is out of date')
+
+        self.lr_action = parsetab._lr_action
+        self.lr_goto = parsetab._lr_goto
+
+        self.lr_productions = []
+        for p in parsetab._lr_productions:
+            self.lr_productions.append(MiniProduction(*p))
+
+        self.lr_method = parsetab._lr_method
+        return parsetab._lr_signature
+
+    def read_pickle(self, filename):
+        try:
+            import cPickle as pickle
+        except ImportError:
+            import pickle
+
+        if not os.path.exists(filename):
+          raise ImportError
+
+        in_f = open(filename, 'rb')
+
+        tabversion = pickle.load(in_f)
+        if tabversion != __tabversion__:
+            raise VersionError('yacc table file version is out of date')
+        self.lr_method = pickle.load(in_f)
+        signature      = pickle.load(in_f)
+        self.lr_action = pickle.load(in_f)
+        self.lr_goto   = pickle.load(in_f)
+        productions    = pickle.load(in_f)
+
+        self.lr_productions = []
+        for p in productions:
+            self.lr_productions.append(MiniProduction(*p))
+
+        in_f.close()
+        return signature
+
+    # Bind all production function names to callable objects in pdict
+    def bind_callables(self, pdict):
+        for p in self.lr_productions:
+            p.bind(pdict)
+
+
+# -----------------------------------------------------------------------------
+#                           === LR Generator ===
+#
+# The following classes and functions are used to generate LR parsing tables on
+# a grammar.
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# digraph()
+# traverse()
+#
+# The following two functions are used to compute set valued functions
+# of the form:
+#
+#     F(x) = F'(x) U U{F(y) | x R y}
+#
+# This is used to compute the values of Read() sets as well as FOLLOW sets
+# in LALR(1) generation.
+#
+# Inputs:  X    - An input set
+#          R    - A relation
+#          FP   - Set-valued function
+# ------------------------------------------------------------------------------
+
+def digraph(X, R, FP):
+    N = {}
+    for x in X:
+        N[x] = 0
+    stack = []
+    F = {}
+    for x in X:
+        if N[x] == 0:
+            traverse(x, N, stack, F, X, R, FP)
+    return F
+
+def traverse(x, N, stack, F, X, R, FP):
+    stack.append(x)
+    d = len(stack)
+    N[x] = d
+    F[x] = FP(x)             # F(X) <- F'(x)
+
+    rel = R(x)               # Get y's related to x
+    for y in rel:
+        if N[y] == 0:
+            traverse(y, N, stack, F, X, R, FP)
+        N[x] = min(N[x], N[y])
+        for a in F.get(y, []):
+            if a not in F[x]:
+                F[x].append(a)
+    if N[x] == d:
+        N[stack[-1]] = MAXINT
+        F[stack[-1]] = F[x]
+        element = stack.pop()
+        while element != x:
+            N[stack[-1]] = MAXINT
+            F[stack[-1]] = F[x]
+            element = stack.pop()
+
+class LALRError(YaccError):
+    pass
+
+# -----------------------------------------------------------------------------
+#                             == LRGeneratedTable ==
+#
+# This class implements the LR table generation algorithm.  There are no
+# public methods except for write()
+# -----------------------------------------------------------------------------
+
+class LRGeneratedTable(LRTable):
+    def __init__(self, grammar, method='LALR', log=None):
+        if method not in ['SLR', 'LALR']:
+            raise LALRError('Unsupported method %s' % method)
+
+        self.grammar = grammar
+        self.lr_method = method
+
+        # Set up the logger
+        if not log:
+            log = NullLogger()
+        self.log = log
+
+        # Internal attributes
+        self.lr_action     = {}        # Action table
+        self.lr_goto       = {}        # Goto table
+        self.lr_productions  = grammar.Productions    # Copy of grammar Production array
+        self.lr_goto_cache = {}        # Cache of computed gotos
+        self.lr0_cidhash   = {}        # Cache of closures
+
+        self._add_count    = 0         # Internal counter used to detect cycles
+
+        # Diagonistic information filled in by the table generator
+        self.sr_conflict   = 0
+        self.rr_conflict   = 0
+        self.conflicts     = []        # List of conflicts
+
+        self.sr_conflicts  = []
+        self.rr_conflicts  = []
+
+        # Build the tables
+        self.grammar.build_lritems()
+        self.grammar.compute_first()
+        self.grammar.compute_follow()
+        self.lr_parse_table()
+
+    # Compute the LR(0) closure operation on I, where I is a set of LR(0) items.
+
+    def lr0_closure(self, I):
+        self._add_count += 1
+
+        # Add everything in I to J
+        J = I[:]
+        didadd = True
+        while didadd:
+            didadd = False
+            for j in J:
+                for x in j.lr_after:
+                    if getattr(x, 'lr0_added', 0) == self._add_count:
+                        continue
+                    # Add B --> .G to J
+                    J.append(x.lr_next)
+                    x.lr0_added = self._add_count
+                    didadd = True
+
+        return J
+
+    # Compute the LR(0) goto function goto(I,X) where I is a set
+    # of LR(0) items and X is a grammar symbol.   This function is written
+    # in a way that guarantees uniqueness of the generated goto sets
+    # (i.e. the same goto set will never be returned as two different Python
+    # objects).  With uniqueness, we can later do fast set comparisons using
+    # id(obj) instead of element-wise comparison.
+
+    def lr0_goto(self, I, x):
+        # First we look for a previously cached entry
+        g = self.lr_goto_cache.get((id(I), x))
+        if g:
+            return g
+
+        # Now we generate the goto set in a way that guarantees uniqueness
+        # of the result
+
+        s = self.lr_goto_cache.get(x)
+        if not s:
+            s = {}
+            self.lr_goto_cache[x] = s
+
+        gs = []
+        for p in I:
+            n = p.lr_next
+            if n and n.lr_before == x:
+                s1 = s.get(id(n))
+                if not s1:
+                    s1 = {}
+                    s[id(n)] = s1
+                gs.append(n)
+                s = s1
+        g = s.get('$end')
+        if not g:
+            if gs:
+                g = self.lr0_closure(gs)
+                s['$end'] = g
+            else:
+                s['$end'] = gs
+        self.lr_goto_cache[(id(I), x)] = g
+        return g
+
+    # Compute the LR(0) sets of item function
+    def lr0_items(self):
+        C = [self.lr0_closure([self.grammar.Productions[0].lr_next])]
+        i = 0
+        for I in C:
+            self.lr0_cidhash[id(I)] = i
+            i += 1
+
+        # Loop over the items in C and each grammar symbols
+        i = 0
+        while i < len(C):
+            I = C[i]
+            i += 1
+
+            # Collect all of the symbols that could possibly be in the goto(I,X) sets
+            asyms = {}
+            for ii in I:
+                for s in ii.usyms:
+                    asyms[s] = None
+
+            for x in asyms:
+                g = self.lr0_goto(I, x)
+                if not g or id(g) in self.lr0_cidhash:
+                    continue
+                self.lr0_cidhash[id(g)] = len(C)
+                C.append(g)
+
+        return C
+
+    # -----------------------------------------------------------------------------
+    #                       ==== LALR(1) Parsing ====
+    #
+    # LALR(1) parsing is almost exactly the same as SLR except that instead of
+    # relying upon Follow() sets when performing reductions, a more selective
+    # lookahead set that incorporates the state of the LR(0) machine is utilized.
+    # Thus, we mainly just have to focus on calculating the lookahead sets.
+    #
+    # The method used here is due to DeRemer and Pennelo (1982).
+    #
+    # DeRemer, F. L., and T. J. Pennelo: "Efficient Computation of LALR(1)
+    #     Lookahead Sets", ACM Transactions on Programming Languages and Systems,
+    #     Vol. 4, No. 4, Oct. 1982, pp. 615-649
+    #
+    # Further details can also be found in:
+    #
+    #  J. Tremblay and P. Sorenson, "The Theory and Practice of Compiler Writing",
+    #      McGraw-Hill Book Company, (1985).
+    #
+    # -----------------------------------------------------------------------------
+
+    # -----------------------------------------------------------------------------
+    # compute_nullable_nonterminals()
+    #
+    # Creates a dictionary containing all of the non-terminals that might produce
+    # an empty production.
+    # -----------------------------------------------------------------------------
+
+    def compute_nullable_nonterminals(self):
+        nullable = set()
+        num_nullable = 0
+        while True:
+            for p in self.grammar.Productions[1:]:
+                if p.len == 0:
+                    nullable.add(p.name)
+                    continue
+                for t in p.prod:
+                    if t not in nullable:
+                        break
+                else:
+                    nullable.add(p.name)
+            if len(nullable) == num_nullable:
+                break
+            num_nullable = len(nullable)
+        return nullable
+
+    # -----------------------------------------------------------------------------
+    # find_nonterminal_trans(C)
+    #
+    # Given a set of LR(0) items, this functions finds all of the non-terminal
+    # transitions.    These are transitions in which a dot appears immediately before
+    # a non-terminal.   Returns a list of tuples of the form (state,N) where state
+    # is the state number and N is the nonterminal symbol.
+    #
+    # The input C is the set of LR(0) items.
+    # -----------------------------------------------------------------------------
+
+    def find_nonterminal_transitions(self, C):
+        trans = []
+        for stateno, state in enumerate(C):
+            for p in state:
+                if p.lr_index < p.len - 1:
+                    t = (stateno, p.prod[p.lr_index+1])
+                    if t[1] in self.grammar.Nonterminals:
+                        if t not in trans:
+                            trans.append(t)
+        return trans
+
+    # -----------------------------------------------------------------------------
+    # dr_relation()
+    #
+    # Computes the DR(p,A) relationships for non-terminal transitions.  The input
+    # is a tuple (state,N) where state is a number and N is a nonterminal symbol.
+    #
+    # Returns a list of terminals.
+    # -----------------------------------------------------------------------------
+
+    def dr_relation(self, C, trans, nullable):
+        dr_set = {}
+        state, N = trans
+        terms = []
+
+        g = self.lr0_goto(C[state], N)
+        for p in g:
+            if p.lr_index < p.len - 1:
+                a = p.prod[p.lr_index+1]
+                if a in self.grammar.Terminals:
+                    if a not in terms:
+                        terms.append(a)
+
+        # This extra bit is to handle the start state
+        if state == 0 and N == self.grammar.Productions[0].prod[0]:
+            terms.append('$end')
+
+        return terms
+
+    # -----------------------------------------------------------------------------
+    # reads_relation()
+    #
+    # Computes the READS() relation (p,A) READS (t,C).
+    # -----------------------------------------------------------------------------
+
+    def reads_relation(self, C, trans, empty):
+        # Look for empty transitions
+        rel = []
+        state, N = trans
+
+        g = self.lr0_goto(C[state], N)
+        j = self.lr0_cidhash.get(id(g), -1)
+        for p in g:
+            if p.lr_index < p.len - 1:
+                a = p.prod[p.lr_index + 1]
+                if a in empty:
+                    rel.append((j, a))
+
+        return rel
+
+    # -----------------------------------------------------------------------------
+    # compute_lookback_includes()
+    #
+    # Determines the lookback and includes relations
+    #
+    # LOOKBACK:
+    #
+    # This relation is determined by running the LR(0) state machine forward.
+    # For example, starting with a production "N : . A B C", we run it forward
+    # to obtain "N : A B C ."   We then build a relationship between this final
+    # state and the starting state.   These relationships are stored in a dictionary
+    # lookdict.
+    #
+    # INCLUDES:
+    #
+    # Computes the INCLUDE() relation (p,A) INCLUDES (p',B).
+    #
+    # This relation is used to determine non-terminal transitions that occur
+    # inside of other non-terminal transition states.   (p,A) INCLUDES (p', B)
+    # if the following holds:
+    #
+    #       B -> LAT, where T -> epsilon and p' -L-> p
+    #
+    # L is essentially a prefix (which may be empty), T is a suffix that must be
+    # able to derive an empty string.  State p' must lead to state p with the string L.
+    #
+    # -----------------------------------------------------------------------------
+
+    def compute_lookback_includes(self, C, trans, nullable):
+        lookdict = {}          # Dictionary of lookback relations
+        includedict = {}       # Dictionary of include relations
+
+        # Make a dictionary of non-terminal transitions
+        dtrans = {}
+        for t in trans:
+            dtrans[t] = 1
+
+        # Loop over all transitions and compute lookbacks and includes
+        for state, N in trans:
+            lookb = []
+            includes = []
+            for p in C[state]:
+                if p.name != N:
+                    continue
+
+                # Okay, we have a name match.  We now follow the production all the way
+                # through the state machine until we get the . on the right hand side
+
+                lr_index = p.lr_index
+                j = state
+                while lr_index < p.len - 1:
+                    lr_index = lr_index + 1
+                    t = p.prod[lr_index]
+
+                    # Check to see if this symbol and state are a non-terminal transition
+                    if (j, t) in dtrans:
+                        # Yes.  Okay, there is some chance that this is an includes relation
+                        # the only way to know for certain is whether the rest of the
+                        # production derives empty
+
+                        li = lr_index + 1
+                        while li < p.len:
+                            if p.prod[li] in self.grammar.Terminals:
+                                break      # No forget it
+                            if p.prod[li] not in nullable:
+                                break
+                            li = li + 1
+                        else:
+                            # Appears to be a relation between (j,t) and (state,N)
+                            includes.append((j, t))
+
+                    g = self.lr0_goto(C[j], t)               # Go to next set
+                    j = self.lr0_cidhash.get(id(g), -1)      # Go to next state
+
+                # When we get here, j is the final state, now we have to locate the production
+                for r in C[j]:
+                    if r.name != p.name:
+                        continue
+                    if r.len != p.len:
+                        continue
+                    i = 0
+                    # This look is comparing a production ". A B C" with "A B C ."
+                    while i < r.lr_index:
+                        if r.prod[i] != p.prod[i+1]:
+                            break
+                        i = i + 1
+                    else:
+                        lookb.append((j, r))
+            for i in includes:
+                if i not in includedict:
+                    includedict[i] = []
+                includedict[i].append((state, N))
+            lookdict[(state, N)] = lookb
+
+        return lookdict, includedict
+
+    # -----------------------------------------------------------------------------
+    # compute_read_sets()
+    #
+    # Given a set of LR(0) items, this function computes the read sets.
+    #
+    # Inputs:  C        =  Set of LR(0) items
+    #          ntrans   = Set of nonterminal transitions
+    #          nullable = Set of empty transitions
+    #
+    # Returns a set containing the read sets
+    # -----------------------------------------------------------------------------
+
+    def compute_read_sets(self, C, ntrans, nullable):
+        FP = lambda x: self.dr_relation(C, x, nullable)
+        R =  lambda x: self.reads_relation(C, x, nullable)
+        F = digraph(ntrans, R, FP)
+        return F
+
+    # -----------------------------------------------------------------------------
+    # compute_follow_sets()
+    #
+    # Given a set of LR(0) items, a set of non-terminal transitions, a readset,
+    # and an include set, this function computes the follow sets
+    #
+    # Follow(p,A) = Read(p,A) U U {Follow(p',B) | (p,A) INCLUDES (p',B)}
+    #
+    # Inputs:
+    #            ntrans     = Set of nonterminal transitions
+    #            readsets   = Readset (previously computed)
+    #            inclsets   = Include sets (previously computed)
+    #
+    # Returns a set containing the follow sets
+    # -----------------------------------------------------------------------------
+
+    def compute_follow_sets(self, ntrans, readsets, inclsets):
+        FP = lambda x: readsets[x]
+        R  = lambda x: inclsets.get(x, [])
+        F = digraph(ntrans, R, FP)
+        return F
+
+    # -----------------------------------------------------------------------------
+    # add_lookaheads()
+    #
+    # Attaches the lookahead symbols to grammar rules.
+    #
+    # Inputs:    lookbacks         -  Set of lookback relations
+    #            followset         -  Computed follow set
+    #
+    # This function directly attaches the lookaheads to productions contained
+    # in the lookbacks set
+    # -----------------------------------------------------------------------------
+
+    def add_lookaheads(self, lookbacks, followset):
+        for trans, lb in lookbacks.items():
+            # Loop over productions in lookback
+            for state, p in lb:
+                if state not in p.lookaheads:
+                    p.lookaheads[state] = []
+                f = followset.get(trans, [])
+                for a in f:
+                    if a not in p.lookaheads[state]:
+                        p.lookaheads[state].append(a)
+
+    # -----------------------------------------------------------------------------
+    # add_lalr_lookaheads()
+    #
+    # This function does all of the work of adding lookahead information for use
+    # with LALR parsing
+    # -----------------------------------------------------------------------------
+
+    def add_lalr_lookaheads(self, C):
+        # Determine all of the nullable nonterminals
+        nullable = self.compute_nullable_nonterminals()
+
+        # Find all non-terminal transitions
+        trans = self.find_nonterminal_transitions(C)
+
+        # Compute read sets
+        readsets = self.compute_read_sets(C, trans, nullable)
+
+        # Compute lookback/includes relations
+        lookd, included = self.compute_lookback_includes(C, trans, nullable)
+
+        # Compute LALR FOLLOW sets
+        followsets = self.compute_follow_sets(trans, readsets, included)
+
+        # Add all of the lookaheads
+        self.add_lookaheads(lookd, followsets)
+
+    # -----------------------------------------------------------------------------
+    # lr_parse_table()
+    #
+    # This function constructs the parse tables for SLR or LALR
+    # -----------------------------------------------------------------------------
+    def lr_parse_table(self):
+        Productions = self.grammar.Productions
+        Precedence  = self.grammar.Precedence
+        goto   = self.lr_goto         # Goto array
+        action = self.lr_action       # Action array
+        log    = self.log             # Logger for output
+
+        actionp = {}                  # Action production array (temporary)
+
+        log.info('Parsing method: %s', self.lr_method)
+
+        # Step 1: Construct C = { I0, I1, ... IN}, collection of LR(0) items
+        # This determines the number of states
+
+        C = self.lr0_items()
+
+        if self.lr_method == 'LALR':
+            self.add_lalr_lookaheads(C)
+
+        # Build the parser table, state by state
+        st = 0
+        for I in C:
+            # Loop over each production in I
+            actlist = []              # List of actions
+            st_action  = {}
+            st_actionp = {}
+            st_goto    = {}
+            log.info('')
+            log.info('state %d', st)
+            log.info('')
+            for p in I:
+                log.info('    (%d) %s', p.number, p)
+            log.info('')
+
+            for p in I:
+                    if p.len == p.lr_index + 1:
+                        if p.name == "S'":
+                            # Start symbol. Accept!
+                            st_action['$end'] = 0
+                            st_actionp['$end'] = p
+                        else:
+                            # We are at the end of a production.  Reduce!
+                            if self.lr_method == 'LALR':
+                                laheads = p.lookaheads[st]
+                            else:
+                                laheads = self.grammar.Follow[p.name]
+                            for a in laheads:
+                                actlist.append((a, p, 'reduce using rule %d (%s)' % (p.number, p)))
+                                r = st_action.get(a)
+                                if r is not None:
+                                    # Whoa. Have a shift/reduce or reduce/reduce conflict
+                                    if r > 0:
+                                        # Need to decide on shift or reduce here
+                                        # By default we favor shifting. Need to add
+                                        # some precedence rules here.
+
+                                        # Shift precedence comes from the token
+                                        sprec, slevel = Precedence.get(a, ('right', 0))
+
+                                        # Reduce precedence comes from rule being reduced (p)
+                                        rprec, rlevel = Productions[p.number].prec
+
+                                        if (slevel < rlevel) or ((slevel == rlevel) and (rprec == 'left')):
+                                            # We really need to reduce here.
+                                            st_action[a] = -p.number
+                                            st_actionp[a] = p
+                                            if not slevel and not rlevel:
+                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)
+                                                self.sr_conflicts.append((st, a, 'reduce'))
+                                            Productions[p.number].reduced += 1
+                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):
+                                            st_action[a] = None
+                                        else:
+                                            # Hmmm. Guess we'll keep the shift
+                                            if not rlevel:
+                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)
+                                                self.sr_conflicts.append((st, a, 'shift'))
+                                    elif r < 0:
+                                        # Reduce/reduce conflict.   In this case, we favor the rule
+                                        # that was defined first in the grammar file
+                                        oldp = Productions[-r]
+                                        pp = Productions[p.number]
+                                        if oldp.line > pp.line:
+                                            st_action[a] = -p.number
+                                            st_actionp[a] = p
+                                            chosenp, rejectp = pp, oldp
+                                            Productions[p.number].reduced += 1
+                                            Productions[oldp.number].reduced -= 1
+                                        else:
+                                            chosenp, rejectp = oldp, pp
+                                        self.rr_conflicts.append((st, chosenp, rejectp))
+                                        log.info('  ! reduce/reduce conflict for %s resolved using rule %d (%s)',
+                                                 a, st_actionp[a].number, st_actionp[a])
+                                    else:
+                                        raise LALRError('Unknown conflict in state %d' % st)
+                                else:
+                                    st_action[a] = -p.number
+                                    st_actionp[a] = p
+                                    Productions[p.number].reduced += 1
+                    else:
+                        i = p.lr_index
+                        a = p.prod[i+1]       # Get symbol right after the "."
+                        if a in self.grammar.Terminals:
+                            g = self.lr0_goto(I, a)
+                            j = self.lr0_cidhash.get(id(g), -1)
+                            if j >= 0:
+                                # We are in a shift state
+                                actlist.append((a, p, 'shift and go to state %d' % j))
+                                r = st_action.get(a)
+                                if r is not None:
+                                    # Whoa have a shift/reduce or shift/shift conflict
+                                    if r > 0:
+                                        if r != j:
+                                            raise LALRError('Shift/shift conflict in state %d' % st)
+                                    elif r < 0:
+                                        # Do a precedence check.
+                                        #   -  if precedence of reduce rule is higher, we reduce.
+                                        #   -  if precedence of reduce is same and left assoc, we reduce.
+                                        #   -  otherwise we shift
+
+                                        # Shift precedence comes from the token
+                                        sprec, slevel = Precedence.get(a, ('right', 0))
+
+                                        # Reduce precedence comes from the rule that could have been reduced
+                                        rprec, rlevel = Productions[st_actionp[a].number].prec
+
+                                        if (slevel > rlevel) or ((slevel == rlevel) and (rprec == 'right')):
+                                            # We decide to shift here... highest precedence to shift
+                                            Productions[st_actionp[a].number].reduced -= 1
+                                            st_action[a] = j
+                                            st_actionp[a] = p
+                                            if not rlevel:
+                                                log.info('  ! shift/reduce conflict for %s resolved as shift', a)
+                                                self.sr_conflicts.append((st, a, 'shift'))
+                                        elif (slevel == rlevel) and (rprec == 'nonassoc'):
+                                            st_action[a] = None
+                                        else:
+                                            # Hmmm. Guess we'll keep the reduce
+                                            if not slevel and not rlevel:
+                                                log.info('  ! shift/reduce conflict for %s resolved as reduce', a)
+                                                self.sr_conflicts.append((st, a, 'reduce'))
+
+                                    else:
+                                        raise LALRError('Unknown conflict in state %d' % st)
+                                else:
+                                    st_action[a] = j
+                                    st_actionp[a] = p
+
+            # Print the actions associated with each terminal
+            _actprint = {}
+            for a, p, m in actlist:
+                if a in st_action:
+                    if p is st_actionp[a]:
+                        log.info('    %-15s %s', a, m)
+                        _actprint[(a, m)] = 1
+            log.info('')
+            # Print the actions that were not used. (debugging)
+            not_used = 0
+            for a, p, m in actlist:
+                if a in st_action:
+                    if p is not st_actionp[a]:
+                        if not (a, m) in _actprint:
+                            log.debug('  ! %-15s [ %s ]', a, m)
+                            not_used = 1
+                            _actprint[(a, m)] = 1
+            if not_used:
+                log.debug('')
+
+            # Construct the goto table for this state
+
+            nkeys = {}
+            for ii in I:
+                for s in ii.usyms:
+                    if s in self.grammar.Nonterminals:
+                        nkeys[s] = None
+            for n in nkeys:
+                g = self.lr0_goto(I, n)
+                j = self.lr0_cidhash.get(id(g), -1)
+                if j >= 0:
+                    st_goto[n] = j
+                    log.info('    %-30s shift and go to state %d', n, j)
+
+            action[st] = st_action
+            actionp[st] = st_actionp
+            goto[st] = st_goto
+            st += 1
+
+    # -----------------------------------------------------------------------------
+    # write()
+    #
+    # This function writes the LR parsing tables to a file
+    # -----------------------------------------------------------------------------
+
+    def write_table(self, tabmodule, outputdir='', signature=''):
+        if isinstance(tabmodule, types.ModuleType):
+            raise IOError("Won't overwrite existing tabmodule")
+
+        basemodulename = tabmodule.split('.')[-1]
+        filename = os.path.join(outputdir, basemodulename) + '.py'
+        try:
+            f = open(filename, 'w')
+
+            f.write('''
+# %s
+# This file is automatically generated. Do not edit.
+_tabversion = %r
+
+_lr_method = %r
+
+_lr_signature = %r
+    ''' % (os.path.basename(filename), __tabversion__, self.lr_method, signature))
+
+            # Change smaller to 0 to go back to original tables
+            smaller = 1
+
+            # Factor out names to try and make smaller
+            if smaller:
+                items = {}
+
+                for s, nd in self.lr_action.items():
+                    for name, v in nd.items():
+                        i = items.get(name)
+                        if not i:
+                            i = ([], [])
+                            items[name] = i
+                        i[0].append(s)
+                        i[1].append(v)
+
+                f.write('\n_lr_action_items = {')
+                for k, v in items.items():
+                    f.write('%r:([' % k)
+                    for i in v[0]:
+                        f.write('%r,' % i)
+                    f.write('],[')
+                    for i in v[1]:
+                        f.write('%r,' % i)
+
+                    f.write(']),')
+                f.write('}\n')
+
+                f.write('''
+_lr_action = {}
+for _k, _v in _lr_action_items.items():
+   for _x,_y in zip(_v[0],_v[1]):
+      if not _x in _lr_action:  _lr_action[_x] = {}
+      _lr_action[_x][_k] = _y
+del _lr_action_items
+''')
+
+            else:
+                f.write('\n_lr_action = { ')
+                for k, v in self.lr_action.items():
+                    f.write('(%r,%r):%r,' % (k[0], k[1], v))
+                f.write('}\n')
+
+            if smaller:
+                # Factor out names to try and make smaller
+                items = {}
+
+                for s, nd in self.lr_goto.items():
+                    for name, v in nd.items():
+                        i = items.get(name)
+                        if not i:
+                            i = ([], [])
+                            items[name] = i
+                        i[0].append(s)
+                        i[1].append(v)
+
+                f.write('\n_lr_goto_items = {')
+                for k, v in items.items():
+                    f.write('%r:([' % k)
+                    for i in v[0]:
+                        f.write('%r,' % i)
+                    f.write('],[')
+                    for i in v[1]:
+                        f.write('%r,' % i)
+
+                    f.write(']),')
+                f.write('}\n')
+
+                f.write('''
+_lr_goto = {}
+for _k, _v in _lr_goto_items.items():
+   for _x, _y in zip(_v[0], _v[1]):
+       if not _x in _lr_goto: _lr_goto[_x] = {}
+       _lr_goto[_x][_k] = _y
+del _lr_goto_items
+''')
+            else:
+                f.write('\n_lr_goto = { ')
+                for k, v in self.lr_goto.items():
+                    f.write('(%r,%r):%r,' % (k[0], k[1], v))
+                f.write('}\n')
+
+            # Write production table
+            f.write('_lr_productions = [\n')
+            for p in self.lr_productions:
+                if p.func:
+                    f.write('  (%r,%r,%d,%r,%r,%d),\n' % (p.str, p.name, p.len,
+                                                          p.func, os.path.basename(p.file), p.line))
+                else:
+                    f.write('  (%r,%r,%d,None,None,None),\n' % (str(p), p.name, p.len))
+            f.write(']\n')
+            f.close()
+
+        except IOError as e:
+            raise
+
+
+    # -----------------------------------------------------------------------------
+    # pickle_table()
+    #
+    # This function pickles the LR parsing tables to a supplied file object
+    # -----------------------------------------------------------------------------
+
+    def pickle_table(self, filename, signature=''):
+        try:
+            import cPickle as pickle
+        except ImportError:
+            import pickle
+        with open(filename, 'wb') as outf:
+            pickle.dump(__tabversion__, outf, pickle_protocol)
+            pickle.dump(self.lr_method, outf, pickle_protocol)
+            pickle.dump(signature, outf, pickle_protocol)
+            pickle.dump(self.lr_action, outf, pickle_protocol)
+            pickle.dump(self.lr_goto, outf, pickle_protocol)
+
+            outp = []
+            for p in self.lr_productions:
+                if p.func:
+                    outp.append((p.str, p.name, p.len, p.func, os.path.basename(p.file), p.line))
+                else:
+                    outp.append((str(p), p.name, p.len, None, None, None))
+            pickle.dump(outp, outf, pickle_protocol)
+
+# -----------------------------------------------------------------------------
+#                            === INTROSPECTION ===
+#
+# The following functions and classes are used to implement the PLY
+# introspection features followed by the yacc() function itself.
+# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+# get_caller_module_dict()
+#
+# This function returns a dictionary containing all of the symbols defined within
+# a caller further down the call stack.  This is used to get the environment
+# associated with the yacc() call if none was provided.
+# -----------------------------------------------------------------------------
+
+def get_caller_module_dict(levels):
+    f = sys._getframe(levels)
+    ldict = f.f_globals.copy()
+    if f.f_globals != f.f_locals:
+        ldict.update(f.f_locals)
+    return ldict
+
+# -----------------------------------------------------------------------------
+# parse_grammar()
+#
+# This takes a raw grammar rule string and parses it into production data
+# -----------------------------------------------------------------------------
+def parse_grammar(doc, file, line):
+    grammar = []
+    # Split the doc string into lines
+    pstrings = doc.splitlines()
+    lastp = None
+    dline = line
+    for ps in pstrings:
+        dline += 1
+        p = ps.split()
+        if not p:
+            continue
+        try:
+            if p[0] == '|':
+                # This is a continuation of a previous rule
+                if not lastp:
+                    raise SyntaxError("%s:%d: Misplaced '|'" % (file, dline))
+                prodname = lastp
+                syms = p[1:]
+            else:
+                prodname = p[0]
+                lastp = prodname
+                syms   = p[2:]
+                assign = p[1]
+                if assign != ':' and assign != '::=':
+                    raise SyntaxError("%s:%d: Syntax error. Expected ':'" % (file, dline))
+
+            grammar.append((file, dline, prodname, syms))
+        except SyntaxError:
+            raise
+        except Exception:
+            raise SyntaxError('%s:%d: Syntax error in rule %r' % (file, dline, ps.strip()))
+
+    return grammar
+
+# -----------------------------------------------------------------------------
+# ParserReflect()
+#
+# This class represents information extracted for building a parser including
+# start symbol, error function, tokens, precedence list, action functions,
+# etc.
+# -----------------------------------------------------------------------------
+class ParserReflect(object):
+    def __init__(self, pdict, log=None):
+        self.pdict      = pdict
+        self.start      = None
+        self.error_func = None
+        self.tokens     = None
+        self.modules    = set()
+        self.grammar    = []
+        self.error      = False
+
+        if log is None:
+            self.log = PlyLogger(sys.stderr)
+        else:
+            self.log = log
+
+    # Get all of the basic information
+    def get_all(self):
+        self.get_start()
+        self.get_error_func()
+        self.get_tokens()
+        self.get_precedence()
+        self.get_pfunctions()
+
+    # Validate all of the information
+    def validate_all(self):
+        self.validate_start()
+        self.validate_error_func()
+        self.validate_tokens()
+        self.validate_precedence()
+        self.validate_pfunctions()
+        self.validate_modules()
+        return self.error
+
+    # Compute a signature over the grammar
+    def signature(self):
+        parts = []
+        try:
+            if self.start:
+                parts.append(self.start)
+            if self.prec:
+                parts.append(''.join([''.join(p) for p in self.prec]))
+            if self.tokens:
+                parts.append(' '.join(self.tokens))
+            for f in self.pfuncs:
+                if f[3]:
+                    parts.append(f[3])
+        except (TypeError, ValueError):
+            pass
+        return ''.join(parts)
+
+    # -----------------------------------------------------------------------------
+    # validate_modules()
+    #
+    # This method checks to see if there are duplicated p_rulename() functions
+    # in the parser module file.  Without this function, it is really easy for
+    # users to make mistakes by cutting and pasting code fragments (and it's a real
+    # bugger to try and figure out why the resulting parser doesn't work).  Therefore,
+    # we just do a little regular expression pattern matching of def statements
+    # to try and detect duplicates.
+    # -----------------------------------------------------------------------------
+
+    def validate_modules(self):
+        # Match def p_funcname(
+        fre = re.compile(r'\s*def\s+(p_[a-zA-Z_0-9]*)\(')
+
+        for module in self.modules:
+            try:
+                lines, linen = inspect.getsourcelines(module)
+            except IOError:
+                continue
+
+            counthash = {}
+            for linen, line in enumerate(lines):
+                linen += 1
+                m = fre.match(line)
+                if m:
+                    name = m.group(1)
+                    prev = counthash.get(name)
+                    if not prev:
+                        counthash[name] = linen
+                    else:
+                        filename = inspect.getsourcefile(module)
+                        self.log.warning('%s:%d: Function %s redefined. Previously defined on line %d',
+                                         filename, linen, name, prev)
+
+    # Get the start symbol
+    def get_start(self):
+        self.start = self.pdict.get('start')
+
+    # Validate the start symbol
+    def validate_start(self):
+        if self.start is not None:
+            if not isinstance(self.start, string_types):
+                self.log.error("'start' must be a string")
+
+    # Look for error handler
+    def get_error_func(self):
+        self.error_func = self.pdict.get('p_error')
+
+    # Validate the error function
+    def validate_error_func(self):
+        if self.error_func:
+            if isinstance(self.error_func, types.FunctionType):
+                ismethod = 0
+            elif isinstance(self.error_func, types.MethodType):
+                ismethod = 1
+            else:
+                self.log.error("'p_error' defined, but is not a function or method")
+                self.error = True
+                return
+
+            eline = self.error_func.__code__.co_firstlineno
+            efile = self.error_func.__code__.co_filename
+            module = inspect.getmodule(self.error_func)
+            self.modules.add(module)
+
+            argcount = self.error_func.__code__.co_argcount - ismethod
+            if argcount != 1:
+                self.log.error('%s:%d: p_error() requires 1 argument', efile, eline)
+                self.error = True
+
+    # Get the tokens map
+    def get_tokens(self):
+        tokens = self.pdict.get('tokens')
+        if not tokens:
+            self.log.error('No token list is defined')
+            self.error = True
+            return
+
+        if not isinstance(tokens, (list, tuple)):
+            self.log.error('tokens must be a list or tuple')
+            self.error = True
+            return
+
+        if not tokens:
+            self.log.error('tokens is empty')
+            self.error = True
+            return
+
+        self.tokens = tokens
+
+    # Validate the tokens
+    def validate_tokens(self):
+        # Validate the tokens.
+        if 'error' in self.tokens:
+            self.log.error("Illegal token name 'error'. Is a reserved word")
+            self.error = True
+            return
+
+        terminals = set()
+        for n in self.tokens:
+            if n in terminals:
+                self.log.warning('Token %r multiply defined', n)
+            terminals.add(n)
+
+    # Get the precedence map (if any)
+    def get_precedence(self):
+        self.prec = self.pdict.get('precedence')
+
+    # Validate and parse the precedence map
+    def validate_precedence(self):
+        preclist = []
+        if self.prec:
+            if not isinstance(self.prec, (list, tuple)):
+                self.log.error('precedence must be a list or tuple')
+                self.error = True
+                return
+            for level, p in enumerate(self.prec):
+                if not isinstance(p, (list, tuple)):
+                    self.log.error('Bad precedence table')
+                    self.error = True
+                    return
+
+                if len(p) < 2:
+                    self.log.error('Malformed precedence entry %s. Must be (assoc, term, ..., term)', p)
+                    self.error = True
+                    return
+                assoc = p[0]
+                if not isinstance(assoc, string_types):
+                    self.log.error('precedence associativity must be a string')
+                    self.error = True
+                    return
+                for term in p[1:]:
+                    if not isinstance(term, string_types):
+                        self.log.error('precedence items must be strings')
+                        self.error = True
+                        return
+                    preclist.append((term, assoc, level+1))
+        self.preclist = preclist
+
+    # Get all p_functions from the grammar
+    def get_pfunctions(self):
+        p_functions = []
+        for name, item in self.pdict.items():
+            if not name.startswith('p_') or name == 'p_error':
+                continue
+            if isinstance(item, (types.FunctionType, types.MethodType)):
+                line = getattr(item, 'co_firstlineno', item.__code__.co_firstlineno)
+                module = inspect.getmodule(item)
+                p_functions.append((line, module, name, item.__doc__))
+
+        # Sort all of the actions by line number; make sure to stringify
+        # modules to make them sortable, since `line` may not uniquely sort all
+        # p functions
+        p_functions.sort(key=lambda p_function: (
+            p_function[0],
+            str(p_function[1]),
+            p_function[2],
+            p_function[3]))
+        self.pfuncs = p_functions
+
+    # Validate all of the p_functions
+    def validate_pfunctions(self):
+        grammar = []
+        # Check for non-empty symbols
+        if len(self.pfuncs) == 0:
+            self.log.error('no rules of the form p_rulename are defined')
+            self.error = True
+            return
+
+        for line, module, name, doc in self.pfuncs:
+            file = inspect.getsourcefile(module)
+            func = self.pdict[name]
+            if isinstance(func, types.MethodType):
+                reqargs = 2
+            else:
+                reqargs = 1
+            if func.__code__.co_argcount > reqargs:
+                self.log.error('%s:%d: Rule %r has too many arguments', file, line, func.__name__)
+                self.error = True
+            elif func.__code__.co_argcount < reqargs:
+                self.log.error('%s:%d: Rule %r requires an argument', file, line, func.__name__)
+                self.error = True
+            elif not func.__doc__:
+                self.log.warning('%s:%d: No documentation string specified in function %r (ignored)',
+                                 file, line, func.__name__)
+            else:
+                try:
+                    parsed_g = parse_grammar(doc, file, line)
+                    for g in parsed_g:
+                        grammar.append((name, g))
+                except SyntaxError as e:
+                    self.log.error(str(e))
+                    self.error = True
+
+                # Looks like a valid grammar rule
+                # Mark the file in which defined.
+                self.modules.add(module)
+
+        # Secondary validation step that looks for p_ definitions that are not functions
+        # or functions that look like they might be grammar rules.
+
+        for n, v in self.pdict.items():
+            if n.startswith('p_') and isinstance(v, (types.FunctionType, types.MethodType)):
+                continue
+            if n.startswith('t_'):
+                continue
+            if n.startswith('p_') and n != 'p_error':
+                self.log.warning('%r not defined as a function', n)
+            if ((isinstance(v, types.FunctionType) and v.__code__.co_argcount == 1) or
+                   (isinstance(v, types.MethodType) and v.__func__.__code__.co_argcount == 2)):
+                if v.__doc__:
+                    try:
+                        doc = v.__doc__.split(' ')
+                        if doc[1] == ':':
+                            self.log.warning('%s:%d: Possible grammar rule %r defined without p_ prefix',
+                                             v.__code__.co_filename, v.__code__.co_firstlineno, n)
+                    except IndexError:
+                        pass
+
+        self.grammar = grammar
+
+# -----------------------------------------------------------------------------
+# yacc(module)
+#
+# Build a parser
+# -----------------------------------------------------------------------------
+
+def yacc(method='LALR', debug=yaccdebug, module=None, tabmodule=tab_module, start=None,
+         check_recursion=True, optimize=False, write_tables=True, debugfile=debug_file,
+         outputdir=None, debuglog=None, errorlog=None, picklefile=None):
+
+    if tabmodule is None:
+        tabmodule = tab_module
+
+    # Reference to the parsing method of the last built parser
+    global parse
+
+    # If pickling is enabled, table files are not created
+    if picklefile:
+        write_tables = 0
+
+    if errorlog is None:
+        errorlog = PlyLogger(sys.stderr)
+
+    # Get the module dictionary used for the parser
+    if module:
+        _items = [(k, getattr(module, k)) for k in dir(module)]
+        pdict = dict(_items)
+        # If no __file__ attribute is available, try to obtain it from the __module__ instead
+        if '__file__' not in pdict:
+            pdict['__file__'] = sys.modules[pdict['__module__']].__file__
+    else:
+        pdict = get_caller_module_dict(2)
+
+    if outputdir is None:
+        # If no output directory is set, the location of the output files
+        # is determined according to the following rules:
+        #     - If tabmodule specifies a package, files go into that package directory
+        #     - Otherwise, files go in the same directory as the specifying module
+        if isinstance(tabmodule, types.ModuleType):
+            srcfile = tabmodule.__file__
+        else:
+            if '.' not in tabmodule:
+                srcfile = pdict['__file__']
+            else:
+                parts = tabmodule.split('.')
+                pkgname = '.'.join(parts[:-1])
+                exec('import %s' % pkgname)
+                srcfile = getattr(sys.modules[pkgname], '__file__', '')
+        outputdir = os.path.dirname(srcfile)
+
+    # Determine if the module is package of a package or not.
+    # If so, fix the tabmodule setting so that tables load correctly
+    pkg = pdict.get('__package__')
+    if pkg and isinstance(tabmodule, str):
+        if '.' not in tabmodule:
+            tabmodule = pkg + '.' + tabmodule
+
+
+
+    # Set start symbol if it's specified directly using an argument
+    if start is not None:
+        pdict['start'] = start
+
+    # Collect parser information from the dictionary
+    pinfo = ParserReflect(pdict, log=errorlog)
+    pinfo.get_all()
+
+    if pinfo.error:
+        raise YaccError('Unable to build parser')
+
+    # Check signature against table files (if any)
+    signature = pinfo.signature()
+
+    # Read the tables
+    try:
+        lr = LRTable()
+        if picklefile:
+            read_signature = lr.read_pickle(picklefile)
+        else:
+            read_signature = lr.read_table(tabmodule)
+        if optimize or (read_signature == signature):
+            try:
+                lr.bind_callables(pinfo.pdict)
+                parser = LRParser(lr, pinfo.error_func)
+                parse = parser.parse
+                return parser
+            except Exception as e:
+                errorlog.warning('There was a problem loading the table file: %r', e)
+    except VersionError as e:
+        errorlog.warning(str(e))
+    except ImportError:
+        pass
+
+    if debuglog is None:
+        if debug:
+            try:
+                debuglog = PlyLogger(open(os.path.join(outputdir, debugfile), 'w'))
+            except IOError as e:
+                errorlog.warning("Couldn't open %r. %s" % (debugfile, e))
+                debuglog = NullLogger()
+        else:
+            debuglog = NullLogger()
+
+    debuglog.info('Created by PLY version %s (http://www.dabeaz.com/ply)', __version__)
+
+    errors = False
+
+    # Validate the parser information
+    if pinfo.validate_all():
+        raise YaccError('Unable to build parser')
+
+    if not pinfo.error_func:
+        errorlog.warning('no p_error() function is defined')
+
+    # Create a grammar object
+    grammar = Grammar(pinfo.tokens)
+
+    # Set precedence level for terminals
+    for term, assoc, level in pinfo.preclist:
+        try:
+            grammar.set_precedence(term, assoc, level)
+        except GrammarError as e:
+            errorlog.warning('%s', e)
+
+    # Add productions to the grammar
+    for funcname, gram in pinfo.grammar:
+        file, line, prodname, syms = gram
+        try:
+            grammar.add_production(prodname, syms, funcname, file, line)
+        except GrammarError as e:
+            errorlog.error('%s', e)
+            errors = True
+
+    # Set the grammar start symbols
+    try:
+        if start is None:
+            grammar.set_start(pinfo.start)
+        else:
+            grammar.set_start(start)
+    except GrammarError as e:
+        errorlog.error(str(e))
+        errors = True
+
+    if errors:
+        raise YaccError('Unable to build parser')
+
+    # Verify the grammar structure
+    undefined_symbols = grammar.undefined_symbols()
+    for sym, prod in undefined_symbols:
+        errorlog.error('%s:%d: Symbol %r used, but not defined as a token or a rule', prod.file, prod.line, sym)
+        errors = True
+
+    unused_terminals = grammar.unused_terminals()
+    if unused_terminals:
+        debuglog.info('')
+        debuglog.info('Unused terminals:')
+        debuglog.info('')
+        for term in unused_terminals:
+            errorlog.warning('Token %r defined, but not used', term)
+            debuglog.info('    %s', term)
+
+    # Print out all productions to the debug log
+    if debug:
+        debuglog.info('')
+        debuglog.info('Grammar')
+        debuglog.info('')
+        for n, p in enumerate(grammar.Productions):
+            debuglog.info('Rule %-5d %s', n, p)
+
+    # Find unused non-terminals
+    unused_rules = grammar.unused_rules()
+    for prod in unused_rules:
+        errorlog.warning('%s:%d: Rule %r defined, but not used', prod.file, prod.line, prod.name)
+
+    if len(unused_terminals) == 1:
+        errorlog.warning('There is 1 unused token')
+    if len(unused_terminals) > 1:
+        errorlog.warning('There are %d unused tokens', len(unused_terminals))
+
+    if len(unused_rules) == 1:
+        errorlog.warning('There is 1 unused rule')
+    if len(unused_rules) > 1:
+        errorlog.warning('There are %d unused rules', len(unused_rules))
+
+    if debug:
+        debuglog.info('')
+        debuglog.info('Terminals, with rules where they appear')
+        debuglog.info('')
+        terms = list(grammar.Terminals)
+        terms.sort()
+        for term in terms:
+            debuglog.info('%-20s : %s', term, ' '.join([str(s) for s in grammar.Terminals[term]]))
+
+        debuglog.info('')
+        debuglog.info('Nonterminals, with rules where they appear')
+        debuglog.info('')
+        nonterms = list(grammar.Nonterminals)
+        nonterms.sort()
+        for nonterm in nonterms:
+            debuglog.info('%-20s : %s', nonterm, ' '.join([str(s) for s in grammar.Nonterminals[nonterm]]))
+        debuglog.info('')
+
+    if check_recursion:
+        unreachable = grammar.find_unreachable()
+        for u in unreachable:
+            errorlog.warning('Symbol %r is unreachable', u)
+
+        infinite = grammar.infinite_cycles()
+        for inf in infinite:
+            errorlog.error('Infinite recursion detected for symbol %r', inf)
+            errors = True
+
+    unused_prec = grammar.unused_precedence()
+    for term, assoc in unused_prec:
+        errorlog.error('Precedence rule %r defined for unknown symbol %r', assoc, term)
+        errors = True
+
+    if errors:
+        raise YaccError('Unable to build parser')
+
+    # Run the LRGeneratedTable on the grammar
+    if debug:
+        errorlog.debug('Generating %s tables', method)
+
+    lr = LRGeneratedTable(grammar, method, debuglog)
+
+    if debug:
+        num_sr = len(lr.sr_conflicts)
+
+        # Report shift/reduce and reduce/reduce conflicts
+        if num_sr == 1:
+            errorlog.warning('1 shift/reduce conflict')
+        elif num_sr > 1:
+            errorlog.warning('%d shift/reduce conflicts', num_sr)
+
+        num_rr = len(lr.rr_conflicts)
+        if num_rr == 1:
+            errorlog.warning('1 reduce/reduce conflict')
+        elif num_rr > 1:
+            errorlog.warning('%d reduce/reduce conflicts', num_rr)
+
+    # Write out conflicts to the output file
+    if debug and (lr.sr_conflicts or lr.rr_conflicts):
+        debuglog.warning('')
+        debuglog.warning('Conflicts:')
+        debuglog.warning('')
+
+        for state, tok, resolution in lr.sr_conflicts:
+            debuglog.warning('shift/reduce conflict for %s in state %d resolved as %s',  tok, state, resolution)
+
+        already_reported = set()
+        for state, rule, rejected in lr.rr_conflicts:
+            if (state, id(rule), id(rejected)) in already_reported:
+                continue
+            debuglog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)
+            debuglog.warning('rejected rule (%s) in state %d', rejected, state)
+            errorlog.warning('reduce/reduce conflict in state %d resolved using rule (%s)', state, rule)
+            errorlog.warning('rejected rule (%s) in state %d', rejected, state)
+            already_reported.add((state, id(rule), id(rejected)))
+
+        warned_never = []
+        for state, rule, rejected in lr.rr_conflicts:
+            if not rejected.reduced and (rejected not in warned_never):
+                debuglog.warning('Rule (%s) is never reduced', rejected)
+                errorlog.warning('Rule (%s) is never reduced', rejected)
+                warned_never.append(rejected)
+
+    # Write the table file if requested
+    if write_tables:
+        try:
+            lr.write_table(tabmodule, outputdir, signature)
+        except IOError as e:
+            errorlog.warning("Couldn't create %r. %s" % (tabmodule, e))
+
+    # Write a pickled version of the tables
+    if picklefile:
+        try:
+            lr.pickle_table(picklefile, signature)
+        except IOError as e:
+            errorlog.warning("Couldn't create %r. %s" % (picklefile, e))
+
+    # Build the parser
+    lr.bind_callables(pinfo.pdict)
+    parser = LRParser(lr, pinfo.error_func)
+
+    parse = parser.parse
+    return parser
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ygen.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ygen.py
new file mode 100644
index 0000000000000000000000000000000000000000..acf5ca1a37b69389256227c570c65eed96e3228e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/ply/ygen.py
@@ -0,0 +1,74 @@
+# ply: ygen.py
+#
+# This is a support program that auto-generates different versions of the YACC parsing
+# function with different features removed for the purposes of performance.
+#
+# Users should edit the method LParser.parsedebug() in yacc.py.   The source code 
+# for that method is then used to create the other methods.   See the comments in
+# yacc.py for further details.
+
+import os.path
+import shutil
+
+def get_source_range(lines, tag):
+    srclines = enumerate(lines)
+    start_tag = '#--! %s-start' % tag
+    end_tag = '#--! %s-end' % tag
+
+    for start_index, line in srclines:
+        if line.strip().startswith(start_tag):
+            break
+
+    for end_index, line in srclines:
+        if line.strip().endswith(end_tag):
+            break
+
+    return (start_index + 1, end_index)
+
+def filter_section(lines, tag):
+    filtered_lines = []
+    include = True
+    tag_text = '#--! %s' % tag
+    for line in lines:
+        if line.strip().startswith(tag_text):
+            include = not include
+        elif include:
+            filtered_lines.append(line)
+    return filtered_lines
+
+def main():
+    dirname = os.path.dirname(__file__)
+    shutil.copy2(os.path.join(dirname, 'yacc.py'), os.path.join(dirname, 'yacc.py.bak'))
+    with open(os.path.join(dirname, 'yacc.py'), 'r') as f:
+        lines = f.readlines()
+
+    parse_start, parse_end = get_source_range(lines, 'parsedebug')
+    parseopt_start, parseopt_end = get_source_range(lines, 'parseopt')
+    parseopt_notrack_start, parseopt_notrack_end = get_source_range(lines, 'parseopt-notrack')
+
+    # Get the original source
+    orig_lines = lines[parse_start:parse_end]
+
+    # Filter the DEBUG sections out
+    parseopt_lines = filter_section(orig_lines, 'DEBUG')
+
+    # Filter the TRACKING sections out
+    parseopt_notrack_lines = filter_section(parseopt_lines, 'TRACKING')
+
+    # Replace the parser source sections with updated versions
+    lines[parseopt_notrack_start:parseopt_notrack_end] = parseopt_notrack_lines
+    lines[parseopt_start:parseopt_end] = parseopt_lines
+
+    lines = [line.rstrip()+'\n' for line in lines]
+    with open(os.path.join(dirname, 'yacc.py'), 'w') as f:
+        f.writelines(lines)
+
+    print('Updated yacc.py')
+
+if __name__ == '__main__':
+    main()
+
+
+
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/plyparser.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/plyparser.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8f4c4395ea7ed07572aeb3a9d9064c0373b504b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/plyparser.py
@@ -0,0 +1,133 @@
+#-----------------------------------------------------------------
+# plyparser.py
+#
+# PLYParser class and other utilities for simplifying programming
+# parsers with PLY
+#
+# Eli Bendersky [https://eli.thegreenplace.net/]
+# License: BSD
+#-----------------------------------------------------------------
+
+import warnings
+
+class Coord(object):
+    """ Coordinates of a syntactic element. Consists of:
+            - File name
+            - Line number
+            - (optional) column number, for the Lexer
+    """
+    __slots__ = ('file', 'line', 'column', '__weakref__')
+    def __init__(self, file, line, column=None):
+        self.file = file
+        self.line = line
+        self.column = column
+
+    def __str__(self):
+        str = "%s:%s" % (self.file, self.line)
+        if self.column: str += ":%s" % self.column
+        return str
+
+
+class ParseError(Exception): pass
+
+
+class PLYParser(object):
+    def _create_opt_rule(self, rulename):
+        """ Given a rule name, creates an optional ply.yacc rule
+            for it. The name of the optional rule is
+            <rulename>_opt
+        """
+        optname = rulename + '_opt'
+
+        def optrule(self, p):
+            p[0] = p[1]
+
+        optrule.__doc__ = '%s : empty\n| %s' % (optname, rulename)
+        optrule.__name__ = 'p_%s' % optname
+        setattr(self.__class__, optrule.__name__, optrule)
+
+    def _coord(self, lineno, column=None):
+        return Coord(
+                file=self.clex.filename,
+                line=lineno,
+                column=column)
+
+    def _token_coord(self, p, token_idx):
+        """ Returns the coordinates for the YaccProduction object 'p' indexed
+            with 'token_idx'. The coordinate includes the 'lineno' and
+            'column'. Both follow the lex semantic, starting from 1.
+        """
+        last_cr = p.lexer.lexer.lexdata.rfind('\n', 0, p.lexpos(token_idx))
+        if last_cr < 0:
+            last_cr = -1
+        column = (p.lexpos(token_idx) - (last_cr))
+        return self._coord(p.lineno(token_idx), column)
+
+    def _parse_error(self, msg, coord):
+        raise ParseError("%s: %s" % (coord, msg))
+
+
+def parameterized(*params):
+    """ Decorator to create parameterized rules.
+
+    Parameterized rule methods must be named starting with 'p_' and contain
+    'xxx', and their docstrings may contain 'xxx' and 'yyy'. These will be
+    replaced by the given parameter tuples. For example, ``p_xxx_rule()`` with
+    docstring 'xxx_rule  : yyy' when decorated with
+    ``@parameterized(('id', 'ID'))`` produces ``p_id_rule()`` with the docstring
+    'id_rule  : ID'. Using multiple tuples produces multiple rules.
+    """
+    def decorate(rule_func):
+        rule_func._params = params
+        return rule_func
+    return decorate
+
+
+def template(cls):
+    """ Class decorator to generate rules from parameterized rule templates.
+
+    See `parameterized` for more information on parameterized rules.
+    """
+    issued_nodoc_warning = False
+    for attr_name in dir(cls):
+        if attr_name.startswith('p_'):
+            method = getattr(cls, attr_name)
+            if hasattr(method, '_params'):
+                # Remove the template method
+                delattr(cls, attr_name)
+                # Create parameterized rules from this method; only run this if
+                # the method has a docstring. This is to address an issue when
+                # pycparser's users are installed in -OO mode which strips
+                # docstrings away.
+                # See: https://github.com/eliben/pycparser/pull/198/ and
+                #      https://github.com/eliben/pycparser/issues/197
+                # for discussion.
+                if method.__doc__ is not None:
+                    _create_param_rules(cls, method)
+                elif not issued_nodoc_warning:
+                    warnings.warn(
+                        'parsing methods must have __doc__ for pycparser to work properly',
+                        RuntimeWarning,
+                        stacklevel=2)
+                    issued_nodoc_warning = True
+    return cls
+
+
+def _create_param_rules(cls, func):
+    """ Create ply.yacc rules based on a parameterized rule function
+
+    Generates new methods (one per each pair of parameters) based on the
+    template rule function `func`, and attaches them to `cls`. The rule
+    function's parameters must be accessible via its `_params` attribute.
+    """
+    for xxx, yyy in func._params:
+        # Use the template method's body for each new method
+        def param_rule(self, p):
+            func(self, p)
+
+        # Substitute in the params for the grammar rule and function name
+        param_rule.__doc__ = func.__doc__.replace('xxx', xxx).replace('yyy', yyy)
+        param_rule.__name__ = func.__name__.replace('xxx', xxx)
+
+        # Attach the new method to the class
+        setattr(cls, param_rule.__name__, param_rule)
diff --git a/TP03/TP03/lib/python3.9/site-packages/pycparser/yacctab.py b/TP03/TP03/lib/python3.9/site-packages/pycparser/yacctab.py
new file mode 100644
index 0000000000000000000000000000000000000000..0622c366021b0ce7d514b24772aec9fc9082fa7e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/pycparser/yacctab.py
@@ -0,0 +1,366 @@
+
+# yacctab.py
+# This file is automatically generated. Do not edit.
+_tabversion = '3.10'
+
+_lr_method = 'LALR'
+
+_lr_signature = 'translation_unit_or_emptyleftLORleftLANDleftORleftXORleftANDleftEQNEleftGTGELTLEleftRSHIFTLSHIFTleftPLUSMINUSleftTIMESDIVIDEMODAUTO BREAK CASE CHAR CONST CONTINUE DEFAULT DO DOUBLE ELSE ENUM EXTERN FLOAT FOR GOTO IF INLINE INT LONG REGISTER OFFSETOF RESTRICT RETURN SHORT SIGNED SIZEOF STATIC STRUCT SWITCH TYPEDEF UNION UNSIGNED VOID VOLATILE WHILE __INT128 _BOOL _COMPLEX _NORETURN _THREAD_LOCAL _STATIC_ASSERT _ATOMIC _ALIGNOF _ALIGNAS ID TYPEID INT_CONST_DEC INT_CONST_OCT INT_CONST_HEX INT_CONST_BIN INT_CONST_CHAR FLOAT_CONST HEX_FLOAT_CONST CHAR_CONST WCHAR_CONST U8CHAR_CONST U16CHAR_CONST U32CHAR_CONST STRING_LITERAL WSTRING_LITERAL U8STRING_LITERAL U16STRING_LITERAL U32STRING_LITERAL PLUS MINUS TIMES DIVIDE MOD OR AND NOT XOR LSHIFT RSHIFT LOR LAND LNOT LT LE GT GE EQ NE EQUALS TIMESEQUAL DIVEQUAL MODEQUAL PLUSEQUAL MINUSEQUAL LSHIFTEQUAL RSHIFTEQUAL ANDEQUAL XOREQUAL OREQUAL PLUSPLUS MINUSMINUS ARROW CONDOP LPAREN RPAREN LBRACKET RBRACKET LBRACE RBRACE COMMA PERIOD SEMI COLON ELLIPSIS PPHASH PPPRAGMA PPPRAGMASTRabstract_declarator_opt : empty\n| abstract_declaratorassignment_expression_opt : empty\n| assignment_expressionblock_item_list_opt : empty\n| block_item_listdeclaration_list_opt : empty\n| declaration_listdeclaration_specifiers_no_type_opt : empty\n| declaration_specifiers_no_typedesignation_opt : empty\n| designationexpression_opt : empty\n| expressionid_init_declarator_list_opt : empty\n| id_init_declarator_listidentifier_list_opt : empty\n| identifier_listinit_declarator_list_opt : empty\n| init_declarator_listinitializer_list_opt : empty\n| initializer_listparameter_type_list_opt : empty\n| parameter_type_liststruct_declarator_list_opt : empty\n| struct_declarator_listtype_qualifier_list_opt : empty\n| type_qualifier_list direct_id_declarator   : ID\n         direct_id_declarator   : LPAREN id_declarator RPAREN\n         direct_id_declarator   : direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n         direct_id_declarator   : direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n                                    | direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n         direct_id_declarator   : direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n         direct_id_declarator   : direct_id_declarator LPAREN parameter_type_list RPAREN\n                                    | direct_id_declarator LPAREN identifier_list_opt RPAREN\n         direct_typeid_declarator   : TYPEID\n         direct_typeid_declarator   : LPAREN typeid_declarator RPAREN\n         direct_typeid_declarator   : direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n         direct_typeid_declarator   : direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n                                    | direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n         direct_typeid_declarator   : direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n         direct_typeid_declarator   : direct_typeid_declarator LPAREN parameter_type_list RPAREN\n                                    | direct_typeid_declarator LPAREN identifier_list_opt RPAREN\n         direct_typeid_noparen_declarator   : TYPEID\n         direct_typeid_noparen_declarator   : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n         direct_typeid_noparen_declarator   : direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET\n                                    | direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET\n         direct_typeid_noparen_declarator   : direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET\n         direct_typeid_noparen_declarator   : direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN\n                                    | direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN\n         id_declarator  : direct_id_declarator\n         id_declarator  : pointer direct_id_declarator\n         typeid_declarator  : direct_typeid_declarator\n         typeid_declarator  : pointer direct_typeid_declarator\n         typeid_noparen_declarator  : direct_typeid_noparen_declarator\n         typeid_noparen_declarator  : pointer direct_typeid_noparen_declarator\n         translation_unit_or_empty   : translation_unit\n                                        | empty\n         translation_unit    : external_declaration\n         translation_unit    : translation_unit external_declaration\n         external_declaration    : function_definition\n         external_declaration    : declaration\n         external_declaration    : pp_directive\n                                    | pppragma_directive\n         external_declaration    : SEMI\n         external_declaration    : static_assert\n         static_assert           : _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN\n                                    | _STATIC_ASSERT LPAREN constant_expression RPAREN\n         pp_directive  : PPHASH\n         pppragma_directive      : PPPRAGMA\n                                    | PPPRAGMA PPPRAGMASTR\n         function_definition : id_declarator declaration_list_opt compound_statement\n         function_definition : declaration_specifiers id_declarator declaration_list_opt compound_statement\n         statement   : labeled_statement\n                        | expression_statement\n                        | compound_statement\n                        | selection_statement\n                        | iteration_statement\n                        | jump_statement\n                        | pppragma_directive\n                        | static_assert\n         pragmacomp_or_statement     : pppragma_directive statement\n                                        | statement\n         decl_body : declaration_specifiers init_declarator_list_opt\n                      | declaration_specifiers_no_type id_init_declarator_list_opt\n         declaration : decl_body SEMI\n         declaration_list    : declaration\n                                | declaration_list declaration\n         declaration_specifiers_no_type  : type_qualifier declaration_specifiers_no_type_opt\n         declaration_specifiers_no_type  : storage_class_specifier declaration_specifiers_no_type_opt\n         declaration_specifiers_no_type  : function_specifier declaration_specifiers_no_type_opt\n         declaration_specifiers_no_type  : atomic_specifier declaration_specifiers_no_type_opt\n         declaration_specifiers_no_type  : alignment_specifier declaration_specifiers_no_type_opt\n         declaration_specifiers  : declaration_specifiers type_qualifier\n         declaration_specifiers  : declaration_specifiers storage_class_specifier\n         declaration_specifiers  : declaration_specifiers function_specifier\n         declaration_specifiers  : declaration_specifiers type_specifier_no_typeid\n         declaration_specifiers  : type_specifier\n         declaration_specifiers  : declaration_specifiers_no_type type_specifier\n         declaration_specifiers  : declaration_specifiers alignment_specifier\n         storage_class_specifier : AUTO\n                                    | REGISTER\n                                    | STATIC\n                                    | EXTERN\n                                    | TYPEDEF\n                                    | _THREAD_LOCAL\n         function_specifier  : INLINE\n                                | _NORETURN\n         type_specifier_no_typeid  : VOID\n                                      | _BOOL\n                                      | CHAR\n                                      | SHORT\n                                      | INT\n                                      | LONG\n                                      | FLOAT\n                                      | DOUBLE\n                                      | _COMPLEX\n                                      | SIGNED\n                                      | UNSIGNED\n                                      | __INT128\n         type_specifier  : typedef_name\n                            | enum_specifier\n                            | struct_or_union_specifier\n                            | type_specifier_no_typeid\n                            | atomic_specifier\n         atomic_specifier  : _ATOMIC LPAREN type_name RPAREN\n         type_qualifier  : CONST\n                            | RESTRICT\n                            | VOLATILE\n                            | _ATOMIC\n         init_declarator_list    : init_declarator\n                                    | init_declarator_list COMMA init_declarator\n         init_declarator : declarator\n                            | declarator EQUALS initializer\n         id_init_declarator_list    : id_init_declarator\n                                       | id_init_declarator_list COMMA init_declarator\n         id_init_declarator : id_declarator\n                               | id_declarator EQUALS initializer\n         specifier_qualifier_list    : specifier_qualifier_list type_specifier_no_typeid\n         specifier_qualifier_list    : specifier_qualifier_list type_qualifier\n         specifier_qualifier_list  : type_specifier\n         specifier_qualifier_list  : type_qualifier_list type_specifier\n         specifier_qualifier_list  : alignment_specifier\n         specifier_qualifier_list  : specifier_qualifier_list alignment_specifier\n         struct_or_union_specifier   : struct_or_union ID\n                                        | struct_or_union TYPEID\n         struct_or_union_specifier : struct_or_union brace_open struct_declaration_list brace_close\n                                      | struct_or_union brace_open brace_close\n         struct_or_union_specifier   : struct_or_union ID brace_open struct_declaration_list brace_close\n                                        | struct_or_union ID brace_open brace_close\n                                        | struct_or_union TYPEID brace_open struct_declaration_list brace_close\n                                        | struct_or_union TYPEID brace_open brace_close\n         struct_or_union : STRUCT\n                            | UNION\n         struct_declaration_list     : struct_declaration\n                                        | struct_declaration_list struct_declaration\n         struct_declaration : specifier_qualifier_list struct_declarator_list_opt SEMI\n         struct_declaration : SEMI\n         struct_declaration : pppragma_directive\n         struct_declarator_list  : struct_declarator\n                                    | struct_declarator_list COMMA struct_declarator\n         struct_declarator : declarator\n         struct_declarator   : declarator COLON constant_expression\n                                | COLON constant_expression\n         enum_specifier  : ENUM ID\n                            | ENUM TYPEID\n         enum_specifier  : ENUM brace_open enumerator_list brace_close\n         enum_specifier  : ENUM ID brace_open enumerator_list brace_close\n                            | ENUM TYPEID brace_open enumerator_list brace_close\n         enumerator_list : enumerator\n                            | enumerator_list COMMA\n                            | enumerator_list COMMA enumerator\n         alignment_specifier  : _ALIGNAS LPAREN type_name RPAREN\n                                 | _ALIGNAS LPAREN constant_expression RPAREN\n         enumerator  : ID\n                        | ID EQUALS constant_expression\n         declarator  : id_declarator\n                        | typeid_declarator\n         pointer : TIMES type_qualifier_list_opt\n                    | TIMES type_qualifier_list_opt pointer\n         type_qualifier_list : type_qualifier\n                                | type_qualifier_list type_qualifier\n         parameter_type_list : parameter_list\n                                | parameter_list COMMA ELLIPSIS\n         parameter_list  : parameter_declaration\n                            | parameter_list COMMA parameter_declaration\n         parameter_declaration   : declaration_specifiers id_declarator\n                                    | declaration_specifiers typeid_noparen_declarator\n         parameter_declaration   : declaration_specifiers abstract_declarator_opt\n         identifier_list : identifier\n                            | identifier_list COMMA identifier\n         initializer : assignment_expression\n         initializer : brace_open initializer_list_opt brace_close\n                        | brace_open initializer_list COMMA brace_close\n         initializer_list    : designation_opt initializer\n                                | initializer_list COMMA designation_opt initializer\n         designation : designator_list EQUALS\n         designator_list : designator\n                            | designator_list designator\n         designator  : LBRACKET constant_expression RBRACKET\n                        | PERIOD identifier\n         type_name   : specifier_qualifier_list abstract_declarator_opt\n         abstract_declarator     : pointer\n         abstract_declarator     : pointer direct_abstract_declarator\n         abstract_declarator     : direct_abstract_declarator\n         direct_abstract_declarator  : LPAREN abstract_declarator RPAREN  direct_abstract_declarator  : direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET\n         direct_abstract_declarator  : LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET\n         direct_abstract_declarator  : direct_abstract_declarator LBRACKET TIMES RBRACKET\n         direct_abstract_declarator  : LBRACKET TIMES RBRACKET\n         direct_abstract_declarator  : direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN\n         direct_abstract_declarator  : LPAREN parameter_type_list_opt RPAREN\n         block_item  : declaration\n                        | statement\n         block_item_list : block_item\n                            | block_item_list block_item\n         compound_statement : brace_open block_item_list_opt brace_close  labeled_statement : ID COLON pragmacomp_or_statement  labeled_statement : CASE constant_expression COLON pragmacomp_or_statement  labeled_statement : DEFAULT COLON pragmacomp_or_statement  selection_statement : IF LPAREN expression RPAREN pragmacomp_or_statement  selection_statement : IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement  selection_statement : SWITCH LPAREN expression RPAREN pragmacomp_or_statement  iteration_statement : WHILE LPAREN expression RPAREN pragmacomp_or_statement  iteration_statement : DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI  iteration_statement : FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement  iteration_statement : FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement  jump_statement  : GOTO ID SEMI  jump_statement  : BREAK SEMI  jump_statement  : CONTINUE SEMI  jump_statement  : RETURN expression SEMI\n                            | RETURN SEMI\n         expression_statement : expression_opt SEMI  expression  : assignment_expression\n                        | expression COMMA assignment_expression\n         assignment_expression : LPAREN compound_statement RPAREN  typedef_name : TYPEID  assignment_expression   : conditional_expression\n                                    | unary_expression assignment_operator assignment_expression\n         assignment_operator : EQUALS\n                                | XOREQUAL\n                                | TIMESEQUAL\n                                | DIVEQUAL\n                                | MODEQUAL\n                                | PLUSEQUAL\n                                | MINUSEQUAL\n                                | LSHIFTEQUAL\n                                | RSHIFTEQUAL\n                                | ANDEQUAL\n                                | OREQUAL\n         constant_expression : conditional_expression  conditional_expression  : binary_expression\n                                    | binary_expression CONDOP expression COLON conditional_expression\n         binary_expression   : cast_expression\n                                | binary_expression TIMES binary_expression\n                                | binary_expression DIVIDE binary_expression\n                                | binary_expression MOD binary_expression\n                                | binary_expression PLUS binary_expression\n                                | binary_expression MINUS binary_expression\n                                | binary_expression RSHIFT binary_expression\n                                | binary_expression LSHIFT binary_expression\n                                | binary_expression LT binary_expression\n                                | binary_expression LE binary_expression\n                                | binary_expression GE binary_expression\n                                | binary_expression GT binary_expression\n                                | binary_expression EQ binary_expression\n                                | binary_expression NE binary_expression\n                                | binary_expression AND binary_expression\n                                | binary_expression OR binary_expression\n                                | binary_expression XOR binary_expression\n                                | binary_expression LAND binary_expression\n                                | binary_expression LOR binary_expression\n         cast_expression : unary_expression  cast_expression : LPAREN type_name RPAREN cast_expression  unary_expression    : postfix_expression  unary_expression    : PLUSPLUS unary_expression\n                                | MINUSMINUS unary_expression\n                                | unary_operator cast_expression\n         unary_expression    : SIZEOF unary_expression\n                                | SIZEOF LPAREN type_name RPAREN\n                                | _ALIGNOF LPAREN type_name RPAREN\n         unary_operator  : AND\n                            | TIMES\n                            | PLUS\n                            | MINUS\n                            | NOT\n                            | LNOT\n         postfix_expression  : primary_expression  postfix_expression  : postfix_expression LBRACKET expression RBRACKET  postfix_expression  : postfix_expression LPAREN argument_expression_list RPAREN\n                                | postfix_expression LPAREN RPAREN\n         postfix_expression  : postfix_expression PERIOD ID\n                                | postfix_expression PERIOD TYPEID\n                                | postfix_expression ARROW ID\n                                | postfix_expression ARROW TYPEID\n         postfix_expression  : postfix_expression PLUSPLUS\n                                | postfix_expression MINUSMINUS\n         postfix_expression  : LPAREN type_name RPAREN brace_open initializer_list brace_close\n                                | LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close\n         primary_expression  : identifier  primary_expression  : constant  primary_expression  : unified_string_literal\n                                | unified_wstring_literal\n         primary_expression  : LPAREN expression RPAREN  primary_expression  : OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN\n         offsetof_member_designator : identifier\n                                         | offsetof_member_designator PERIOD identifier\n                                         | offsetof_member_designator LBRACKET expression RBRACKET\n         argument_expression_list    : assignment_expression\n                                        | argument_expression_list COMMA assignment_expression\n         identifier  : ID  constant    : INT_CONST_DEC\n                        | INT_CONST_OCT\n                        | INT_CONST_HEX\n                        | INT_CONST_BIN\n                        | INT_CONST_CHAR\n         constant    : FLOAT_CONST\n                        | HEX_FLOAT_CONST\n         constant    : CHAR_CONST\n                        | WCHAR_CONST\n                        | U8CHAR_CONST\n                        | U16CHAR_CONST\n                        | U32CHAR_CONST\n         unified_string_literal  : STRING_LITERAL\n                                    | unified_string_literal STRING_LITERAL\n         unified_wstring_literal : WSTRING_LITERAL\n                                    | U8STRING_LITERAL\n                                    | U16STRING_LITERAL\n                                    | U32STRING_LITERAL\n                                    | unified_wstring_literal WSTRING_LITERAL\n                                    | unified_wstring_literal U8STRING_LITERAL\n                                    | unified_wstring_literal U16STRING_LITERAL\n                                    | unified_wstring_literal U32STRING_LITERAL\n         brace_open  :   LBRACE\n         brace_close :   RBRACE\n        empty : '
+    
+_lr_action_items = {'INT_CONST_CHAR':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,132,-335,-28,-182,-27,132,-337,-87,-72,-337,132,-286,-285,132,132,-283,-287,-288,132,-284,132,132,132,-336,-183,132,132,-28,-337,132,-28,-337,-337,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,-337,-76,-79,-82,-75,132,-77,132,132,-81,-215,-214,-80,-216,132,-78,132,132,-69,-284,132,132,-284,132,132,-244,-247,-245,-241,-242,-246,-248,132,-250,-251,-243,-249,-12,132,132,-11,132,132,132,132,-234,-233,132,-231,132,132,-217,132,-230,132,-84,-218,132,132,132,-337,-337,-198,132,132,132,-337,-284,-229,-232,132,-221,132,-83,-219,-68,132,-28,-337,132,-11,132,132,-220,132,132,132,-284,132,132,132,-337,132,-225,-224,-222,-84,132,132,132,-226,-223,132,-228,-227,]),'VOID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[6,-337,-113,-128,6,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,6,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,6,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,6,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,6,-131,-95,-101,-97,6,-53,-126,6,-88,6,6,-93,6,-147,-335,-146,6,-167,-166,-182,-100,-126,6,-87,-90,-94,-92,-61,-72,6,-144,-142,6,6,6,-73,6,-89,6,6,6,-149,-159,-160,-156,-336,6,-183,-30,6,6,-74,6,6,6,6,-174,-175,6,-143,-140,6,-141,-145,-76,-79,-82,-75,-77,6,-81,-215,-214,-80,-216,-78,-127,6,-153,6,-151,-148,-157,-168,-69,-36,-35,6,6,6,-234,-233,6,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,6,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACKET':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,97,98,100,101,103,104,105,106,109,111,127,132,133,134,136,138,139,140,141,142,143,145,147,148,152,153,154,156,160,161,163,164,166,167,168,169,176,177,187,191,198,199,200,211,216,227,230,235,236,237,238,240,241,261,263,269,275,276,278,279,280,283,310,312,314,316,317,328,340,341,342,344,345,347,355,356,371,376,402,403,404,405,407,411,414,442,443,448,449,453,454,457,458,464,465,470,472,474,482,483,488,489,490,492,511,512,518,519,520,526,527,529,530,531,532,544,545,547,550,551,559,560,563,565,570,571,572,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,117,-123,-117,-119,-114,-130,-118,-103,-96,-98,128,-131,-37,-95,-101,-97,117,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,128,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-314,-142,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,265,-323,-312,282,-149,-336,-183,-181,-30,282,-38,373,-326,-334,-332,-331,-333,-174,-175,-298,-297,-143,-140,282,282,-141,-145,421,-312,-127,-153,-151,-148,-168,-36,-35,282,282,459,-45,-44,-43,-199,373,-296,-295,-294,-293,-292,-305,421,-152,-150,-170,-169,-31,-34,282,459,-39,-42,-202,373,-200,-290,-291,373,-213,-207,-211,-33,-32,-41,-40,-201,549,-307,-209,-208,-210,-212,-51,-50,-306,373,-299,-46,-49,-308,-300,-48,-47,-309,]),'WCHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,133,-335,-28,-182,-27,133,-337,-87,-72,-337,133,-286,-285,133,133,-283,-287,-288,133,-284,133,133,133,-336,-183,133,133,-28,-337,133,-28,-337,-337,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,-337,-76,-79,-82,-75,133,-77,133,133,-81,-215,-214,-80,-216,133,-78,133,133,-69,-284,133,133,-284,133,133,-244,-247,-245,-241,-242,-246,-248,133,-250,-251,-243,-249,-12,133,133,-11,133,133,133,133,-234,-233,133,-231,133,133,-217,133,-230,133,-84,-218,133,133,133,-337,-337,-198,133,133,133,-337,-284,-229,-232,133,-221,133,-83,-219,-68,133,-28,-337,133,-11,133,133,-220,133,133,133,-284,133,133,133,-337,133,-225,-224,-222,-84,133,133,133,-226,-223,133,-228,-227,]),'FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,134,-335,-28,-182,-27,134,-337,-87,-72,-337,134,-286,-285,134,134,-283,-287,-288,134,-284,134,134,134,-336,-183,134,134,-28,-337,134,-28,-337,-337,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,-337,-76,-79,-82,-75,134,-77,134,134,-81,-215,-214,-80,-216,134,-78,134,134,-69,-284,134,134,-284,134,134,-244,-247,-245,-241,-242,-246,-248,134,-250,-251,-243,-249,-12,134,134,-11,134,134,134,134,-234,-233,134,-231,134,134,-217,134,-230,134,-84,-218,134,134,134,-337,-337,-198,134,134,134,-337,-284,-229,-232,134,-221,134,-83,-219,-68,134,-28,-337,134,-11,134,134,-220,134,134,134,-284,134,134,134,-337,134,-225,-224,-222,-84,134,134,134,-226,-223,134,-228,-227,]),'MINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,135,-335,-28,-182,-27,135,-337,-87,-72,-337,135,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,135,-327,135,-283,-287,-325,-304,-322,-302,-255,-315,-289,245,-328,-316,-288,-329,-320,-276,-323,135,-284,135,135,-312,135,-336,-183,135,135,-28,-337,135,-28,-337,-274,-337,135,-326,135,-280,135,-277,-334,-332,-331,-333,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,-298,-297,135,135,-279,-278,-337,-76,-79,-82,-75,135,-77,135,135,-81,-215,-214,-80,-216,135,-78,-312,135,135,-69,-284,135,135,-284,135,135,-244,-247,-245,-241,-242,-246,-248,135,-250,-251,-243,-249,-12,135,135,-11,245,245,245,-260,245,245,245,-259,245,245,-257,-256,245,245,245,245,245,-258,-296,-295,-294,-293,-292,-305,135,135,135,135,-234,-233,135,-231,135,135,-217,135,-230,135,-84,-218,135,135,135,-337,-337,-198,135,-281,-282,135,-290,-291,135,-275,-337,-284,-229,-232,135,-221,135,-83,-219,-68,135,-28,-337,135,-11,135,135,-220,135,135,135,-284,135,135,-306,135,-337,-299,135,-225,-224,-222,-84,-300,135,135,135,-226,-223,135,-228,-227,]),'RPAREN':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,71,73,76,77,80,81,82,86,96,98,100,101,103,104,105,106,107,109,111,118,125,127,129,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,157,158,159,160,161,162,163,164,166,167,168,169,176,177,178,183,187,191,198,199,200,203,207,208,209,210,211,212,213,215,216,221,222,224,225,230,232,234,235,236,237,238,240,241,261,263,266,268,269,270,271,272,273,274,275,276,277,278,279,280,281,283,294,312,314,316,317,328,340,341,342,343,344,345,346,347,348,355,356,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,408,409,411,414,415,416,417,418,422,433,439,442,443,448,449,452,453,454,457,458,460,461,462,463,464,465,468,476,478,480,482,483,486,487,489,490,492,495,501,503,507,511,512,516,517,518,519,524,525,526,527,529,530,531,532,544,545,547,551,553,556,559,560,563,565,566,567,570,571,572,573,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,-98,-54,-131,-37,-95,-101,-97,-53,-147,-146,-167,-166,-28,-180,-182,-27,200,-100,-126,-337,216,-55,-337,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,240,-255,241,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,312,-149,-336,-183,-181,-30,332,340,-17,341,-186,-337,-18,-184,-191,-38,355,356,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,407,-279,-143,411,413,-235,-278,-203,-140,-204,-1,-337,-141,-145,-2,-206,-14,-127,-153,-151,-148,-168,-36,-35,-337,-190,-204,-56,-188,-45,-189,-44,-43,476,477,478,479,480,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-310,483,-305,-205,-23,-24,489,490,-337,-13,-218,-152,-150,-170,-169,510,-31,-34,-204,-57,-337,-192,-185,-187,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,532,535,537,539,-33,-32,544,545,-41,-40,-254,-311,547,-307,-209,-208,-210,-212,-51,-50,-306,-299,-337,568,-46,-49,-308,-300,-337,574,-48,-47,-309,577,]),'STRUCT':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[24,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,24,-65,-102,-337,-131,-108,-63,-129,24,-29,-62,-70,-52,-337,-337,-337,-130,24,-71,-103,-337,-9,-131,-91,-10,24,24,-53,-337,-88,24,24,-93,24,-335,24,-182,24,-87,-90,-94,-92,-61,-72,24,24,24,-73,24,-89,24,24,24,-159,-160,-156,-336,-183,-30,24,-74,24,24,24,24,-174,-175,24,24,-76,-79,-82,-75,-77,24,-81,-215,-214,-80,-216,-78,-127,24,24,-157,-69,-36,-35,24,24,24,-234,-233,24,-231,-217,-230,-81,-84,-218,-158,-31,-34,24,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LONG':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[23,-337,-113,-128,23,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,23,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,23,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,23,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,23,-131,-95,-101,-97,23,-53,-126,23,-88,23,23,-93,23,-147,-335,-146,23,-167,-166,-182,-100,-126,23,-87,-90,-94,-92,-61,-72,23,-144,-142,23,23,23,-73,23,-89,23,23,23,-149,-159,-160,-156,-336,23,-183,-30,23,23,-74,23,23,23,23,-174,-175,23,-143,-140,23,-141,-145,-76,-79,-82,-75,-77,23,-81,-215,-214,-80,-216,-78,-127,23,-153,23,-151,-148,-157,-168,-69,-36,-35,23,23,23,-234,-233,23,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,23,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,137,-335,-28,-182,-27,137,-337,-87,-72,-337,137,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,137,-327,137,-283,-287,-325,-304,-322,-302,-255,-315,-289,249,-328,-316,-288,-329,-320,-276,-323,137,-284,137,137,-312,137,-336,-183,137,137,-28,-337,137,-28,-337,-274,-337,137,-326,137,-280,137,-277,-334,-332,-331,-333,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,137,-298,-297,137,137,-279,-278,-337,-76,-79,-82,-75,137,-77,137,137,-81,-215,-214,-80,-216,137,-78,-312,137,137,-69,-284,137,137,-284,137,137,-244,-247,-245,-241,-242,-246,-248,137,-250,-251,-243,-249,-12,137,137,-11,249,249,249,-260,249,249,249,-259,249,249,-257,-256,249,249,249,249,249,-258,-296,-295,-294,-293,-292,-305,137,137,137,137,-234,-233,137,-231,137,137,-217,137,-230,137,-84,-218,137,137,137,-337,-337,-198,137,-281,-282,137,-290,-291,137,-275,-337,-284,-229,-232,137,-221,137,-83,-219,-68,137,-28,-337,137,-11,137,137,-220,137,137,137,-284,137,137,-306,137,-337,-299,137,-225,-224,-222,-84,-300,137,137,137,-226,-223,137,-228,-227,]),'ELLIPSIS':([350,],[462,]),'U32STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,139,-335,-28,-182,-27,139,-337,-87,-72,-337,139,-286,-285,-330,139,-327,139,-283,-287,235,-328,-288,-329,139,-284,139,139,139,-336,-183,139,139,-28,-337,139,-28,-337,-337,139,139,139,-334,-332,-331,-333,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,139,-337,-76,-79,-82,-75,139,-77,139,139,-81,-215,-214,-80,-216,139,-78,139,139,-69,-284,139,139,-284,139,139,-244,-247,-245,-241,-242,-246,-248,139,-250,-251,-243,-249,-12,139,139,-11,139,139,139,139,-234,-233,139,-231,139,139,-217,139,-230,139,-84,-218,139,139,139,-337,-337,-198,139,139,139,-337,-284,-229,-232,139,-221,139,-83,-219,-68,139,-28,-337,139,-11,139,139,-220,139,139,139,-284,139,139,139,-337,139,-225,-224,-222,-84,139,139,139,-226,-223,139,-228,-227,]),'GT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,250,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,250,-262,-260,-264,250,-263,-259,-266,250,-257,-256,-265,250,250,250,250,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'GOTO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,287,-336,-76,-79,-82,-75,-77,287,-81,-215,-214,-80,-216,287,-78,-69,-234,-233,-231,287,-217,-230,287,-84,-218,287,-229,-232,-221,287,-83,-219,-68,287,-220,287,287,-225,-224,-222,-84,287,287,-226,-223,287,-228,-227,]),'ENUM':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[32,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,32,-65,-102,-337,-131,-108,-63,-129,32,-29,-62,-70,-52,-337,-337,-337,-130,32,-71,-103,-337,-9,-131,-91,-10,32,32,-53,-337,-88,32,32,-93,32,-335,32,-182,32,-87,-90,-94,-92,-61,-72,32,32,32,-73,32,-89,32,32,32,-159,-160,-156,-336,-183,-30,32,-74,32,32,32,32,-174,-175,32,32,-76,-79,-82,-75,-77,32,-81,-215,-214,-80,-216,-78,-127,32,32,-157,-69,-36,-35,32,32,32,-234,-233,32,-231,-217,-230,-81,-84,-218,-158,-31,-34,32,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PERIOD':([97,132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,227,230,235,236,237,238,261,263,310,371,376,402,403,404,405,407,411,470,472,474,482,483,488,520,526,527,547,550,551,563,565,572,],[-335,-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,264,-323,-312,-336,372,-326,-334,-332,-331,-333,-298,-297,-312,-199,372,-296,-295,-294,-293,-292,-305,-202,372,-200,-290,-291,372,-201,548,-307,-306,372,-299,-308,-300,-309,]),'GE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,254,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,254,-262,-260,-264,254,-263,-259,-266,254,-257,-256,-265,254,254,254,254,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_DEC':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,140,-335,-28,-182,-27,140,-337,-87,-72,-337,140,-286,-285,140,140,-283,-287,-288,140,-284,140,140,140,-336,-183,140,140,-28,-337,140,-28,-337,-337,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,140,-337,-76,-79,-82,-75,140,-77,140,140,-81,-215,-214,-80,-216,140,-78,140,140,-69,-284,140,140,-284,140,140,-244,-247,-245,-241,-242,-246,-248,140,-250,-251,-243,-249,-12,140,140,-11,140,140,140,140,-234,-233,140,-231,140,140,-217,140,-230,140,-84,-218,140,140,140,-337,-337,-198,140,140,140,-337,-284,-229,-232,140,-221,140,-83,-219,-68,140,-28,-337,140,-11,140,140,-220,140,140,140,-284,140,140,140,-337,140,-225,-224,-222,-84,140,140,140,-226,-223,140,-228,-227,]),'ARROW':([132,133,134,136,138,139,140,141,143,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,230,235,236,237,238,261,263,310,402,403,404,405,407,411,482,483,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,262,-323,-312,-336,-326,-334,-332,-331,-333,-298,-297,-312,-296,-295,-294,-293,-292,-305,-290,-291,-306,-299,-300,]),'_STATIC_ASSERT':([0,14,16,17,19,25,38,45,47,59,61,97,119,123,124,180,181,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[41,-64,-60,-67,-66,-65,-63,-62,-70,41,-71,-335,-87,-61,-72,-73,41,-336,-74,-76,-79,-82,-75,-77,41,-81,-215,-214,-80,-216,41,-78,-69,-234,-233,-231,41,-217,-230,41,-84,-218,41,-229,-232,-221,41,-83,-219,-68,41,-220,41,41,-225,-224,-222,-84,41,41,-226,-223,41,-228,-227,]),'CHAR':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[46,-337,-113,-128,46,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,46,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,46,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,46,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,46,-131,-95,-101,-97,46,-53,-126,46,-88,46,46,-93,46,-147,-335,-146,46,-167,-166,-182,-100,-126,46,-87,-90,-94,-92,-61,-72,46,-144,-142,46,46,46,-73,46,-89,46,46,46,-149,-159,-160,-156,-336,46,-183,-30,46,46,-74,46,46,46,46,-174,-175,46,-143,-140,46,-141,-145,-76,-79,-82,-75,-77,46,-81,-215,-214,-80,-216,-78,-127,46,-153,46,-151,-148,-157,-168,-69,-36,-35,46,46,46,-234,-233,46,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,46,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'HEX_FLOAT_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,141,-335,-28,-182,-27,141,-337,-87,-72,-337,141,-286,-285,141,141,-283,-287,-288,141,-284,141,141,141,-336,-183,141,141,-28,-337,141,-28,-337,-337,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,141,-337,-76,-79,-82,-75,141,-77,141,141,-81,-215,-214,-80,-216,141,-78,141,141,-69,-284,141,141,-284,141,141,-244,-247,-245,-241,-242,-246,-248,141,-250,-251,-243,-249,-12,141,141,-11,141,141,141,141,-234,-233,141,-231,141,141,-217,141,-230,141,-84,-218,141,141,141,-337,-337,-198,141,141,141,-337,-284,-229,-232,141,-221,141,-83,-219,-68,141,-28,-337,141,-11,141,141,-220,141,141,141,-284,141,141,141,-337,141,-225,-224,-222,-84,141,141,141,-226,-223,141,-228,-227,]),'DOUBLE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[50,-337,-113,-128,50,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,50,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,50,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,50,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,50,-131,-95,-101,-97,50,-53,-126,50,-88,50,50,-93,50,-147,-335,-146,50,-167,-166,-182,-100,-126,50,-87,-90,-94,-92,-61,-72,50,-144,-142,50,50,50,-73,50,-89,50,50,50,-149,-159,-160,-156,-336,50,-183,-30,50,50,-74,50,50,50,50,-174,-175,50,-143,-140,50,-141,-145,-76,-79,-82,-75,-77,50,-81,-215,-214,-80,-216,-78,-127,50,-153,50,-151,-148,-157,-168,-69,-36,-35,50,50,50,-234,-233,50,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,50,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MINUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,358,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'INT_CONST_OCT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,145,-335,-28,-182,-27,145,-337,-87,-72,-337,145,-286,-285,145,145,-283,-287,-288,145,-284,145,145,145,-336,-183,145,145,-28,-337,145,-28,-337,-337,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,145,-337,-76,-79,-82,-75,145,-77,145,145,-81,-215,-214,-80,-216,145,-78,145,145,-69,-284,145,145,-284,145,145,-244,-247,-245,-241,-242,-246,-248,145,-250,-251,-243,-249,-12,145,145,-11,145,145,145,145,-234,-233,145,-231,145,145,-217,145,-230,145,-84,-218,145,145,145,-337,-337,-198,145,145,145,-337,-284,-229,-232,145,-221,145,-83,-219,-68,145,-28,-337,145,-11,145,145,-220,145,145,145,-284,145,145,145,-337,145,-225,-224,-222,-84,145,145,145,-226,-223,145,-228,-227,]),'TIMESEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,367,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'OR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,259,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,259,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,259,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SHORT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[2,-337,-113,-128,2,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,2,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,2,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,2,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,2,-131,-95,-101,-97,2,-53,-126,2,-88,2,2,-93,2,-147,-335,-146,2,-167,-166,-182,-100,-126,2,-87,-90,-94,-92,-61,-72,2,-144,-142,2,2,2,-73,2,-89,2,2,2,-149,-159,-160,-156,-336,2,-183,-30,2,2,-74,2,2,2,2,-174,-175,2,-143,-140,2,-141,-145,-76,-79,-82,-75,-77,2,-81,-215,-214,-80,-216,-78,-127,2,-153,2,-151,-148,-157,-168,-69,-36,-35,2,2,2,-234,-233,2,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,2,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RETURN':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,290,-336,-76,-79,-82,-75,-77,290,-81,-215,-214,-80,-216,290,-78,-69,-234,-233,-231,290,-217,-230,290,-84,-218,290,-229,-232,-221,290,-83,-219,-68,290,-220,290,290,-225,-224,-222,-84,290,290,-226,-223,290,-228,-227,]),'RSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,368,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'_ALIGNAS':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,109,111,118,119,123,124,129,142,147,174,177,180,181,182,184,185,186,187,188,189,190,191,192,200,211,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[8,8,-113,-128,8,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,8,-120,-115,-65,-102,8,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,8,8,-119,8,-114,-130,8,-118,-71,-103,8,-131,-96,-98,8,-131,-95,-101,-97,8,-53,8,8,-88,8,8,-147,-335,-146,8,-167,-166,-100,-126,8,-87,-61,-72,8,-144,-142,8,8,-73,8,-89,8,8,8,-149,-159,-160,-156,-336,8,-30,8,-74,8,8,8,8,-174,-175,8,-143,-140,8,-141,-145,-76,-79,-82,-75,-77,8,-81,-215,-214,-80,-216,-78,-127,8,-153,8,-151,-148,-157,-168,-69,-36,-35,8,8,8,-234,-233,8,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,8,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'RESTRICT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[39,39,-113,-128,39,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,39,-120,-115,-65,-102,39,-131,-108,-238,-111,39,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,39,39,-119,39,-114,-130,39,-118,-71,-103,39,-131,-96,-98,39,-131,-95,-101,-97,39,-53,39,39,-88,39,39,-147,-335,-146,39,-167,-166,39,-182,-100,-126,39,39,-87,-61,-72,39,39,-144,-142,39,39,39,-73,39,-89,39,39,39,-149,-159,-160,-156,-336,39,-183,-30,39,39,39,39,39,-74,39,39,39,39,-174,-175,39,-143,-140,39,-141,-145,39,-76,-79,-82,-75,-77,39,-81,-215,-214,-80,-216,-78,-127,39,-153,39,-151,-148,-157,-168,-69,-36,-35,39,39,39,-234,-233,39,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,39,39,-229,-232,-221,-83,-219,-68,-33,-32,39,39,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'STATIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,105,109,111,117,118,119,123,124,128,129,180,181,182,187,191,198,200,205,211,219,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,536,554,555,557,558,575,576,578,579,],[10,10,-113,-128,10,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,10,-120,-115,-65,-102,10,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,10,10,-119,10,-114,-130,10,-118,-71,-103,10,-131,-96,-98,10,-131,-95,-101,-97,-53,10,10,-88,10,-147,-335,-146,-167,-166,-182,-100,-126,206,10,-87,-61,-72,220,10,-73,10,-89,-149,-336,-183,-30,338,10,353,-74,-174,-175,10,-76,-79,-82,-75,-77,10,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,10,10,10,-234,-233,10,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,515,10,-229,-232,-221,-83,-219,-68,-33,-32,542,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIZEOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,146,-335,-28,-182,-27,146,-337,-87,-72,-337,146,-286,-285,146,146,-283,-287,-288,146,-284,146,146,146,-336,-183,146,146,-28,-337,146,-28,-337,-337,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,146,-337,-76,-79,-82,-75,146,-77,146,146,-81,-215,-214,-80,-216,146,-78,146,146,-69,-284,146,146,-284,146,146,-244,-247,-245,-241,-242,-246,-248,146,-250,-251,-243,-249,-12,146,146,-11,146,146,146,146,-234,-233,146,-231,146,146,-217,146,-230,146,-84,-218,146,146,146,-337,-337,-198,146,146,146,-337,-284,-229,-232,146,-221,146,-83,-219,-68,146,-28,-337,146,-11,146,146,-220,146,146,146,-284,146,146,146,-337,146,-225,-224,-222,-84,146,146,146,-226,-223,146,-228,-227,]),'UNSIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[22,-337,-113,-128,22,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,22,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,22,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,22,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,22,-131,-95,-101,-97,22,-53,-126,22,-88,22,22,-93,22,-147,-335,-146,22,-167,-166,-182,-100,-126,22,-87,-90,-94,-92,-61,-72,22,-144,-142,22,22,22,-73,22,-89,22,22,22,-149,-159,-160,-156,-336,22,-183,-30,22,22,-74,22,22,22,22,-174,-175,22,-143,-140,22,-141,-145,-76,-79,-82,-75,-77,22,-81,-215,-214,-80,-216,-78,-127,22,-153,22,-151,-148,-157,-168,-69,-36,-35,22,22,22,-234,-233,22,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,22,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'UNION':([0,1,3,7,10,11,13,14,16,17,19,20,21,25,26,27,29,30,38,39,40,42,45,47,48,52,53,55,58,59,61,62,63,64,65,66,67,75,85,86,87,90,91,93,94,95,97,99,105,118,119,120,121,122,123,124,129,172,174,180,181,182,184,185,186,188,189,190,191,198,200,214,223,229,231,233,239,240,241,267,278,284,285,286,289,291,298,300,301,302,303,305,308,312,313,315,318,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,446,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[28,-337,-128,-106,-104,-107,-105,-64,-60,-67,-66,-109,28,-65,-102,-337,-131,-108,-63,-129,28,-29,-62,-70,-52,-337,-337,-337,-130,28,-71,-103,-337,-9,-131,-91,-10,28,28,-53,-337,-88,28,28,-93,28,-335,28,-182,28,-87,-90,-94,-92,-61,-72,28,28,28,-73,28,-89,28,28,28,-159,-160,-156,-336,-183,-30,28,-74,28,28,28,28,-174,-175,28,28,-76,-79,-82,-75,-77,28,-81,-215,-214,-80,-216,-78,-127,28,28,-157,-69,-36,-35,28,28,28,-234,-233,28,-231,-217,-230,-81,-84,-218,-158,-31,-34,28,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'COLON':([2,3,5,6,12,22,23,33,34,36,39,42,43,44,46,48,49,50,54,56,58,60,73,74,76,77,86,96,98,100,101,111,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,187,191,192,200,216,224,225,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,295,310,312,314,316,317,324,328,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,407,411,431,442,443,445,448,449,453,454,464,465,468,476,478,480,482,483,486,487,511,512,518,519,524,547,551,565,],[-113,-128,-124,-110,-125,-120,-115,-238,-111,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-54,-179,-131,-37,-53,-147,-146,-167,-166,-126,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-149,-336,319,-30,-38,-274,-239,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,429,440,-127,-153,-151,-148,447,-168,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,481,-270,-258,-296,-295,-294,-293,-292,-305,502,-152,-150,319,-170,-169,-31,-34,-39,-42,-240,-237,-281,-282,-290,-291,-236,-275,-33,-32,-41,-40,-254,-306,-299,-300,]),'$end':([0,9,14,16,17,19,25,38,45,47,57,59,61,119,123,124,180,191,223,332,439,510,],[-337,0,-64,-60,-67,-66,-65,-63,-62,-70,-59,-58,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'WSTRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,148,-335,-28,-182,-27,148,-337,-87,-72,-337,148,-286,-285,-330,148,-327,148,-283,-287,237,-328,-288,-329,148,-284,148,148,148,-336,-183,148,148,-28,-337,148,-28,-337,-337,148,148,148,-334,-332,-331,-333,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,148,-337,-76,-79,-82,-75,148,-77,148,148,-81,-215,-214,-80,-216,148,-78,148,148,-69,-284,148,148,-284,148,148,-244,-247,-245,-241,-242,-246,-248,148,-250,-251,-243,-249,-12,148,148,-11,148,148,148,148,-234,-233,148,-231,148,148,-217,148,-230,148,-84,-218,148,148,148,-337,-337,-198,148,148,148,-337,-284,-229,-232,148,-221,148,-83,-219,-68,148,-28,-337,148,-11,148,148,-220,148,148,148,-284,148,148,148,-337,148,-225,-224,-222,-84,148,148,148,-226,-223,148,-228,-227,]),'DIVIDE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,252,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,252,252,252,252,252,252,252,252,252,252,-257,-256,252,252,252,252,252,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'FOR':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,292,-336,-76,-79,-82,-75,-77,292,-81,-215,-214,-80,-216,292,-78,-69,-234,-233,-231,292,-217,-230,292,-84,-218,292,-229,-232,-221,292,-83,-219,-68,292,-220,292,292,-225,-224,-222,-84,292,292,-226,-223,292,-228,-227,]),'PLUSPLUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,149,-335,-28,-182,-27,149,-337,-87,-72,-337,149,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,149,-327,149,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,263,-323,149,-284,149,149,-312,149,-336,-183,149,149,-28,-337,149,-28,-337,-337,149,-326,149,149,-334,-332,-331,-333,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,149,-298,-297,149,149,-337,-76,-79,-82,-75,149,-77,149,149,-81,-215,-214,-80,-216,149,-78,-312,149,149,-69,-284,149,149,-284,149,149,-244,-247,-245,-241,-242,-246,-248,149,-250,-251,-243,-249,-12,149,149,-11,-296,-295,-294,-293,-292,-305,149,149,149,149,-234,-233,149,-231,149,149,-217,149,-230,149,-84,-218,149,149,149,-337,-337,-198,149,149,-290,-291,149,-337,-284,-229,-232,149,-221,149,-83,-219,-68,149,-28,-337,149,-11,149,149,-220,149,149,149,-284,149,149,-306,149,-337,-299,149,-225,-224,-222,-84,-300,149,149,149,-226,-223,149,-228,-227,]),'EQUALS':([42,48,73,74,75,77,78,86,110,127,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,179,191,197,200,216,224,230,232,234,235,236,237,238,261,263,268,273,310,340,341,355,356,371,376,402,403,404,405,407,411,453,454,464,465,470,474,478,480,482,483,487,511,512,518,519,520,547,551,565,],[-29,-52,-54,-179,-178,-37,131,-53,201,-55,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-178,-336,329,-30,-38,360,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-36,-35,-44,-43,-199,475,-296,-295,-294,-293,-292,-305,-31,-34,-39,-42,-202,-200,-281,-282,-290,-291,-275,-33,-32,-41,-40,-201,-306,-299,-300,]),'ELSE':([61,124,191,284,285,286,289,291,300,303,308,332,424,425,428,435,437,438,439,496,497,500,505,506,510,536,554,555,557,558,575,576,578,579,],[-71,-72,-336,-76,-79,-82,-75,-77,-81,-80,-78,-69,-234,-233,-231,-230,-81,-84,-218,-229,-232,-221,-83,-219,-68,-220,-225,-224,-222,569,-226,-223,-228,-227,]),'ANDEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,365,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'EQ':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,256,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,256,-262,-260,-264,-268,-263,-259,-266,256,-257,-256,-265,256,-267,256,256,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AND':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,144,145,146,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,224,227,229,230,231,232,233,234,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,273,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,150,-335,-28,-182,-27,150,-337,-87,-72,-337,150,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-274,-314,150,-327,150,-283,-287,-325,-304,-322,-302,-255,-315,-289,257,-328,-316,-288,-329,-320,-276,-323,150,-284,150,150,-312,150,-336,-183,150,150,-28,-337,150,-28,-337,-274,-337,150,-326,150,-280,150,-277,-334,-332,-331,-333,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,150,-298,-297,150,150,-279,-278,-337,-76,-79,-82,-75,150,-77,150,150,-81,-215,-214,-80,-216,150,-78,-312,150,150,-69,-284,150,150,-284,150,150,-244,-247,-245,-241,-242,-246,-248,150,-250,-251,-243,-249,-12,150,150,-11,-261,257,-262,-260,-264,-268,-263,-259,-266,257,-257,-256,-265,257,-267,-269,257,-258,-296,-295,-294,-293,-292,-305,150,150,150,150,-234,-233,150,-231,150,150,-217,150,-230,150,-84,-218,150,150,150,-337,-337,-198,150,-281,-282,150,-290,-291,150,-275,-337,-284,-229,-232,150,-221,150,-83,-219,-68,150,-28,-337,150,-11,150,150,-220,150,150,150,-284,150,150,-306,150,-337,-299,150,-225,-224,-222,-84,-300,150,150,150,-226,-223,150,-228,-227,]),'TYPEID':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,104,105,106,109,111,118,119,120,121,122,123,124,126,129,142,147,172,174,180,181,182,184,185,186,187,188,189,190,191,192,198,199,200,202,211,214,223,229,231,233,239,240,241,262,264,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,344,350,422,424,425,427,428,432,435,437,438,439,442,443,445,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[33,-337,-113,-128,77,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,33,-120,-115,-154,-65,-102,-126,-155,-131,-108,96,100,-238,-111,-337,-122,-63,-129,33,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,33,-118,-71,-103,-337,-9,-131,-91,-10,-96,77,-98,77,33,-131,-95,-101,-97,33,-53,-126,77,-88,33,33,-93,33,-147,-335,-146,33,-167,-166,-28,-180,-182,-27,-100,-126,33,-87,-90,-94,-92,-61,-72,77,33,-144,-142,33,33,-73,33,-89,33,33,33,-149,-159,-160,-156,-336,77,-183,-181,-30,77,347,33,-74,33,33,33,33,-174,-175,402,404,33,-143,-140,33,-141,-145,-76,-79,-82,-75,-77,33,-81,-215,-214,-80,-216,-78,-127,33,-153,33,-151,-148,-157,-168,-69,-36,-35,33,347,33,33,-234,-233,33,-231,-217,-230,-81,-84,-218,-152,-150,77,-158,-170,-169,-31,-34,33,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LBRACE':([21,24,28,31,32,42,48,61,75,86,88,90,92,93,96,97,98,100,101,119,124,130,131,181,182,191,200,201,227,229,284,285,286,289,291,298,300,301,302,303,305,307,308,332,340,341,369,375,377,413,424,425,428,429,432,435,437,438,439,440,453,454,472,475,477,478,479,488,496,497,500,502,505,506,510,511,512,521,522,535,536,537,539,550,554,555,557,558,569,574,575,576,577,578,579,],[-337,-154,-155,97,97,-29,-52,-71,-337,-53,-7,-88,97,-8,97,-335,97,97,97,-87,-72,97,97,97,-89,-336,-30,97,-337,97,-76,-79,-82,-75,-77,97,-81,-215,-214,-80,-216,97,-78,-69,-36,-35,-12,97,-11,97,-234,-233,-231,97,-217,-230,97,-84,-218,97,-31,-34,-337,-198,97,97,97,-337,-229,-232,-221,97,-83,-219,-68,-33,-32,97,-11,97,-220,97,97,-337,-225,-224,-222,-84,97,97,-226,-223,97,-228,-227,]),'PPHASH':([0,14,16,17,19,25,38,45,47,59,61,119,123,124,180,191,223,332,439,510,],[47,-64,-60,-67,-66,-65,-63,-62,-70,47,-71,-87,-61,-72,-73,-336,-74,-69,-218,-68,]),'INT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[56,-337,-113,-128,56,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,56,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,56,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,56,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,56,-131,-95,-101,-97,56,-53,-126,56,-88,56,56,-93,56,-147,-335,-146,56,-167,-166,-182,-100,-126,56,-87,-90,-94,-92,-61,-72,56,-144,-142,56,56,56,-73,56,-89,56,56,56,-149,-159,-160,-156,-336,56,-183,-30,56,56,-74,56,56,56,56,-174,-175,56,-143,-140,56,-141,-145,-76,-79,-82,-75,-77,56,-81,-215,-214,-80,-216,-78,-127,56,-153,56,-151,-148,-157,-168,-69,-36,-35,56,56,56,-234,-233,56,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,56,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'SIGNED':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[54,-337,-113,-128,54,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,54,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,54,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,54,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,54,-131,-95,-101,-97,54,-53,-126,54,-88,54,54,-93,54,-147,-335,-146,54,-167,-166,-182,-100,-126,54,-87,-90,-94,-92,-61,-72,54,-144,-142,54,54,54,-73,54,-89,54,54,54,-149,-159,-160,-156,-336,54,-183,-30,54,54,-74,54,54,54,54,-174,-175,54,-143,-140,54,-141,-145,-76,-79,-82,-75,-77,54,-81,-215,-214,-80,-216,-78,-127,54,-153,54,-151,-148,-157,-168,-69,-36,-35,54,54,54,-234,-233,54,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,54,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CONTINUE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,293,-336,-76,-79,-82,-75,-77,293,-81,-215,-214,-80,-216,293,-78,-69,-234,-233,-231,293,-217,-230,293,-84,-218,293,-229,-232,-221,293,-83,-219,-68,293,-220,293,293,-225,-224,-222,-84,293,293,-226,-223,293,-228,-227,]),'NOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,151,-335,-28,-182,-27,151,-337,-87,-72,-337,151,-286,-285,151,151,-283,-287,-288,151,-284,151,151,151,-336,-183,151,151,-28,-337,151,-28,-337,-337,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,151,-337,-76,-79,-82,-75,151,-77,151,151,-81,-215,-214,-80,-216,151,-78,151,151,-69,-284,151,151,-284,151,151,-244,-247,-245,-241,-242,-246,-248,151,-250,-251,-243,-249,-12,151,151,-11,151,151,151,151,-234,-233,151,-231,151,151,-217,151,-230,151,-84,-218,151,151,151,-337,-337,-198,151,151,151,-337,-284,-229,-232,151,-221,151,-83,-219,-68,151,-28,-337,151,-11,151,151,-220,151,151,151,-284,151,151,151,-337,151,-225,-224,-222,-84,151,151,151,-226,-223,151,-228,-227,]),'OREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,366,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'MOD':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,260,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,260,260,260,260,260,260,260,260,260,260,-257,-256,260,260,260,260,260,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,242,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,242,-262,-260,242,242,242,-259,242,242,-257,-256,242,242,242,242,242,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'DEFAULT':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,295,-336,-76,-79,-82,-75,-77,295,-81,-215,-214,-80,-216,295,-78,-69,-234,-233,-231,295,-217,-230,295,-84,-218,295,-229,-232,-221,295,-83,-219,-68,295,-220,295,295,-225,-224,-222,-84,295,295,-226,-223,295,-228,-227,]),'_NORETURN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[20,20,-113,-128,20,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,20,-120,-115,-65,-102,20,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,20,20,-119,20,-114,-130,20,-118,-71,-103,20,-131,-96,-98,20,-131,-95,-101,-97,-53,20,20,-88,20,-147,-335,-146,-167,-166,-100,-126,20,-87,-61,-72,20,-73,20,-89,-149,-336,-30,20,-74,-174,-175,20,-76,-79,-82,-75,-77,20,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,20,20,20,-234,-233,20,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,20,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'__INT128':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[43,-337,-113,-128,43,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,43,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,43,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,43,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,43,-131,-95,-101,-97,43,-53,-126,43,-88,43,43,-93,43,-147,-335,-146,43,-167,-166,-182,-100,-126,43,-87,-90,-94,-92,-61,-72,43,-144,-142,43,43,43,-73,43,-89,43,43,43,-149,-159,-160,-156,-336,43,-183,-30,43,43,-74,43,43,43,43,-174,-175,43,-143,-140,43,-141,-145,-76,-79,-82,-75,-77,43,-81,-215,-214,-80,-216,-78,-127,43,-153,43,-151,-148,-157,-168,-69,-36,-35,43,43,43,-234,-233,43,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,43,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'WHILE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,436,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,296,-336,-76,-79,-82,-75,-77,296,-81,-215,-214,-80,-216,296,-78,-69,-234,-233,-231,296,-217,-230,504,296,-84,-218,296,-229,-232,-221,296,-83,-219,-68,296,-220,296,296,-225,-224,-222,-84,296,296,-226,-223,296,-228,-227,]),'U8CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,154,-335,-28,-182,-27,154,-337,-87,-72,-337,154,-286,-285,154,154,-283,-287,-288,154,-284,154,154,154,-336,-183,154,154,-28,-337,154,-28,-337,-337,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,154,-337,-76,-79,-82,-75,154,-77,154,154,-81,-215,-214,-80,-216,154,-78,154,154,-69,-284,154,154,-284,154,154,-244,-247,-245,-241,-242,-246,-248,154,-250,-251,-243,-249,-12,154,154,-11,154,154,154,154,-234,-233,154,-231,154,154,-217,154,-230,154,-84,-218,154,154,154,-337,-337,-198,154,154,154,-337,-284,-229,-232,154,-221,154,-83,-219,-68,154,-28,-337,154,-11,154,154,-220,154,154,154,-284,154,154,154,-337,154,-225,-224,-222,-84,154,154,154,-226,-223,154,-228,-227,]),'_ALIGNOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,155,-335,-28,-182,-27,155,-337,-87,-72,-337,155,-286,-285,155,155,-283,-287,-288,155,-284,155,155,155,-336,-183,155,155,-28,-337,155,-28,-337,-337,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,155,-337,-76,-79,-82,-75,155,-77,155,155,-81,-215,-214,-80,-216,155,-78,155,155,-69,-284,155,155,-284,155,155,-244,-247,-245,-241,-242,-246,-248,155,-250,-251,-243,-249,-12,155,155,-11,155,155,155,155,-234,-233,155,-231,155,155,-217,155,-230,155,-84,-218,155,155,155,-337,-337,-198,155,155,155,-337,-284,-229,-232,155,-221,155,-83,-219,-68,155,-28,-337,155,-11,155,155,-220,155,155,155,-284,155,155,155,-337,155,-225,-224,-222,-84,155,155,155,-226,-223,155,-228,-227,]),'EXTERN':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[13,13,-113,-128,13,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,13,-120,-115,-65,-102,13,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,13,13,-119,13,-114,-130,13,-118,-71,-103,13,-131,-96,-98,13,-131,-95,-101,-97,-53,13,13,-88,13,-147,-335,-146,-167,-166,-100,-126,13,-87,-61,-72,13,-73,13,-89,-149,-336,-30,13,-74,-174,-175,13,-76,-79,-82,-75,-77,13,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,13,13,13,-234,-233,13,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,13,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'CASE':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,297,-336,-76,-79,-82,-75,-77,297,-81,-215,-214,-80,-216,297,-78,-69,-234,-233,-231,297,-217,-230,297,-84,-218,297,-229,-232,-221,297,-83,-219,-68,297,-220,297,297,-225,-224,-222,-84,297,297,-226,-223,297,-228,-227,]),'LAND':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,255,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,255,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'REGISTER':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[62,62,-113,-128,62,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,62,-120,-115,-65,-102,62,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,62,62,-119,62,-114,-130,62,-118,-71,-103,62,-131,-96,-98,62,-131,-95,-101,-97,-53,62,62,-88,62,-147,-335,-146,-167,-166,-100,-126,62,-87,-61,-72,62,-73,62,-89,-149,-336,-30,62,-74,-174,-175,62,-76,-79,-82,-75,-77,62,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,62,62,62,-234,-233,62,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,62,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'MODEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,359,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'NE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,247,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,247,-262,-260,-264,-268,-263,-259,-266,247,-257,-256,-265,247,-267,247,247,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SWITCH':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,299,-336,-76,-79,-82,-75,-77,299,-81,-215,-214,-80,-216,299,-78,-69,-234,-233,-231,299,-217,-230,299,-84,-218,299,-229,-232,-221,299,-83,-219,-68,299,-220,299,299,-225,-224,-222,-84,299,299,-226,-223,299,-228,-227,]),'INT_CONST_HEX':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,160,-335,-28,-182,-27,160,-337,-87,-72,-337,160,-286,-285,160,160,-283,-287,-288,160,-284,160,160,160,-336,-183,160,160,-28,-337,160,-28,-337,-337,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,-337,-76,-79,-82,-75,160,-77,160,160,-81,-215,-214,-80,-216,160,-78,160,160,-69,-284,160,160,-284,160,160,-244,-247,-245,-241,-242,-246,-248,160,-250,-251,-243,-249,-12,160,160,-11,160,160,160,160,-234,-233,160,-231,160,160,-217,160,-230,160,-84,-218,160,160,160,-337,-337,-198,160,160,160,-337,-284,-229,-232,160,-221,160,-83,-219,-68,160,-28,-337,160,-11,160,160,-220,160,160,160,-284,160,160,160,-337,160,-225,-224,-222,-84,160,160,160,-226,-223,160,-228,-227,]),'_COMPLEX':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[60,-337,-113,-128,60,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,60,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,60,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,60,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,60,-131,-95,-101,-97,60,-53,-126,60,-88,60,60,-93,60,-147,-335,-146,60,-167,-166,-182,-100,-126,60,-87,-90,-94,-92,-61,-72,60,-144,-142,60,60,60,-73,60,-89,60,60,60,-149,-159,-160,-156,-336,60,-183,-30,60,60,-74,60,60,60,60,-174,-175,60,-143,-140,60,-141,-145,-76,-79,-82,-75,-77,60,-81,-215,-214,-80,-216,-78,-127,60,-153,60,-151,-148,-157,-168,-69,-36,-35,60,60,60,-234,-233,60,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,60,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMASTR':([61,],[124,]),'PLUSEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,362,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U32CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,138,-335,-28,-182,-27,138,-337,-87,-72,-337,138,-286,-285,138,138,-283,-287,-288,138,-284,138,138,138,-336,-183,138,138,-28,-337,138,-28,-337,-337,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,138,-337,-76,-79,-82,-75,138,-77,138,138,-81,-215,-214,-80,-216,138,-78,138,138,-69,-284,138,138,-284,138,138,-244,-247,-245,-241,-242,-246,-248,138,-250,-251,-243,-249,-12,138,138,-11,138,138,138,138,-234,-233,138,-231,138,138,-217,138,-230,138,-84,-218,138,138,138,-337,-337,-198,138,138,138,-337,-284,-229,-232,138,-221,138,-83,-219,-68,138,-28,-337,138,-11,138,138,-220,138,138,138,-284,138,138,138,-337,138,-225,-224,-222,-84,138,138,138,-226,-223,138,-228,-227,]),'CONDOP':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,258,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'U8STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,163,-335,-28,-182,-27,163,-337,-87,-72,-337,163,-286,-285,-330,163,-327,163,-283,-287,236,-328,-288,-329,163,-284,163,163,163,-336,-183,163,163,-28,-337,163,-28,-337,-337,163,163,163,-334,-332,-331,-333,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,163,-337,-76,-79,-82,-75,163,-77,163,163,-81,-215,-214,-80,-216,163,-78,163,163,-69,-284,163,163,-284,163,163,-244,-247,-245,-241,-242,-246,-248,163,-250,-251,-243,-249,-12,163,163,-11,163,163,163,163,-234,-233,163,-231,163,163,-217,163,-230,163,-84,-218,163,163,163,-337,-337,-198,163,163,163,-337,-284,-229,-232,163,-221,163,-83,-219,-68,163,-28,-337,163,-11,163,163,-220,163,163,163,-284,163,163,163,-337,163,-225,-224,-222,-84,163,163,163,-226,-223,163,-228,-227,]),'BREAK':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,304,-336,-76,-79,-82,-75,-77,304,-81,-215,-214,-80,-216,304,-78,-69,-234,-233,-231,304,-217,-230,304,-84,-218,304,-229,-232,-221,304,-83,-219,-68,304,-220,304,304,-225,-224,-222,-84,304,304,-226,-223,304,-228,-227,]),'VOLATILE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[58,58,-113,-128,58,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,58,-120,-115,-65,-102,58,-131,-108,-238,-111,58,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,58,58,-119,58,-114,-130,58,-118,-71,-103,58,-131,-96,-98,58,-131,-95,-101,-97,58,-53,58,58,-88,58,58,-147,-335,-146,58,-167,-166,58,-182,-100,-126,58,58,-87,-61,-72,58,58,-144,-142,58,58,58,-73,58,-89,58,58,58,-149,-159,-160,-156,-336,58,-183,-30,58,58,58,58,58,-74,58,58,58,58,-174,-175,58,-143,-140,58,-141,-145,58,-76,-79,-82,-75,-77,58,-81,-215,-214,-80,-216,-78,-127,58,-153,58,-151,-148,-157,-168,-69,-36,-35,58,58,58,-234,-233,58,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,58,58,-229,-232,-221,-83,-219,-68,-33,-32,58,58,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'PPPRAGMA':([0,14,16,17,19,25,38,45,47,59,61,97,99,119,123,124,180,181,184,185,186,188,189,190,191,223,284,285,286,289,291,298,300,301,302,303,305,307,308,313,315,318,332,424,425,428,429,432,435,437,438,439,440,446,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[61,-64,-60,-67,-66,-65,-63,-62,-70,61,-71,-335,61,-87,-61,-72,-73,61,61,61,61,-159,-160,-156,-336,-74,-76,-79,-82,-75,-77,61,-81,-215,-214,-80,-216,61,-78,61,61,-157,-69,-234,-233,-231,61,-217,-230,61,-84,-218,61,-158,-229,-232,-221,61,-83,-219,-68,61,-220,61,61,-225,-224,-222,-84,61,61,-226,-223,61,-228,-227,]),'INLINE':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[30,30,-113,-128,30,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,30,-120,-115,-65,-102,30,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,30,30,-119,30,-114,-130,30,-118,-71,-103,30,-131,-96,-98,30,-131,-95,-101,-97,-53,30,30,-88,30,-147,-335,-146,-167,-166,-100,-126,30,-87,-61,-72,30,-73,30,-89,-149,-336,-30,30,-74,-174,-175,30,-76,-79,-82,-75,-77,30,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,30,30,30,-234,-233,30,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,30,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'INT_CONST_BIN':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,164,-335,-28,-182,-27,164,-337,-87,-72,-337,164,-286,-285,164,164,-283,-287,-288,164,-284,164,164,164,-336,-183,164,164,-28,-337,164,-28,-337,-337,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,164,-337,-76,-79,-82,-75,164,-77,164,164,-81,-215,-214,-80,-216,164,-78,164,164,-69,-284,164,164,-284,164,164,-244,-247,-245,-241,-242,-246,-248,164,-250,-251,-243,-249,-12,164,164,-11,164,164,164,164,-234,-233,164,-231,164,164,-217,164,-230,164,-84,-218,164,164,164,-337,-337,-198,164,164,164,-337,-284,-229,-232,164,-221,164,-83,-219,-68,164,-28,-337,164,-11,164,164,-220,164,164,164,-284,164,164,164,-337,164,-225,-224,-222,-84,164,164,164,-226,-223,164,-228,-227,]),'DO':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,307,-336,-76,-79,-82,-75,-77,307,-81,-215,-214,-80,-216,307,-78,-69,-234,-233,-231,307,-217,-230,307,-84,-218,307,-229,-232,-221,307,-83,-219,-68,307,-220,307,307,-225,-224,-222,-84,307,307,-226,-223,307,-228,-227,]),'LNOT':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,165,-335,-28,-182,-27,165,-337,-87,-72,-337,165,-286,-285,165,165,-283,-287,-288,165,-284,165,165,165,-336,-183,165,165,-28,-337,165,-28,-337,-337,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,165,-337,-76,-79,-82,-75,165,-77,165,165,-81,-215,-214,-80,-216,165,-78,165,165,-69,-284,165,165,-284,165,165,-244,-247,-245,-241,-242,-246,-248,165,-250,-251,-243,-249,-12,165,165,-11,165,165,165,165,-234,-233,165,-231,165,165,-217,165,-230,165,-84,-218,165,165,165,-337,-337,-198,165,165,165,-337,-284,-229,-232,165,-221,165,-83,-219,-68,165,-28,-337,165,-11,165,165,-220,165,165,165,-284,165,165,165,-337,165,-225,-224,-222,-84,165,165,165,-226,-223,165,-228,-227,]),'CONST':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,85,86,87,89,90,93,95,96,97,98,99,100,101,103,105,109,111,117,118,119,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[3,3,-113,-128,3,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,3,-120,-115,-65,-102,3,-131,-108,-238,-111,3,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,3,3,-119,3,-114,-130,3,-118,-71,-103,3,-131,-96,-98,3,-131,-95,-101,-97,3,-53,3,3,-88,3,3,-147,-335,-146,3,-167,-166,3,-182,-100,-126,3,3,-87,-61,-72,3,3,-144,-142,3,3,3,-73,3,-89,3,3,3,-149,-159,-160,-156,-336,3,-183,-30,3,3,3,3,3,-74,3,3,3,3,-174,-175,3,-143,-140,3,-141,-145,3,-76,-79,-82,-75,-77,3,-81,-215,-214,-80,-216,-78,-127,3,-153,3,-151,-148,-157,-168,-69,-36,-35,3,3,3,-234,-233,3,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,3,3,-229,-232,-221,-83,-219,-68,-33,-32,3,3,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LSHIFT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,244,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,244,-262,-260,244,244,244,-259,244,244,-257,-256,244,244,244,244,244,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,243,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,167,-335,-28,-182,-27,167,-337,-87,-72,-337,167,-286,-285,167,167,-283,-287,-288,167,-284,167,167,167,-336,-183,167,167,-28,-337,167,-28,-337,-337,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,167,-337,-76,-79,-82,-75,167,-77,167,167,-81,-215,-214,-80,-216,167,-78,167,167,-69,-284,167,167,-284,167,167,-244,-247,-245,-241,-242,-246,-248,167,-250,-251,-243,-249,-12,167,167,-11,167,167,167,167,-234,-233,167,-231,167,167,-217,167,-230,167,-84,-218,167,167,167,-337,-337,-198,167,167,167,-337,-284,-229,-232,167,-221,167,-83,-219,-68,167,-28,-337,167,-11,167,167,-220,167,167,167,-284,167,167,167,-337,167,-225,-224,-222,-84,167,167,167,-226,-223,167,-228,-227,]),'U16STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,139,146,148,149,150,151,153,163,165,166,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,166,-335,-28,-182,-27,166,-337,-87,-72,-337,166,-286,-285,-330,166,-327,166,-283,-287,238,-328,-288,-329,166,-284,166,166,166,-336,-183,166,166,-28,-337,166,-28,-337,-337,166,166,166,-334,-332,-331,-333,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,166,-337,-76,-79,-82,-75,166,-77,166,166,-81,-215,-214,-80,-216,166,-78,166,166,-69,-284,166,166,-284,166,166,-244,-247,-245,-241,-242,-246,-248,166,-250,-251,-243,-249,-12,166,166,-11,166,166,166,166,-234,-233,166,-231,166,166,-217,166,-230,166,-84,-218,166,166,166,-337,-337,-198,166,166,166,-337,-284,-229,-232,166,-221,166,-83,-219,-68,166,-28,-337,166,-11,166,166,-220,166,166,166,-284,166,166,166,-337,166,-225,-224,-222,-84,166,166,166,-226,-223,166,-228,-227,]),'RBRACE':([61,97,99,119,124,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,181,184,185,186,188,189,190,191,195,196,197,224,225,227,228,230,232,234,235,236,237,238,261,263,268,273,284,285,286,289,291,298,300,301,302,303,305,306,308,309,313,315,318,325,326,327,332,370,374,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,424,425,428,432,435,437,438,439,446,450,451,468,469,472,473,476,478,480,482,483,487,496,497,500,505,506,510,523,524,528,536,546,547,550,551,554,555,557,558,565,575,576,578,579,],[-71,-335,191,-87,-72,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-337,191,191,191,-159,-160,-156,-336,-171,191,-176,-274,-239,-337,-193,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-76,-79,-82,-75,-77,-6,-81,-215,-214,-80,-216,-5,-78,191,191,191,-157,191,191,-172,-69,191,-22,-21,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,-234,-233,-231,-217,-230,-81,-84,-218,-158,-173,-177,-240,-194,191,-196,-237,-281,-282,-290,-291,-275,-229,-232,-221,-83,-219,-68,-195,-254,191,-220,-197,-306,191,-299,-225,-224,-222,-84,-300,-226,-223,-228,-227,]),'_BOOL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[34,-337,-113,-128,34,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,34,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,34,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,34,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,34,-131,-95,-101,-97,34,-53,-126,34,-88,34,34,-93,34,-147,-335,-146,34,-167,-166,-182,-100,-126,34,-87,-90,-94,-92,-61,-72,34,-144,-142,34,34,34,-73,34,-89,34,34,34,-149,-159,-160,-156,-336,34,-183,-30,34,34,-74,34,34,34,34,-174,-175,34,-143,-140,34,-141,-145,-76,-79,-82,-75,-77,34,-81,-215,-214,-80,-216,-78,-127,34,-153,34,-151,-148,-157,-168,-69,-36,-35,34,34,34,-234,-233,34,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,34,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LE':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,246,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,246,-262,-260,-264,246,-263,-259,-266,246,-257,-256,-265,246,246,246,246,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'SEMI':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,70,71,73,74,75,76,77,78,79,80,81,82,83,84,86,87,89,91,94,96,97,98,99,100,101,108,109,110,111,113,114,115,119,120,121,122,123,124,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,179,180,181,184,185,186,187,188,189,190,191,192,200,216,217,223,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,272,273,275,279,280,284,285,286,288,289,290,291,293,294,298,300,301,302,303,304,305,306,307,308,310,312,313,314,315,316,317,318,320,321,322,323,324,328,330,331,332,340,341,355,356,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,423,424,425,426,427,428,429,432,433,435,437,438,439,440,442,443,444,446,448,449,453,454,464,465,468,469,476,478,480,482,483,486,487,496,497,498,499,500,502,505,506,508,509,510,511,512,518,519,523,524,533,534,535,536,537,539,547,551,552,554,555,557,558,565,568,569,574,575,576,577,578,579,],[19,-337,-113,-128,-337,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,-337,-29,-121,-116,-62,-112,-70,-52,-123,-117,119,-337,-337,-119,-337,-114,-130,19,-118,-71,-103,-337,-9,-131,-91,-10,-96,-20,-98,-54,-179,-178,-131,-37,-134,-85,-95,-101,-97,-19,-132,-53,-126,-337,-337,-93,-147,-335,-146,188,-167,-166,-136,-100,-138,-126,-16,-86,-15,-87,-90,-94,-92,-61,-72,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-178,-73,-337,188,188,188,-149,-159,-160,-156,-336,-337,-30,-38,-133,-74,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,-235,-278,-140,-141,-145,-76,-79,-82,424,-75,425,-77,428,-14,-337,-81,-215,-214,-80,435,-216,-13,-337,-78,-312,-127,188,-153,188,-151,-148,-157,-26,-25,446,-161,-163,-168,-139,-137,-69,-36,-35,-44,-43,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,-292,-305,496,-234,-233,497,-337,-231,-337,-217,-13,-230,-81,-84,-218,-337,-152,-150,-165,-158,-170,-169,-31,-34,-39,-42,-240,-194,-237,-281,-282,-290,-291,-236,-275,-229,-232,533,-337,-221,-337,-83,-219,-162,-164,-68,-33,-32,-41,-40,-195,-254,-337,553,-337,-220,-337,-337,-306,-299,566,-225,-224,-222,-84,-300,575,-337,-337,-226,-223,-337,-228,-227,]),'_THREAD_LOCAL':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[11,11,-113,-128,11,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,11,-120,-115,-65,-102,11,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,11,11,-119,11,-114,-130,11,-118,-71,-103,11,-131,-96,-98,11,-131,-95,-101,-97,-53,11,11,-88,11,-147,-335,-146,-167,-166,-100,-126,11,-87,-61,-72,11,-73,11,-89,-149,-336,-30,11,-74,-174,-175,11,-76,-79,-82,-75,-77,11,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,11,11,11,-234,-233,11,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,11,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'LT':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,248,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,248,-262,-260,-264,248,-263,-259,-266,248,-257,-256,-265,248,248,248,248,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'COMMA':([2,3,5,6,7,10,11,12,13,18,20,22,23,26,27,30,33,34,35,36,39,42,43,44,46,48,49,50,54,56,58,60,62,68,70,71,73,74,75,76,77,78,80,81,82,84,86,96,98,100,101,103,104,105,106,108,109,110,111,113,127,132,133,134,136,138,139,140,141,142,143,144,145,147,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,177,178,179,187,191,195,196,197,198,199,200,203,210,211,212,213,215,216,217,224,225,226,228,230,232,234,235,236,237,238,240,241,261,263,268,269,270,272,273,274,275,276,277,279,280,281,283,294,310,312,314,316,317,320,323,324,325,326,327,328,330,331,340,341,343,344,345,346,347,348,355,356,374,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,414,426,442,443,444,448,449,450,451,453,454,458,461,463,464,465,468,469,473,476,478,480,482,483,486,487,489,490,492,501,503,507,508,509,511,512,518,519,523,524,525,528,529,530,531,532,544,545,546,547,551,556,559,560,564,565,570,571,],[-113,-128,-124,-110,-106,-104,-107,-125,-105,-99,-109,-120,-115,-102,-126,-108,-238,-111,-337,-122,-129,-29,-121,-116,-112,-52,-123,-117,-119,-114,-130,-118,-103,-96,126,-98,-54,-179,-178,-131,-37,-134,-95,-101,-97,-132,-53,-147,-146,-167,-166,-28,-180,-182,-27,-136,-100,-138,-126,202,-55,-317,-321,-318,-303,-324,-330,-313,-319,-144,-301,-274,-314,-142,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-337,-252,-178,-149,-336,-171,327,-176,-183,-181,-30,333,-186,-337,349,350,-191,-38,-133,-274,-239,-135,-193,-326,-280,-277,-334,-332,-331,-333,-174,-175,-298,-297,-279,-143,412,-235,-278,-203,-140,-204,-1,-141,-145,-2,-206,412,-312,-127,-153,-151,-148,445,-161,-163,327,327,-172,-168,-139,-137,-36,-35,-190,-204,-56,-188,-45,-189,-44,-43,472,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,412,-270,-258,-296,-295,-294,-293,412,-292,-310,484,485,-305,-205,412,-152,-150,-165,-170,-169,-173,-177,-31,-34,-57,-192,-187,-39,-42,-240,-194,-196,-237,-281,-282,-290,-291,-236,-275,-213,-207,-211,412,412,412,-162,-164,-33,-32,-41,-40,-195,-254,-311,550,-209,-208,-210,-212,-51,-50,-197,-306,-299,412,-46,-49,412,-300,-48,-47,]),'U16CHAR_CONST':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,169,-335,-28,-182,-27,169,-337,-87,-72,-337,169,-286,-285,169,169,-283,-287,-288,169,-284,169,169,169,-336,-183,169,169,-28,-337,169,-28,-337,-337,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,169,-337,-76,-79,-82,-75,169,-77,169,169,-81,-215,-214,-80,-216,169,-78,169,169,-69,-284,169,169,-284,169,169,-244,-247,-245,-241,-242,-246,-248,169,-250,-251,-243,-249,-12,169,169,-11,169,169,169,169,-234,-233,169,-231,169,169,-217,169,-230,169,-84,-218,169,169,169,-337,-337,-198,169,169,169,-337,-284,-229,-232,169,-221,169,-83,-219,-68,169,-28,-337,169,-11,169,169,-220,169,169,169,-284,169,169,169,-337,169,-225,-224,-222,-84,169,169,169,-226,-223,169,-228,-227,]),'OFFSETOF':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,137,146,149,150,151,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,170,-335,-28,-182,-27,170,-337,-87,-72,-337,170,-286,-285,170,170,-283,-287,-288,170,-284,170,170,170,-336,-183,170,170,-28,-337,170,-28,-337,-337,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,-337,-76,-79,-82,-75,170,-77,170,170,-81,-215,-214,-80,-216,170,-78,170,170,-69,-284,170,170,-284,170,170,-244,-247,-245,-241,-242,-246,-248,170,-250,-251,-243,-249,-12,170,170,-11,170,170,170,170,-234,-233,170,-231,170,170,-217,170,-230,170,-84,-218,170,170,170,-337,-337,-198,170,170,170,-337,-284,-229,-232,170,-221,170,-83,-219,-68,170,-28,-337,170,-11,170,170,-220,170,170,170,-284,170,170,170,-337,170,-225,-224,-222,-84,170,170,170,-226,-223,170,-228,-227,]),'_ATOMIC':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,35,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,103,105,109,111,117,118,119,120,121,122,123,124,128,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,205,206,211,214,219,220,223,229,231,233,239,240,241,267,269,275,278,279,280,282,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,459,460,496,497,500,505,506,510,511,512,514,515,536,554,555,557,558,575,576,578,579,],[29,65,-113,-128,76,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,65,-120,-115,-65,-102,65,-131,-108,-238,-111,76,-122,-63,-129,112,-29,-121,-116,-62,-112,-70,-52,-123,-117,65,65,-119,65,-114,-130,29,-118,-71,-103,65,-9,-131,-91,-10,-96,-98,65,-131,-95,-101,-97,29,-53,65,76,-88,112,65,-93,29,-147,-335,-146,29,-167,-166,76,-182,-100,-126,76,29,-87,-90,-94,-92,-61,-72,76,29,-144,-142,65,29,76,-73,65,-89,29,29,29,-149,-159,-160,-156,-336,76,-183,-30,76,76,76,112,76,76,-74,29,29,29,29,-174,-175,29,-143,-140,29,-141,-145,76,-76,-79,-82,-75,-77,65,-81,-215,-214,-80,-216,-78,-127,29,-153,29,-151,-148,-157,-168,-69,-36,-35,29,29,29,-234,-233,65,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,76,29,-229,-232,-221,-83,-219,-68,-33,-32,76,76,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'TYPEDEF':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[7,7,-113,-128,7,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,7,-120,-115,-65,-102,7,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,7,7,-119,7,-114,-130,7,-118,-71,-103,7,-131,-96,-98,7,-131,-95,-101,-97,-53,7,7,-88,7,-147,-335,-146,-167,-166,-100,-126,7,-87,-61,-72,7,-73,7,-89,-149,-336,-30,7,-74,-174,-175,7,-76,-79,-82,-75,-77,7,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,7,7,7,-234,-233,7,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,7,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOR':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,251,-328,-316,-329,-320,-276,-323,-312,-336,-274,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-261,251,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,251,-267,-269,251,-258,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'AUTO':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,65,68,71,75,76,80,81,82,86,87,89,90,93,96,97,98,100,101,109,111,118,119,123,124,129,180,181,182,187,191,200,211,223,240,241,278,284,285,286,289,291,298,300,301,302,303,305,308,312,314,316,317,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[26,26,-113,-128,26,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,26,-120,-115,-65,-102,26,-131,-108,-238,-111,-122,-63,-129,-29,-121,-116,-62,-112,-70,-52,-123,-117,26,26,-119,26,-114,-130,26,-118,-71,-103,26,-131,-96,-98,26,-131,-95,-101,-97,-53,26,26,-88,26,-147,-335,-146,-167,-166,-100,-126,26,-87,-61,-72,26,-73,26,-89,-149,-336,-30,26,-74,-174,-175,26,-76,-79,-82,-75,-77,26,-81,-215,-214,-80,-216,-78,-127,-153,-151,-148,-168,-69,-36,-35,26,26,26,-234,-233,26,-231,-217,-230,-81,-84,-218,-152,-150,-170,-169,-31,-34,26,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'DIVEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,357,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'TIMES':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,76,80,81,82,85,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,116,117,119,120,121,122,123,124,126,128,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,156,158,160,161,162,163,164,165,166,167,168,169,171,173,174,175,176,177,180,181,187,191,192,198,201,202,204,205,206,211,218,219,220,223,224,227,229,230,231,232,233,234,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,268,269,273,275,278,279,280,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,312,314,316,317,319,328,329,332,336,338,339,342,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,459,472,475,477,478,480,481,482,483,484,487,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[35,-337,-113,-128,35,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,-131,-108,-238,-111,-337,-122,35,-63,-129,35,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,35,-118,-71,-103,-337,-9,-131,-91,-10,-96,35,-98,-131,-95,-101,-97,173,-126,35,35,-93,-147,-335,-146,-167,-166,-28,35,-182,-27,-100,-126,173,-337,-87,-90,-94,-92,-61,-72,35,-337,173,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-274,-314,173,-142,-327,173,-283,-287,-325,-304,-322,-302,-255,-315,-289,253,-328,-316,-288,-329,-320,-276,-323,173,-284,173,173,-312,35,-73,173,-149,-336,35,-183,173,35,336,-28,-337,35,352,-28,-337,-74,-274,-337,173,-326,173,-280,173,-277,-334,-332,-331,-333,-174,-175,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,173,-298,-297,173,173,-279,-143,-278,-140,35,-141,-145,420,-76,-79,-82,-75,173,-77,173,173,-81,-215,-214,-80,-216,173,-78,-312,-127,-153,-151,-148,173,-168,173,-69,-284,173,173,35,-284,173,173,-244,-247,-245,-241,-242,-246,-248,173,-250,-251,-243,-249,-12,173,173,-11,253,253,253,253,253,253,253,253,253,253,-257,-256,253,253,253,253,253,-258,-296,-295,-294,-293,-292,-305,173,173,173,494,-234,-233,173,-231,173,173,-217,173,-230,173,-84,-218,173,173,-152,-150,35,173,-170,-169,-337,-337,-198,173,-281,-282,173,-290,-291,173,-275,-337,-284,-229,-232,173,-221,173,-83,-219,-68,541,-28,-337,173,-11,173,173,-220,173,173,173,-284,173,173,-306,173,-337,-299,173,-225,-224,-222,-84,-300,173,173,173,-226,-223,173,-228,-227,]),'LPAREN':([0,1,2,3,4,5,6,7,8,10,11,12,13,14,15,16,17,18,19,20,22,23,25,26,27,29,30,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,73,76,77,80,81,82,85,86,87,89,91,94,96,97,98,100,101,103,104,105,106,109,111,112,116,117,119,120,121,122,123,124,126,127,128,131,132,133,134,135,136,137,138,139,140,141,142,143,145,146,147,148,149,150,151,152,153,154,155,156,160,161,163,164,165,166,167,168,169,170,171,173,174,175,176,177,180,181,187,191,192,198,199,200,201,202,204,205,206,211,216,218,219,220,223,227,229,230,231,233,235,236,237,238,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,269,275,276,278,279,280,282,283,284,285,286,289,290,291,292,296,297,298,299,300,301,302,303,305,307,308,310,311,312,314,316,317,319,328,329,332,336,338,339,340,341,342,344,345,347,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,414,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,453,454,457,458,459,464,465,472,475,477,481,482,483,484,488,489,490,492,494,496,497,499,500,502,504,505,506,510,511,512,513,514,515,518,519,521,522,529,530,531,532,533,535,536,537,538,539,541,542,543,544,545,547,549,550,551,553,554,555,557,558,559,560,565,566,569,570,571,574,575,576,577,578,579,],[37,-337,-113,-128,69,-124,-110,-106,85,-104,-107,-125,-105,-64,37,-60,-67,-99,-66,-109,-120,-115,-65,-102,-126,95,-108,-238,-111,-337,-122,37,-63,-129,37,116,-29,-121,-116,-62,-112,-70,118,-123,-117,-337,-337,-119,-337,-114,-130,37,-118,-71,-103,-337,-9,95,-91,-10,-96,69,-98,69,129,-131,-37,-95,-101,-97,174,118,-126,69,37,-93,-147,-335,-146,-167,-166,-28,-180,-182,-27,-100,-126,95,174,-337,-87,-90,-94,-92,-61,-72,69,129,-337,229,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-144,-301,-314,231,-142,-327,233,-283,-287,-325,-304,-322,239,-302,-315,-289,-328,-316,-288,-329,-320,266,-323,267,174,-284,229,233,-312,278,-73,229,-149,-336,69,-183,-181,-30,229,69,229,-28,-337,342,-38,229,-28,-337,-74,-337,229,-326,229,229,-334,-332,-331,-333,-174,-175,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,174,229,174,174,-298,-297,229,229,-143,-140,278,278,-141,-145,-337,422,-76,-79,-82,-75,229,-77,427,430,174,229,434,-81,-215,-214,-80,-216,229,-78,-312,441,-127,-153,-151,-148,174,-168,174,-69,-284,229,229,-36,-35,342,342,460,-45,-284,229,229,-44,-43,-244,-247,-245,-241,-242,-246,-248,229,-250,-251,-243,-249,-12,174,229,-11,-296,-295,-294,-293,-292,-305,229,174,422,229,229,-234,-233,229,-231,229,229,-217,229,-230,229,-84,-218,229,229,-152,-150,69,174,-170,-169,-31,-34,342,460,-337,-39,-42,-337,-198,174,174,-290,-291,229,-337,-213,-207,-211,-284,-229,-232,229,-221,229,538,-83,-219,-68,-33,-32,229,-28,-337,-41,-40,229,-11,-209,-208,-210,-212,229,229,-220,229,229,229,-284,229,229,-51,-50,-306,229,-337,-299,229,-225,-224,-222,-84,-46,-49,-300,229,229,-48,-47,229,-226,-223,229,-228,-227,]),'MINUSMINUS':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,132,133,134,135,136,137,138,139,140,141,143,145,146,148,149,150,151,152,153,154,156,160,161,163,164,165,166,167,168,169,171,173,174,175,176,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,235,236,237,238,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,261,263,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,310,319,329,332,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,402,403,404,405,407,411,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,459,472,475,477,481,482,483,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,547,549,550,551,553,554,555,557,558,565,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,175,-335,-28,-182,-27,175,-337,-87,-72,-337,175,-317,-321,-318,-286,-303,-285,-324,-330,-313,-319,-301,-314,175,-327,175,-283,-287,-325,-304,-322,-302,-315,-289,-328,-316,-288,-329,-320,261,-323,175,-284,175,175,-312,175,-336,-183,175,175,-28,-337,175,-28,-337,-337,175,-326,175,175,-334,-332,-331,-333,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,175,-298,-297,175,175,-337,-76,-79,-82,-75,175,-77,175,175,-81,-215,-214,-80,-216,175,-78,-312,175,175,-69,-284,175,175,-284,175,175,-244,-247,-245,-241,-242,-246,-248,175,-250,-251,-243,-249,-12,175,175,-11,-296,-295,-294,-293,-292,-305,175,175,175,175,-234,-233,175,-231,175,175,-217,175,-230,175,-84,-218,175,175,175,-337,-337,-198,175,175,-290,-291,175,-337,-284,-229,-232,175,-221,175,-83,-219,-68,175,-28,-337,175,-11,175,175,-220,175,175,175,-284,175,175,-306,175,-337,-299,175,-225,-224,-222,-84,-300,175,175,175,-226,-223,175,-228,-227,]),'ID':([0,1,2,3,4,5,6,7,10,11,12,13,14,15,16,17,18,19,20,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,43,44,45,46,47,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,69,71,72,76,80,81,82,85,87,89,91,94,96,97,98,100,101,102,103,104,105,106,109,111,116,117,118,119,120,121,122,123,124,126,128,129,131,135,137,142,146,147,149,150,151,165,171,173,174,175,180,181,187,191,192,193,194,198,199,201,202,204,205,206,211,218,219,220,223,227,229,231,233,240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,262,264,265,266,269,275,279,280,282,284,285,286,287,289,290,291,297,298,300,301,302,303,305,307,308,312,314,316,317,319,327,328,329,332,336,338,339,342,344,349,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,372,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,442,443,445,447,448,449,457,459,460,472,475,477,481,484,485,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,548,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[42,-337,-113,-128,42,-124,-110,-106,-104,-107,-125,-105,-64,42,-60,-67,-99,-66,-109,-120,-115,-154,-65,-102,-126,-155,-131,-108,98,101,-238,-111,-337,-122,42,-63,-129,42,-121,-116,-62,-112,-70,-123,-117,-337,-337,-119,-337,-114,-130,42,-118,-71,-103,-337,-9,-131,-91,-10,-96,42,-98,42,-131,-95,-101,-97,176,-126,42,42,-93,-147,-335,-146,-167,-166,197,-28,-180,-182,-27,-100,-126,176,-337,176,-87,-90,-94,-92,-61,-72,42,-337,176,176,-286,-285,-144,176,-142,176,-283,-287,-288,176,-284,176,176,-73,310,-149,-336,42,197,197,-183,-181,176,42,176,-28,-337,42,176,-28,-337,-74,-337,176,176,176,-174,-175,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,176,403,405,176,176,-143,-140,-141,-145,-337,-76,-79,-82,423,-75,176,-77,176,310,-81,-215,-214,-80,-216,310,-78,-127,-153,-151,-148,176,197,-168,176,-69,-284,176,176,42,42,176,-284,176,176,-244,-247,-245,-241,-242,-246,-248,176,-250,-251,-243,-249,-12,176,176,176,-11,176,176,176,176,-234,-233,176,-231,310,176,-217,176,-230,310,-84,-218,310,176,-152,-150,42,176,-170,-169,42,-337,176,-337,-198,176,176,176,176,-337,-284,-229,-232,176,-221,310,-83,-219,-68,176,-28,-337,176,-11,176,310,-220,310,176,310,-284,176,176,176,176,-337,176,-225,-224,-222,-84,176,310,310,-226,-223,310,-228,-227,]),'IF':([61,97,119,124,181,191,284,285,286,289,291,298,300,301,302,303,305,307,308,332,424,425,428,429,432,435,437,438,439,440,496,497,500,502,505,506,510,535,536,537,539,554,555,557,558,569,574,575,576,577,578,579,],[-71,-335,-87,-72,311,-336,-76,-79,-82,-75,-77,311,-81,-215,-214,-80,-216,311,-78,-69,-234,-233,-231,311,-217,-230,311,-84,-218,311,-229,-232,-221,311,-83,-219,-68,311,-220,311,311,-225,-224,-222,-84,311,311,-226,-223,311,-228,-227,]),'STRING_LITERAL':([3,39,58,61,76,85,97,103,105,106,116,117,119,124,128,131,135,136,137,146,149,150,151,152,165,171,173,174,175,181,191,198,201,204,205,206,218,219,220,227,229,230,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,282,284,285,286,289,290,291,297,298,300,301,302,303,305,307,308,319,329,332,333,336,338,339,352,353,354,357,358,359,360,361,362,363,364,365,366,367,368,369,373,375,377,412,413,419,421,424,425,427,428,429,430,432,434,435,437,438,439,440,441,447,452,459,472,475,477,481,484,488,494,496,497,499,500,502,505,506,510,513,514,515,521,522,533,535,536,537,538,539,541,542,543,549,550,553,554,555,557,558,566,569,574,575,576,577,578,579,],[-128,-129,-130,-71,-131,152,-335,-28,-182,-27,152,-337,-87,-72,-337,152,-286,230,-285,152,152,-283,-287,-325,-288,152,-284,152,152,152,-336,-183,152,152,-28,-337,152,-28,-337,-337,152,-326,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,152,-337,-76,-79,-82,-75,152,-77,152,152,-81,-215,-214,-80,-216,152,-78,152,152,-69,152,-284,152,152,-284,152,152,-244,-247,-245,-241,-242,-246,-248,152,-250,-251,-243,-249,-12,152,152,-11,152,152,152,152,-234,-233,152,-231,152,152,-217,152,-230,152,-84,-218,152,152,152,230,-337,-337,-198,152,152,152,-337,-284,-229,-232,152,-221,152,-83,-219,-68,152,-28,-337,152,-11,152,152,-220,152,152,152,-284,152,152,152,-337,152,-225,-224,-222,-84,152,152,152,-226,-223,152,-228,-227,]),'FLOAT':([0,1,2,3,4,5,6,7,10,11,12,13,14,16,17,18,19,20,21,22,23,25,26,27,29,30,33,34,36,38,39,40,42,43,44,45,46,47,48,49,50,52,53,54,55,56,58,59,60,61,62,63,64,65,66,67,68,71,75,76,80,81,82,85,86,87,89,90,91,93,94,95,96,97,98,99,100,101,105,109,111,118,119,120,121,122,123,124,129,142,147,172,174,177,180,181,182,184,185,186,187,188,189,190,191,192,198,200,211,214,223,229,231,233,239,240,241,267,269,275,278,279,280,284,285,286,289,291,298,300,301,302,303,305,308,312,313,314,315,316,317,318,328,332,340,341,342,350,422,424,425,427,428,432,435,437,438,439,442,443,446,448,449,453,454,460,496,497,500,505,506,510,511,512,536,554,555,557,558,575,576,578,579,],[44,-337,-113,-128,44,-124,-110,-106,-104,-107,-125,-105,-64,-60,-67,-99,-66,-109,44,-120,-115,-65,-102,-126,-131,-108,-238,-111,-122,-63,-129,44,-29,-121,-116,-62,-112,-70,-52,-123,-117,-337,-337,-119,-337,-114,-130,44,-118,-71,-103,-337,-9,-131,-91,-10,-96,-98,44,-131,-95,-101,-97,44,-53,-126,44,-88,44,44,-93,44,-147,-335,-146,44,-167,-166,-182,-100,-126,44,-87,-90,-94,-92,-61,-72,44,-144,-142,44,44,44,-73,44,-89,44,44,44,-149,-159,-160,-156,-336,44,-183,-30,44,44,-74,44,44,44,44,-174,-175,44,-143,-140,44,-141,-145,-76,-79,-82,-75,-77,44,-81,-215,-214,-80,-216,-78,-127,44,-153,44,-151,-148,-157,-168,-69,-36,-35,44,44,44,-234,-233,44,-231,-217,-230,-81,-84,-218,-152,-150,-158,-170,-169,-31,-34,44,-229,-232,-221,-83,-219,-68,-33,-32,-220,-225,-224,-222,-84,-226,-223,-228,-227,]),'XOREQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,361,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'LSHIFTEQUAL':([132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,160,161,163,164,166,167,168,169,176,191,224,230,232,234,235,236,237,238,261,263,268,273,310,402,403,404,405,407,411,478,480,482,483,487,547,551,565,],[-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-315,-289,-328,-316,-329,-320,-276,-323,-312,-336,363,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-278,-312,-296,-295,-294,-293,-292,-305,-281,-282,-290,-291,-275,-306,-299,-300,]),'RBRACKET':([3,39,58,76,103,105,106,117,128,132,133,134,136,138,139,140,141,143,144,145,148,152,153,154,156,158,160,161,162,163,164,166,167,168,169,176,178,191,198,204,205,218,219,224,225,230,232,234,235,236,237,238,261,263,268,272,273,282,334,335,336,337,351,352,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,400,401,402,403,404,405,406,407,411,419,420,421,455,456,459,466,467,468,471,476,478,480,482,483,486,487,491,493,494,513,514,524,540,541,547,551,561,562,564,565,],[-128,-129,-130,-131,-28,-182,-27,-337,-337,-317,-321,-318,-303,-324,-330,-313,-319,-301,-274,-314,-327,-325,-304,-322,-302,-255,-315,-289,-253,-328,-316,-329,-320,-276,-323,-312,-252,-336,-183,-337,-28,-337,-28,-274,-239,-326,-280,-277,-334,-332,-331,-333,-298,-297,-279,-235,-278,-337,453,-4,454,-3,464,465,-261,-273,-262,-260,-264,-268,-263,-259,-266,-271,-257,-256,-265,-272,-267,-269,-270,-258,-296,-295,-294,-293,482,-292,-305,-337,492,-337,511,512,-337,518,519,-240,520,-237,-281,-282,-290,-291,-236,-275,529,530,531,-337,-28,-254,559,560,-306,-299,570,571,572,-300,]),}
+
+_lr_action = {}
+for _k, _v in _lr_action_items.items():
+   for _x,_y in zip(_v[0],_v[1]):
+      if not _x in _lr_action:  _lr_action[_x] = {}
+      _lr_action[_x][_k] = _y
+del _lr_action_items
+
+_lr_goto_items = {'expression_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[284,284,284,284,284,284,284,284,284,284,284,284,284,]),'struct_or_union_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,]),'init_declarator_list':([4,89,],[70,70,]),'init_declarator_list_opt':([4,89,],[79,79,]),'iteration_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[285,285,285,285,285,285,285,285,285,285,285,285,285,]),'static_assert':([0,59,181,298,307,429,437,440,502,535,537,539,569,574,577,],[17,17,286,286,286,286,286,286,286,286,286,286,286,286,286,]),'unified_string_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,333,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,452,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,136,]),'assignment_expression_opt':([204,218,419,421,513,],[334,351,491,493,540,]),'brace_open':([31,32,92,96,98,100,101,130,131,181,201,229,298,307,375,413,429,437,440,477,478,479,502,521,535,537,539,569,574,577,],[99,102,181,184,185,193,194,181,227,181,227,181,181,181,227,488,181,181,181,488,488,488,181,227,181,181,181,181,181,181,]),'enumerator':([102,193,194,327,],[195,195,195,450,]),'typeid_noparen_declarator':([211,],[348,]),'type_qualifier_list_opt':([35,117,128,206,220,282,459,515,],[104,204,218,339,354,419,513,543,]),'declaration_specifiers_no_type_opt':([1,27,52,53,55,63,87,],[66,94,120,121,122,94,94,]),'expression_opt':([181,298,307,427,429,437,440,499,502,533,535,537,539,553,566,569,574,577,],[288,288,288,498,288,288,288,534,288,552,288,288,288,567,573,288,288,288,]),'designation':([227,472,488,550,],[369,369,369,369,]),'parameter_list':([118,129,278,342,422,460,],[213,213,213,213,213,213,]),'alignment_specifier':([0,1,4,21,27,52,53,55,59,63,75,85,87,89,93,95,99,118,129,174,177,181,184,185,186,192,211,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[53,53,81,53,53,53,53,53,53,53,53,142,53,81,53,142,142,53,53,142,280,53,142,142,142,280,81,142,142,142,142,142,53,53,142,142,53,53,53,53,53,]),'labeled_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[289,289,289,289,289,289,289,289,289,289,289,289,289,]),'abstract_declarator':([177,211,278,342,],[281,281,418,418,]),'translation_unit':([0,],[59,]),'init_declarator':([4,89,126,202,],[84,84,217,331,]),'direct_abstract_declarator':([177,211,276,278,342,344,457,],[283,283,414,283,283,414,414,]),'designator_list':([227,472,488,550,],[376,376,376,376,]),'identifier':([85,116,118,129,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,349,353,354,364,372,373,375,412,413,419,421,427,429,430,434,437,440,441,447,460,477,481,484,485,499,502,513,521,533,535,537,538,539,542,543,548,549,553,566,569,574,577,],[143,143,215,215,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,461,143,143,143,470,143,143,143,143,143,143,143,143,143,143,143,143,143,143,215,143,143,143,527,143,143,143,143,143,143,143,143,143,143,143,563,143,143,143,143,143,143,]),'offsetof_member_designator':([485,],[526,]),'unary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[144,144,224,232,234,144,224,273,224,224,224,224,224,224,224,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,144,224,144,144,224,224,224,144,224,224,144,144,224,224,224,224,224,144,224,224,144,224,224,224,224,224,224,224,224,224,144,144,144,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,224,]),'abstract_declarator_opt':([177,211,],[274,343,]),'initializer':([131,201,375,521,],[226,330,473,546,]),'direct_id_declarator':([0,4,15,37,40,59,69,72,89,91,126,192,202,211,342,344,445,457,],[48,48,86,48,48,48,48,86,48,48,48,48,48,48,48,86,48,86,]),'struct_declaration_list':([99,184,185,],[186,313,315,]),'pp_directive':([0,59,],[14,14,]),'declaration_list':([21,75,],[93,93,]),'id_init_declarator':([40,91,],[108,108,]),'type_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[18,18,109,18,18,147,109,18,147,147,18,18,269,147,18,147,147,147,109,147,147,147,147,147,18,18,147,147,18,18,18,18,18,]),'compound_statement':([92,130,181,229,298,307,429,437,440,502,535,537,539,569,574,577,],[180,223,291,378,291,291,291,291,291,291,291,291,291,291,291,291,]),'pointer':([0,4,37,40,59,69,89,91,104,126,177,192,202,211,278,342,445,],[15,72,15,15,15,72,72,15,199,72,276,72,72,344,276,457,72,]),'typeid_declarator':([4,69,89,126,192,202,445,],[74,125,74,74,74,74,74,]),'id_init_declarator_list':([40,91,],[113,113,]),'declarator':([4,89,126,192,202,445,],[78,78,78,324,78,324,]),'argument_expression_list':([266,],[409,]),'struct_declarator_list_opt':([192,],[322,]),'block_item_list':([181,],[298,]),'parameter_type_list_opt':([278,342,422,],[417,417,495,]),'struct_declarator':([192,445,],[323,508,]),'type_qualifier':([0,1,4,21,27,35,52,53,55,59,63,75,85,87,89,93,95,99,103,117,118,128,129,172,174,177,181,184,185,186,192,205,206,211,219,220,229,231,233,239,267,278,282,298,313,315,342,350,422,427,459,460,514,515,],[52,52,80,52,52,105,52,52,52,52,52,52,105,52,80,52,105,105,198,105,52,105,52,198,105,279,52,105,105,105,279,198,105,80,198,105,105,105,105,105,105,52,105,52,105,105,52,52,52,52,105,52,198,105,]),'assignment_operator':([224,],[364,]),'expression':([174,181,229,231,233,258,265,290,298,307,427,429,430,434,437,440,441,499,502,533,535,537,538,539,549,553,566,569,574,577,],[270,294,270,270,270,399,406,426,294,294,294,294,501,503,294,294,507,294,294,294,294,294,556,294,564,294,294,294,294,294,]),'storage_class_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[1,1,68,1,1,1,1,1,1,1,1,1,68,1,1,1,1,68,1,1,1,1,1,1,1,]),'unified_wstring_literal':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,153,]),'translation_unit_or_empty':([0,],[9,]),'initializer_list_opt':([227,],[370,]),'brace_close':([99,184,185,186,196,309,313,315,325,326,370,472,528,550,],[187,314,316,317,328,439,442,443,448,449,469,523,551,565,]),'direct_typeid_declarator':([4,69,72,89,126,192,202,445,],[73,73,127,73,73,73,73,73,]),'external_declaration':([0,59,],[16,123,]),'pragmacomp_or_statement':([307,429,440,502,535,537,539,569,574,577,],[436,500,506,536,554,555,557,576,578,579,]),'type_name':([85,95,174,229,231,233,239,267,],[157,183,271,379,380,381,382,410,]),'typedef_name':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,]),'pppragma_directive':([0,59,99,181,184,185,186,298,307,313,315,429,437,440,502,535,537,539,569,574,577,],[25,25,189,300,189,189,189,300,437,189,189,437,300,437,437,437,437,437,437,437,437,]),'statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[301,301,438,438,505,438,438,438,438,558,438,438,438,]),'cast_expression':([85,116,131,171,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[158,158,158,268,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,487,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,158,]),'atomic_specifier':([0,1,21,27,40,52,53,55,59,63,75,85,87,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[27,63,87,63,111,63,63,63,27,63,87,111,63,111,87,111,111,27,27,111,111,87,111,111,111,111,111,111,111,111,111,27,87,111,111,27,27,27,87,27,]),'struct_declarator_list':([192,],[320,]),'empty':([0,1,4,21,27,35,40,52,53,55,63,75,87,89,91,117,118,128,129,177,181,192,204,206,211,218,220,227,278,282,298,307,342,419,421,422,427,429,437,440,459,460,472,488,499,502,513,515,533,535,537,539,550,553,566,569,574,577,],[57,64,83,88,64,106,115,64,64,64,64,88,64,83,115,106,208,106,208,277,306,321,337,106,277,337,106,377,415,106,433,433,415,337,337,415,433,433,433,433,106,208,522,522,433,433,337,106,433,433,433,433,522,433,433,433,433,433,]),'parameter_declaration':([118,129,278,342,350,422,460,],[210,210,210,210,463,210,210,]),'primary_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,161,]),'declaration':([0,21,59,75,93,181,298,427,],[38,90,38,90,182,302,302,499,]),'declaration_specifiers_no_type':([0,1,21,27,52,53,55,59,63,75,87,93,118,129,181,278,298,342,350,422,427,460,],[40,67,91,67,67,67,67,40,67,91,67,91,214,214,91,214,91,214,214,214,91,214,]),'jump_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[303,303,303,303,303,303,303,303,303,303,303,303,303,]),'enumerator_list':([102,193,194,],[196,325,326,]),'block_item':([181,298,],[305,432,]),'constant_expression':([85,116,297,319,329,373,447,],[159,203,431,444,451,471,509,]),'identifier_list_opt':([118,129,460,],[207,221,516,]),'constant':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,156,]),'type_specifier_no_typeid':([0,4,21,40,59,75,85,89,91,93,95,99,118,129,172,174,177,181,184,185,186,192,211,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[12,71,12,12,12,12,12,71,12,12,12,12,12,12,12,12,275,12,12,12,12,275,71,12,12,12,12,12,12,12,12,12,12,12,12,12,12,12,]),'struct_declaration':([99,184,185,186,313,315,],[190,190,190,318,318,318,]),'direct_typeid_noparen_declarator':([211,344,],[345,458,]),'id_declarator':([0,4,37,40,59,69,89,91,126,192,202,211,342,445,],[21,75,107,110,21,107,179,110,179,179,179,346,107,179,]),'selection_statement':([181,298,307,429,437,440,502,535,537,539,569,574,577,],[308,308,308,308,308,308,308,308,308,308,308,308,308,]),'postfix_expression':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,168,]),'initializer_list':([227,488,],[374,528,]),'unary_operator':([85,116,131,146,149,171,174,175,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,413,419,421,427,429,430,434,437,440,441,447,477,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,171,]),'struct_or_union':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,]),'block_item_list_opt':([181,],[309,]),'assignment_expression':([131,174,181,201,204,218,229,231,233,258,265,266,290,298,307,338,339,353,354,364,375,412,419,421,427,429,430,434,437,440,441,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[228,272,272,228,335,335,272,272,272,272,272,408,272,272,272,455,456,466,467,468,228,486,335,335,272,272,272,272,272,272,272,525,272,272,335,228,272,272,272,272,272,561,562,272,272,272,272,272,272,]),'designation_opt':([227,472,488,550,],[375,521,375,521,]),'parameter_type_list':([118,129,278,342,422,460,],[209,222,416,416,416,517,]),'type_qualifier_list':([35,85,95,99,117,128,174,184,185,186,206,220,229,231,233,239,267,282,313,315,459,515,],[103,172,172,172,205,219,172,172,172,172,103,103,172,172,172,172,172,103,172,172,514,103,]),'designator':([227,376,472,488,550,],[371,474,371,371,371,]),'id_init_declarator_list_opt':([40,91,],[114,114,]),'declaration_specifiers':([0,21,59,75,93,118,129,181,278,298,342,350,422,427,460,],[4,89,4,89,89,211,211,89,211,89,211,211,211,89,211,]),'identifier_list':([118,129,460,],[212,212,212,]),'declaration_list_opt':([21,75,],[92,130,]),'function_definition':([0,59,],[45,45,]),'binary_expression':([85,116,131,174,181,201,204,218,229,231,233,242,243,244,245,246,247,248,249,250,251,252,253,254,255,256,257,258,259,260,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[162,162,162,162,162,162,162,162,162,162,162,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,162,400,401,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,162,]),'enum_specifier':([0,21,40,59,75,85,91,93,95,99,118,129,172,174,181,184,185,186,214,229,231,233,239,267,278,298,313,315,342,350,422,427,460,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,]),'decl_body':([0,21,59,75,93,181,298,427,],[51,51,51,51,51,51,51,51,]),'function_specifier':([0,1,4,21,27,52,53,55,59,63,75,87,89,93,118,129,181,211,278,298,342,350,422,427,460,],[55,55,82,55,55,55,55,55,55,55,55,55,82,55,55,55,55,82,55,55,55,55,55,55,55,]),'specifier_qualifier_list':([85,95,99,174,184,185,186,229,231,233,239,267,313,315,],[177,177,192,177,192,192,192,177,177,177,177,177,192,192,]),'conditional_expression':([85,116,131,174,181,201,204,218,229,231,233,258,265,266,290,297,298,307,319,329,338,339,353,354,364,373,375,412,419,421,427,429,430,434,437,440,441,447,481,484,499,502,513,521,533,535,537,538,539,542,543,549,553,566,569,574,577,],[178,178,225,225,225,225,225,225,225,225,225,225,225,225,225,178,225,225,178,178,225,225,225,225,225,178,225,225,225,225,225,225,225,225,225,225,225,178,524,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,225,]),}
+
+_lr_goto = {}
+for _k, _v in _lr_goto_items.items():
+   for _x, _y in zip(_v[0], _v[1]):
+       if not _x in _lr_goto: _lr_goto[_x] = {}
+       _lr_goto[_x][_k] = _y
+del _lr_goto_items
+_lr_productions = [
+  ("S' -> translation_unit_or_empty","S'",1,None,None,None),
+  ('abstract_declarator_opt -> empty','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',43),
+  ('abstract_declarator_opt -> abstract_declarator','abstract_declarator_opt',1,'p_abstract_declarator_opt','plyparser.py',44),
+  ('assignment_expression_opt -> empty','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',43),
+  ('assignment_expression_opt -> assignment_expression','assignment_expression_opt',1,'p_assignment_expression_opt','plyparser.py',44),
+  ('block_item_list_opt -> empty','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',43),
+  ('block_item_list_opt -> block_item_list','block_item_list_opt',1,'p_block_item_list_opt','plyparser.py',44),
+  ('declaration_list_opt -> empty','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',43),
+  ('declaration_list_opt -> declaration_list','declaration_list_opt',1,'p_declaration_list_opt','plyparser.py',44),
+  ('declaration_specifiers_no_type_opt -> empty','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',43),
+  ('declaration_specifiers_no_type_opt -> declaration_specifiers_no_type','declaration_specifiers_no_type_opt',1,'p_declaration_specifiers_no_type_opt','plyparser.py',44),
+  ('designation_opt -> empty','designation_opt',1,'p_designation_opt','plyparser.py',43),
+  ('designation_opt -> designation','designation_opt',1,'p_designation_opt','plyparser.py',44),
+  ('expression_opt -> empty','expression_opt',1,'p_expression_opt','plyparser.py',43),
+  ('expression_opt -> expression','expression_opt',1,'p_expression_opt','plyparser.py',44),
+  ('id_init_declarator_list_opt -> empty','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',43),
+  ('id_init_declarator_list_opt -> id_init_declarator_list','id_init_declarator_list_opt',1,'p_id_init_declarator_list_opt','plyparser.py',44),
+  ('identifier_list_opt -> empty','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',43),
+  ('identifier_list_opt -> identifier_list','identifier_list_opt',1,'p_identifier_list_opt','plyparser.py',44),
+  ('init_declarator_list_opt -> empty','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',43),
+  ('init_declarator_list_opt -> init_declarator_list','init_declarator_list_opt',1,'p_init_declarator_list_opt','plyparser.py',44),
+  ('initializer_list_opt -> empty','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',43),
+  ('initializer_list_opt -> initializer_list','initializer_list_opt',1,'p_initializer_list_opt','plyparser.py',44),
+  ('parameter_type_list_opt -> empty','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',43),
+  ('parameter_type_list_opt -> parameter_type_list','parameter_type_list_opt',1,'p_parameter_type_list_opt','plyparser.py',44),
+  ('struct_declarator_list_opt -> empty','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',43),
+  ('struct_declarator_list_opt -> struct_declarator_list','struct_declarator_list_opt',1,'p_struct_declarator_list_opt','plyparser.py',44),
+  ('type_qualifier_list_opt -> empty','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',43),
+  ('type_qualifier_list_opt -> type_qualifier_list','type_qualifier_list_opt',1,'p_type_qualifier_list_opt','plyparser.py',44),
+  ('direct_id_declarator -> ID','direct_id_declarator',1,'p_direct_id_declarator_1','plyparser.py',126),
+  ('direct_id_declarator -> LPAREN id_declarator RPAREN','direct_id_declarator',3,'p_direct_id_declarator_2','plyparser.py',126),
+  ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_3','plyparser.py',126),
+  ('direct_id_declarator -> direct_id_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',126),
+  ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_id_declarator',6,'p_direct_id_declarator_4','plyparser.py',127),
+  ('direct_id_declarator -> direct_id_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_id_declarator',5,'p_direct_id_declarator_5','plyparser.py',126),
+  ('direct_id_declarator -> direct_id_declarator LPAREN parameter_type_list RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',126),
+  ('direct_id_declarator -> direct_id_declarator LPAREN identifier_list_opt RPAREN','direct_id_declarator',4,'p_direct_id_declarator_6','plyparser.py',127),
+  ('direct_typeid_declarator -> TYPEID','direct_typeid_declarator',1,'p_direct_typeid_declarator_1','plyparser.py',126),
+  ('direct_typeid_declarator -> LPAREN typeid_declarator RPAREN','direct_typeid_declarator',3,'p_direct_typeid_declarator_2','plyparser.py',126),
+  ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_3','plyparser.py',126),
+  ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',126),
+  ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_declarator',6,'p_direct_typeid_declarator_4','plyparser.py',127),
+  ('direct_typeid_declarator -> direct_typeid_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_declarator',5,'p_direct_typeid_declarator_5','plyparser.py',126),
+  ('direct_typeid_declarator -> direct_typeid_declarator LPAREN parameter_type_list RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',126),
+  ('direct_typeid_declarator -> direct_typeid_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_declarator',4,'p_direct_typeid_declarator_6','plyparser.py',127),
+  ('direct_typeid_noparen_declarator -> TYPEID','direct_typeid_noparen_declarator',1,'p_direct_typeid_noparen_declarator_1','plyparser.py',126),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_3','plyparser.py',126),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET STATIC type_qualifier_list_opt assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',126),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list STATIC assignment_expression RBRACKET','direct_typeid_noparen_declarator',6,'p_direct_typeid_noparen_declarator_4','plyparser.py',127),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LBRACKET type_qualifier_list_opt TIMES RBRACKET','direct_typeid_noparen_declarator',5,'p_direct_typeid_noparen_declarator_5','plyparser.py',126),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN parameter_type_list RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',126),
+  ('direct_typeid_noparen_declarator -> direct_typeid_noparen_declarator LPAREN identifier_list_opt RPAREN','direct_typeid_noparen_declarator',4,'p_direct_typeid_noparen_declarator_6','plyparser.py',127),
+  ('id_declarator -> direct_id_declarator','id_declarator',1,'p_id_declarator_1','plyparser.py',126),
+  ('id_declarator -> pointer direct_id_declarator','id_declarator',2,'p_id_declarator_2','plyparser.py',126),
+  ('typeid_declarator -> direct_typeid_declarator','typeid_declarator',1,'p_typeid_declarator_1','plyparser.py',126),
+  ('typeid_declarator -> pointer direct_typeid_declarator','typeid_declarator',2,'p_typeid_declarator_2','plyparser.py',126),
+  ('typeid_noparen_declarator -> direct_typeid_noparen_declarator','typeid_noparen_declarator',1,'p_typeid_noparen_declarator_1','plyparser.py',126),
+  ('typeid_noparen_declarator -> pointer direct_typeid_noparen_declarator','typeid_noparen_declarator',2,'p_typeid_noparen_declarator_2','plyparser.py',126),
+  ('translation_unit_or_empty -> translation_unit','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',509),
+  ('translation_unit_or_empty -> empty','translation_unit_or_empty',1,'p_translation_unit_or_empty','c_parser.py',510),
+  ('translation_unit -> external_declaration','translation_unit',1,'p_translation_unit_1','c_parser.py',518),
+  ('translation_unit -> translation_unit external_declaration','translation_unit',2,'p_translation_unit_2','c_parser.py',524),
+  ('external_declaration -> function_definition','external_declaration',1,'p_external_declaration_1','c_parser.py',534),
+  ('external_declaration -> declaration','external_declaration',1,'p_external_declaration_2','c_parser.py',539),
+  ('external_declaration -> pp_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',544),
+  ('external_declaration -> pppragma_directive','external_declaration',1,'p_external_declaration_3','c_parser.py',545),
+  ('external_declaration -> SEMI','external_declaration',1,'p_external_declaration_4','c_parser.py',550),
+  ('external_declaration -> static_assert','external_declaration',1,'p_external_declaration_5','c_parser.py',555),
+  ('static_assert -> _STATIC_ASSERT LPAREN constant_expression COMMA unified_string_literal RPAREN','static_assert',6,'p_static_assert_declaration','c_parser.py',560),
+  ('static_assert -> _STATIC_ASSERT LPAREN constant_expression RPAREN','static_assert',4,'p_static_assert_declaration','c_parser.py',561),
+  ('pp_directive -> PPHASH','pp_directive',1,'p_pp_directive','c_parser.py',569),
+  ('pppragma_directive -> PPPRAGMA','pppragma_directive',1,'p_pppragma_directive','c_parser.py',575),
+  ('pppragma_directive -> PPPRAGMA PPPRAGMASTR','pppragma_directive',2,'p_pppragma_directive','c_parser.py',576),
+  ('function_definition -> id_declarator declaration_list_opt compound_statement','function_definition',3,'p_function_definition_1','c_parser.py',586),
+  ('function_definition -> declaration_specifiers id_declarator declaration_list_opt compound_statement','function_definition',4,'p_function_definition_2','c_parser.py',604),
+  ('statement -> labeled_statement','statement',1,'p_statement','c_parser.py',619),
+  ('statement -> expression_statement','statement',1,'p_statement','c_parser.py',620),
+  ('statement -> compound_statement','statement',1,'p_statement','c_parser.py',621),
+  ('statement -> selection_statement','statement',1,'p_statement','c_parser.py',622),
+  ('statement -> iteration_statement','statement',1,'p_statement','c_parser.py',623),
+  ('statement -> jump_statement','statement',1,'p_statement','c_parser.py',624),
+  ('statement -> pppragma_directive','statement',1,'p_statement','c_parser.py',625),
+  ('statement -> static_assert','statement',1,'p_statement','c_parser.py',626),
+  ('pragmacomp_or_statement -> pppragma_directive statement','pragmacomp_or_statement',2,'p_pragmacomp_or_statement','c_parser.py',674),
+  ('pragmacomp_or_statement -> statement','pragmacomp_or_statement',1,'p_pragmacomp_or_statement','c_parser.py',675),
+  ('decl_body -> declaration_specifiers init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',694),
+  ('decl_body -> declaration_specifiers_no_type id_init_declarator_list_opt','decl_body',2,'p_decl_body','c_parser.py',695),
+  ('declaration -> decl_body SEMI','declaration',2,'p_declaration','c_parser.py',755),
+  ('declaration_list -> declaration','declaration_list',1,'p_declaration_list','c_parser.py',764),
+  ('declaration_list -> declaration_list declaration','declaration_list',2,'p_declaration_list','c_parser.py',765),
+  ('declaration_specifiers_no_type -> type_qualifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_1','c_parser.py',775),
+  ('declaration_specifiers_no_type -> storage_class_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_2','c_parser.py',780),
+  ('declaration_specifiers_no_type -> function_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_3','c_parser.py',785),
+  ('declaration_specifiers_no_type -> atomic_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_4','c_parser.py',792),
+  ('declaration_specifiers_no_type -> alignment_specifier declaration_specifiers_no_type_opt','declaration_specifiers_no_type',2,'p_declaration_specifiers_no_type_5','c_parser.py',797),
+  ('declaration_specifiers -> declaration_specifiers type_qualifier','declaration_specifiers',2,'p_declaration_specifiers_1','c_parser.py',802),
+  ('declaration_specifiers -> declaration_specifiers storage_class_specifier','declaration_specifiers',2,'p_declaration_specifiers_2','c_parser.py',807),
+  ('declaration_specifiers -> declaration_specifiers function_specifier','declaration_specifiers',2,'p_declaration_specifiers_3','c_parser.py',812),
+  ('declaration_specifiers -> declaration_specifiers type_specifier_no_typeid','declaration_specifiers',2,'p_declaration_specifiers_4','c_parser.py',817),
+  ('declaration_specifiers -> type_specifier','declaration_specifiers',1,'p_declaration_specifiers_5','c_parser.py',822),
+  ('declaration_specifiers -> declaration_specifiers_no_type type_specifier','declaration_specifiers',2,'p_declaration_specifiers_6','c_parser.py',827),
+  ('declaration_specifiers -> declaration_specifiers alignment_specifier','declaration_specifiers',2,'p_declaration_specifiers_7','c_parser.py',832),
+  ('storage_class_specifier -> AUTO','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',837),
+  ('storage_class_specifier -> REGISTER','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',838),
+  ('storage_class_specifier -> STATIC','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',839),
+  ('storage_class_specifier -> EXTERN','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',840),
+  ('storage_class_specifier -> TYPEDEF','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',841),
+  ('storage_class_specifier -> _THREAD_LOCAL','storage_class_specifier',1,'p_storage_class_specifier','c_parser.py',842),
+  ('function_specifier -> INLINE','function_specifier',1,'p_function_specifier','c_parser.py',847),
+  ('function_specifier -> _NORETURN','function_specifier',1,'p_function_specifier','c_parser.py',848),
+  ('type_specifier_no_typeid -> VOID','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',853),
+  ('type_specifier_no_typeid -> _BOOL','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',854),
+  ('type_specifier_no_typeid -> CHAR','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',855),
+  ('type_specifier_no_typeid -> SHORT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',856),
+  ('type_specifier_no_typeid -> INT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',857),
+  ('type_specifier_no_typeid -> LONG','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',858),
+  ('type_specifier_no_typeid -> FLOAT','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',859),
+  ('type_specifier_no_typeid -> DOUBLE','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',860),
+  ('type_specifier_no_typeid -> _COMPLEX','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',861),
+  ('type_specifier_no_typeid -> SIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',862),
+  ('type_specifier_no_typeid -> UNSIGNED','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',863),
+  ('type_specifier_no_typeid -> __INT128','type_specifier_no_typeid',1,'p_type_specifier_no_typeid','c_parser.py',864),
+  ('type_specifier -> typedef_name','type_specifier',1,'p_type_specifier','c_parser.py',869),
+  ('type_specifier -> enum_specifier','type_specifier',1,'p_type_specifier','c_parser.py',870),
+  ('type_specifier -> struct_or_union_specifier','type_specifier',1,'p_type_specifier','c_parser.py',871),
+  ('type_specifier -> type_specifier_no_typeid','type_specifier',1,'p_type_specifier','c_parser.py',872),
+  ('type_specifier -> atomic_specifier','type_specifier',1,'p_type_specifier','c_parser.py',873),
+  ('atomic_specifier -> _ATOMIC LPAREN type_name RPAREN','atomic_specifier',4,'p_atomic_specifier','c_parser.py',879),
+  ('type_qualifier -> CONST','type_qualifier',1,'p_type_qualifier','c_parser.py',886),
+  ('type_qualifier -> RESTRICT','type_qualifier',1,'p_type_qualifier','c_parser.py',887),
+  ('type_qualifier -> VOLATILE','type_qualifier',1,'p_type_qualifier','c_parser.py',888),
+  ('type_qualifier -> _ATOMIC','type_qualifier',1,'p_type_qualifier','c_parser.py',889),
+  ('init_declarator_list -> init_declarator','init_declarator_list',1,'p_init_declarator_list','c_parser.py',894),
+  ('init_declarator_list -> init_declarator_list COMMA init_declarator','init_declarator_list',3,'p_init_declarator_list','c_parser.py',895),
+  ('init_declarator -> declarator','init_declarator',1,'p_init_declarator','c_parser.py',903),
+  ('init_declarator -> declarator EQUALS initializer','init_declarator',3,'p_init_declarator','c_parser.py',904),
+  ('id_init_declarator_list -> id_init_declarator','id_init_declarator_list',1,'p_id_init_declarator_list','c_parser.py',909),
+  ('id_init_declarator_list -> id_init_declarator_list COMMA init_declarator','id_init_declarator_list',3,'p_id_init_declarator_list','c_parser.py',910),
+  ('id_init_declarator -> id_declarator','id_init_declarator',1,'p_id_init_declarator','c_parser.py',915),
+  ('id_init_declarator -> id_declarator EQUALS initializer','id_init_declarator',3,'p_id_init_declarator','c_parser.py',916),
+  ('specifier_qualifier_list -> specifier_qualifier_list type_specifier_no_typeid','specifier_qualifier_list',2,'p_specifier_qualifier_list_1','c_parser.py',923),
+  ('specifier_qualifier_list -> specifier_qualifier_list type_qualifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_2','c_parser.py',928),
+  ('specifier_qualifier_list -> type_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_3','c_parser.py',933),
+  ('specifier_qualifier_list -> type_qualifier_list type_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_4','c_parser.py',938),
+  ('specifier_qualifier_list -> alignment_specifier','specifier_qualifier_list',1,'p_specifier_qualifier_list_5','c_parser.py',943),
+  ('specifier_qualifier_list -> specifier_qualifier_list alignment_specifier','specifier_qualifier_list',2,'p_specifier_qualifier_list_6','c_parser.py',948),
+  ('struct_or_union_specifier -> struct_or_union ID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',956),
+  ('struct_or_union_specifier -> struct_or_union TYPEID','struct_or_union_specifier',2,'p_struct_or_union_specifier_1','c_parser.py',957),
+  ('struct_or_union_specifier -> struct_or_union brace_open struct_declaration_list brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_2','c_parser.py',967),
+  ('struct_or_union_specifier -> struct_or_union brace_open brace_close','struct_or_union_specifier',3,'p_struct_or_union_specifier_2','c_parser.py',968),
+  ('struct_or_union_specifier -> struct_or_union ID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',985),
+  ('struct_or_union_specifier -> struct_or_union ID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',986),
+  ('struct_or_union_specifier -> struct_or_union TYPEID brace_open struct_declaration_list brace_close','struct_or_union_specifier',5,'p_struct_or_union_specifier_3','c_parser.py',987),
+  ('struct_or_union_specifier -> struct_or_union TYPEID brace_open brace_close','struct_or_union_specifier',4,'p_struct_or_union_specifier_3','c_parser.py',988),
+  ('struct_or_union -> STRUCT','struct_or_union',1,'p_struct_or_union','c_parser.py',1004),
+  ('struct_or_union -> UNION','struct_or_union',1,'p_struct_or_union','c_parser.py',1005),
+  ('struct_declaration_list -> struct_declaration','struct_declaration_list',1,'p_struct_declaration_list','c_parser.py',1012),
+  ('struct_declaration_list -> struct_declaration_list struct_declaration','struct_declaration_list',2,'p_struct_declaration_list','c_parser.py',1013),
+  ('struct_declaration -> specifier_qualifier_list struct_declarator_list_opt SEMI','struct_declaration',3,'p_struct_declaration_1','c_parser.py',1021),
+  ('struct_declaration -> SEMI','struct_declaration',1,'p_struct_declaration_2','c_parser.py',1059),
+  ('struct_declaration -> pppragma_directive','struct_declaration',1,'p_struct_declaration_3','c_parser.py',1064),
+  ('struct_declarator_list -> struct_declarator','struct_declarator_list',1,'p_struct_declarator_list','c_parser.py',1069),
+  ('struct_declarator_list -> struct_declarator_list COMMA struct_declarator','struct_declarator_list',3,'p_struct_declarator_list','c_parser.py',1070),
+  ('struct_declarator -> declarator','struct_declarator',1,'p_struct_declarator_1','c_parser.py',1078),
+  ('struct_declarator -> declarator COLON constant_expression','struct_declarator',3,'p_struct_declarator_2','c_parser.py',1083),
+  ('struct_declarator -> COLON constant_expression','struct_declarator',2,'p_struct_declarator_2','c_parser.py',1084),
+  ('enum_specifier -> ENUM ID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1092),
+  ('enum_specifier -> ENUM TYPEID','enum_specifier',2,'p_enum_specifier_1','c_parser.py',1093),
+  ('enum_specifier -> ENUM brace_open enumerator_list brace_close','enum_specifier',4,'p_enum_specifier_2','c_parser.py',1098),
+  ('enum_specifier -> ENUM ID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1103),
+  ('enum_specifier -> ENUM TYPEID brace_open enumerator_list brace_close','enum_specifier',5,'p_enum_specifier_3','c_parser.py',1104),
+  ('enumerator_list -> enumerator','enumerator_list',1,'p_enumerator_list','c_parser.py',1109),
+  ('enumerator_list -> enumerator_list COMMA','enumerator_list',2,'p_enumerator_list','c_parser.py',1110),
+  ('enumerator_list -> enumerator_list COMMA enumerator','enumerator_list',3,'p_enumerator_list','c_parser.py',1111),
+  ('alignment_specifier -> _ALIGNAS LPAREN type_name RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1122),
+  ('alignment_specifier -> _ALIGNAS LPAREN constant_expression RPAREN','alignment_specifier',4,'p_alignment_specifier','c_parser.py',1123),
+  ('enumerator -> ID','enumerator',1,'p_enumerator','c_parser.py',1128),
+  ('enumerator -> ID EQUALS constant_expression','enumerator',3,'p_enumerator','c_parser.py',1129),
+  ('declarator -> id_declarator','declarator',1,'p_declarator','c_parser.py',1144),
+  ('declarator -> typeid_declarator','declarator',1,'p_declarator','c_parser.py',1145),
+  ('pointer -> TIMES type_qualifier_list_opt','pointer',2,'p_pointer','c_parser.py',1257),
+  ('pointer -> TIMES type_qualifier_list_opt pointer','pointer',3,'p_pointer','c_parser.py',1258),
+  ('type_qualifier_list -> type_qualifier','type_qualifier_list',1,'p_type_qualifier_list','c_parser.py',1287),
+  ('type_qualifier_list -> type_qualifier_list type_qualifier','type_qualifier_list',2,'p_type_qualifier_list','c_parser.py',1288),
+  ('parameter_type_list -> parameter_list','parameter_type_list',1,'p_parameter_type_list','c_parser.py',1293),
+  ('parameter_type_list -> parameter_list COMMA ELLIPSIS','parameter_type_list',3,'p_parameter_type_list','c_parser.py',1294),
+  ('parameter_list -> parameter_declaration','parameter_list',1,'p_parameter_list','c_parser.py',1302),
+  ('parameter_list -> parameter_list COMMA parameter_declaration','parameter_list',3,'p_parameter_list','c_parser.py',1303),
+  ('parameter_declaration -> declaration_specifiers id_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1322),
+  ('parameter_declaration -> declaration_specifiers typeid_noparen_declarator','parameter_declaration',2,'p_parameter_declaration_1','c_parser.py',1323),
+  ('parameter_declaration -> declaration_specifiers abstract_declarator_opt','parameter_declaration',2,'p_parameter_declaration_2','c_parser.py',1334),
+  ('identifier_list -> identifier','identifier_list',1,'p_identifier_list','c_parser.py',1366),
+  ('identifier_list -> identifier_list COMMA identifier','identifier_list',3,'p_identifier_list','c_parser.py',1367),
+  ('initializer -> assignment_expression','initializer',1,'p_initializer_1','c_parser.py',1376),
+  ('initializer -> brace_open initializer_list_opt brace_close','initializer',3,'p_initializer_2','c_parser.py',1381),
+  ('initializer -> brace_open initializer_list COMMA brace_close','initializer',4,'p_initializer_2','c_parser.py',1382),
+  ('initializer_list -> designation_opt initializer','initializer_list',2,'p_initializer_list','c_parser.py',1390),
+  ('initializer_list -> initializer_list COMMA designation_opt initializer','initializer_list',4,'p_initializer_list','c_parser.py',1391),
+  ('designation -> designator_list EQUALS','designation',2,'p_designation','c_parser.py',1402),
+  ('designator_list -> designator','designator_list',1,'p_designator_list','c_parser.py',1410),
+  ('designator_list -> designator_list designator','designator_list',2,'p_designator_list','c_parser.py',1411),
+  ('designator -> LBRACKET constant_expression RBRACKET','designator',3,'p_designator','c_parser.py',1416),
+  ('designator -> PERIOD identifier','designator',2,'p_designator','c_parser.py',1417),
+  ('type_name -> specifier_qualifier_list abstract_declarator_opt','type_name',2,'p_type_name','c_parser.py',1422),
+  ('abstract_declarator -> pointer','abstract_declarator',1,'p_abstract_declarator_1','c_parser.py',1434),
+  ('abstract_declarator -> pointer direct_abstract_declarator','abstract_declarator',2,'p_abstract_declarator_2','c_parser.py',1442),
+  ('abstract_declarator -> direct_abstract_declarator','abstract_declarator',1,'p_abstract_declarator_3','c_parser.py',1447),
+  ('direct_abstract_declarator -> LPAREN abstract_declarator RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_1','c_parser.py',1457),
+  ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_2','c_parser.py',1461),
+  ('direct_abstract_declarator -> LBRACKET type_qualifier_list_opt assignment_expression_opt RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_3','c_parser.py',1472),
+  ('direct_abstract_declarator -> direct_abstract_declarator LBRACKET TIMES RBRACKET','direct_abstract_declarator',4,'p_direct_abstract_declarator_4','c_parser.py',1482),
+  ('direct_abstract_declarator -> LBRACKET TIMES RBRACKET','direct_abstract_declarator',3,'p_direct_abstract_declarator_5','c_parser.py',1493),
+  ('direct_abstract_declarator -> direct_abstract_declarator LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',4,'p_direct_abstract_declarator_6','c_parser.py',1502),
+  ('direct_abstract_declarator -> LPAREN parameter_type_list_opt RPAREN','direct_abstract_declarator',3,'p_direct_abstract_declarator_7','c_parser.py',1512),
+  ('block_item -> declaration','block_item',1,'p_block_item','c_parser.py',1523),
+  ('block_item -> statement','block_item',1,'p_block_item','c_parser.py',1524),
+  ('block_item_list -> block_item','block_item_list',1,'p_block_item_list','c_parser.py',1531),
+  ('block_item_list -> block_item_list block_item','block_item_list',2,'p_block_item_list','c_parser.py',1532),
+  ('compound_statement -> brace_open block_item_list_opt brace_close','compound_statement',3,'p_compound_statement_1','c_parser.py',1538),
+  ('labeled_statement -> ID COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_1','c_parser.py',1544),
+  ('labeled_statement -> CASE constant_expression COLON pragmacomp_or_statement','labeled_statement',4,'p_labeled_statement_2','c_parser.py',1548),
+  ('labeled_statement -> DEFAULT COLON pragmacomp_or_statement','labeled_statement',3,'p_labeled_statement_3','c_parser.py',1552),
+  ('selection_statement -> IF LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_1','c_parser.py',1556),
+  ('selection_statement -> IF LPAREN expression RPAREN statement ELSE pragmacomp_or_statement','selection_statement',7,'p_selection_statement_2','c_parser.py',1560),
+  ('selection_statement -> SWITCH LPAREN expression RPAREN pragmacomp_or_statement','selection_statement',5,'p_selection_statement_3','c_parser.py',1564),
+  ('iteration_statement -> WHILE LPAREN expression RPAREN pragmacomp_or_statement','iteration_statement',5,'p_iteration_statement_1','c_parser.py',1569),
+  ('iteration_statement -> DO pragmacomp_or_statement WHILE LPAREN expression RPAREN SEMI','iteration_statement',7,'p_iteration_statement_2','c_parser.py',1573),
+  ('iteration_statement -> FOR LPAREN expression_opt SEMI expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',9,'p_iteration_statement_3','c_parser.py',1577),
+  ('iteration_statement -> FOR LPAREN declaration expression_opt SEMI expression_opt RPAREN pragmacomp_or_statement','iteration_statement',8,'p_iteration_statement_4','c_parser.py',1581),
+  ('jump_statement -> GOTO ID SEMI','jump_statement',3,'p_jump_statement_1','c_parser.py',1586),
+  ('jump_statement -> BREAK SEMI','jump_statement',2,'p_jump_statement_2','c_parser.py',1590),
+  ('jump_statement -> CONTINUE SEMI','jump_statement',2,'p_jump_statement_3','c_parser.py',1594),
+  ('jump_statement -> RETURN expression SEMI','jump_statement',3,'p_jump_statement_4','c_parser.py',1598),
+  ('jump_statement -> RETURN SEMI','jump_statement',2,'p_jump_statement_4','c_parser.py',1599),
+  ('expression_statement -> expression_opt SEMI','expression_statement',2,'p_expression_statement','c_parser.py',1604),
+  ('expression -> assignment_expression','expression',1,'p_expression','c_parser.py',1611),
+  ('expression -> expression COMMA assignment_expression','expression',3,'p_expression','c_parser.py',1612),
+  ('assignment_expression -> LPAREN compound_statement RPAREN','assignment_expression',3,'p_parenthesized_compound_expression','c_parser.py',1624),
+  ('typedef_name -> TYPEID','typedef_name',1,'p_typedef_name','c_parser.py',1628),
+  ('assignment_expression -> conditional_expression','assignment_expression',1,'p_assignment_expression','c_parser.py',1632),
+  ('assignment_expression -> unary_expression assignment_operator assignment_expression','assignment_expression',3,'p_assignment_expression','c_parser.py',1633),
+  ('assignment_operator -> EQUALS','assignment_operator',1,'p_assignment_operator','c_parser.py',1646),
+  ('assignment_operator -> XOREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1647),
+  ('assignment_operator -> TIMESEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1648),
+  ('assignment_operator -> DIVEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1649),
+  ('assignment_operator -> MODEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1650),
+  ('assignment_operator -> PLUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1651),
+  ('assignment_operator -> MINUSEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1652),
+  ('assignment_operator -> LSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1653),
+  ('assignment_operator -> RSHIFTEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1654),
+  ('assignment_operator -> ANDEQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1655),
+  ('assignment_operator -> OREQUAL','assignment_operator',1,'p_assignment_operator','c_parser.py',1656),
+  ('constant_expression -> conditional_expression','constant_expression',1,'p_constant_expression','c_parser.py',1661),
+  ('conditional_expression -> binary_expression','conditional_expression',1,'p_conditional_expression','c_parser.py',1665),
+  ('conditional_expression -> binary_expression CONDOP expression COLON conditional_expression','conditional_expression',5,'p_conditional_expression','c_parser.py',1666),
+  ('binary_expression -> cast_expression','binary_expression',1,'p_binary_expression','c_parser.py',1674),
+  ('binary_expression -> binary_expression TIMES binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1675),
+  ('binary_expression -> binary_expression DIVIDE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1676),
+  ('binary_expression -> binary_expression MOD binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1677),
+  ('binary_expression -> binary_expression PLUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1678),
+  ('binary_expression -> binary_expression MINUS binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1679),
+  ('binary_expression -> binary_expression RSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1680),
+  ('binary_expression -> binary_expression LSHIFT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1681),
+  ('binary_expression -> binary_expression LT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1682),
+  ('binary_expression -> binary_expression LE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1683),
+  ('binary_expression -> binary_expression GE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1684),
+  ('binary_expression -> binary_expression GT binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1685),
+  ('binary_expression -> binary_expression EQ binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1686),
+  ('binary_expression -> binary_expression NE binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1687),
+  ('binary_expression -> binary_expression AND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1688),
+  ('binary_expression -> binary_expression OR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1689),
+  ('binary_expression -> binary_expression XOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1690),
+  ('binary_expression -> binary_expression LAND binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1691),
+  ('binary_expression -> binary_expression LOR binary_expression','binary_expression',3,'p_binary_expression','c_parser.py',1692),
+  ('cast_expression -> unary_expression','cast_expression',1,'p_cast_expression_1','c_parser.py',1700),
+  ('cast_expression -> LPAREN type_name RPAREN cast_expression','cast_expression',4,'p_cast_expression_2','c_parser.py',1704),
+  ('unary_expression -> postfix_expression','unary_expression',1,'p_unary_expression_1','c_parser.py',1708),
+  ('unary_expression -> PLUSPLUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1712),
+  ('unary_expression -> MINUSMINUS unary_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1713),
+  ('unary_expression -> unary_operator cast_expression','unary_expression',2,'p_unary_expression_2','c_parser.py',1714),
+  ('unary_expression -> SIZEOF unary_expression','unary_expression',2,'p_unary_expression_3','c_parser.py',1719),
+  ('unary_expression -> SIZEOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1720),
+  ('unary_expression -> _ALIGNOF LPAREN type_name RPAREN','unary_expression',4,'p_unary_expression_3','c_parser.py',1721),
+  ('unary_operator -> AND','unary_operator',1,'p_unary_operator','c_parser.py',1729),
+  ('unary_operator -> TIMES','unary_operator',1,'p_unary_operator','c_parser.py',1730),
+  ('unary_operator -> PLUS','unary_operator',1,'p_unary_operator','c_parser.py',1731),
+  ('unary_operator -> MINUS','unary_operator',1,'p_unary_operator','c_parser.py',1732),
+  ('unary_operator -> NOT','unary_operator',1,'p_unary_operator','c_parser.py',1733),
+  ('unary_operator -> LNOT','unary_operator',1,'p_unary_operator','c_parser.py',1734),
+  ('postfix_expression -> primary_expression','postfix_expression',1,'p_postfix_expression_1','c_parser.py',1739),
+  ('postfix_expression -> postfix_expression LBRACKET expression RBRACKET','postfix_expression',4,'p_postfix_expression_2','c_parser.py',1743),
+  ('postfix_expression -> postfix_expression LPAREN argument_expression_list RPAREN','postfix_expression',4,'p_postfix_expression_3','c_parser.py',1747),
+  ('postfix_expression -> postfix_expression LPAREN RPAREN','postfix_expression',3,'p_postfix_expression_3','c_parser.py',1748),
+  ('postfix_expression -> postfix_expression PERIOD ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1753),
+  ('postfix_expression -> postfix_expression PERIOD TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1754),
+  ('postfix_expression -> postfix_expression ARROW ID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1755),
+  ('postfix_expression -> postfix_expression ARROW TYPEID','postfix_expression',3,'p_postfix_expression_4','c_parser.py',1756),
+  ('postfix_expression -> postfix_expression PLUSPLUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1762),
+  ('postfix_expression -> postfix_expression MINUSMINUS','postfix_expression',2,'p_postfix_expression_5','c_parser.py',1763),
+  ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list brace_close','postfix_expression',6,'p_postfix_expression_6','c_parser.py',1768),
+  ('postfix_expression -> LPAREN type_name RPAREN brace_open initializer_list COMMA brace_close','postfix_expression',7,'p_postfix_expression_6','c_parser.py',1769),
+  ('primary_expression -> identifier','primary_expression',1,'p_primary_expression_1','c_parser.py',1774),
+  ('primary_expression -> constant','primary_expression',1,'p_primary_expression_2','c_parser.py',1778),
+  ('primary_expression -> unified_string_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1782),
+  ('primary_expression -> unified_wstring_literal','primary_expression',1,'p_primary_expression_3','c_parser.py',1783),
+  ('primary_expression -> LPAREN expression RPAREN','primary_expression',3,'p_primary_expression_4','c_parser.py',1788),
+  ('primary_expression -> OFFSETOF LPAREN type_name COMMA offsetof_member_designator RPAREN','primary_expression',6,'p_primary_expression_5','c_parser.py',1792),
+  ('offsetof_member_designator -> identifier','offsetof_member_designator',1,'p_offsetof_member_designator','c_parser.py',1800),
+  ('offsetof_member_designator -> offsetof_member_designator PERIOD identifier','offsetof_member_designator',3,'p_offsetof_member_designator','c_parser.py',1801),
+  ('offsetof_member_designator -> offsetof_member_designator LBRACKET expression RBRACKET','offsetof_member_designator',4,'p_offsetof_member_designator','c_parser.py',1802),
+  ('argument_expression_list -> assignment_expression','argument_expression_list',1,'p_argument_expression_list','c_parser.py',1814),
+  ('argument_expression_list -> argument_expression_list COMMA assignment_expression','argument_expression_list',3,'p_argument_expression_list','c_parser.py',1815),
+  ('identifier -> ID','identifier',1,'p_identifier','c_parser.py',1824),
+  ('constant -> INT_CONST_DEC','constant',1,'p_constant_1','c_parser.py',1828),
+  ('constant -> INT_CONST_OCT','constant',1,'p_constant_1','c_parser.py',1829),
+  ('constant -> INT_CONST_HEX','constant',1,'p_constant_1','c_parser.py',1830),
+  ('constant -> INT_CONST_BIN','constant',1,'p_constant_1','c_parser.py',1831),
+  ('constant -> INT_CONST_CHAR','constant',1,'p_constant_1','c_parser.py',1832),
+  ('constant -> FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1851),
+  ('constant -> HEX_FLOAT_CONST','constant',1,'p_constant_2','c_parser.py',1852),
+  ('constant -> CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1868),
+  ('constant -> WCHAR_CONST','constant',1,'p_constant_3','c_parser.py',1869),
+  ('constant -> U8CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1870),
+  ('constant -> U16CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1871),
+  ('constant -> U32CHAR_CONST','constant',1,'p_constant_3','c_parser.py',1872),
+  ('unified_string_literal -> STRING_LITERAL','unified_string_literal',1,'p_unified_string_literal','c_parser.py',1883),
+  ('unified_string_literal -> unified_string_literal STRING_LITERAL','unified_string_literal',2,'p_unified_string_literal','c_parser.py',1884),
+  ('unified_wstring_literal -> WSTRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1894),
+  ('unified_wstring_literal -> U8STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1895),
+  ('unified_wstring_literal -> U16STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1896),
+  ('unified_wstring_literal -> U32STRING_LITERAL','unified_wstring_literal',1,'p_unified_wstring_literal','c_parser.py',1897),
+  ('unified_wstring_literal -> unified_wstring_literal WSTRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1898),
+  ('unified_wstring_literal -> unified_wstring_literal U8STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1899),
+  ('unified_wstring_literal -> unified_wstring_literal U16STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1900),
+  ('unified_wstring_literal -> unified_wstring_literal U32STRING_LITERAL','unified_wstring_literal',2,'p_unified_wstring_literal','c_parser.py',1901),
+  ('brace_open -> LBRACE','brace_open',1,'p_brace_open','c_parser.py',1911),
+  ('brace_close -> RBRACE','brace_close',1,'p_brace_close','c_parser.py',1917),
+  ('empty -> <empty>','empty',0,'p_empty','c_parser.py',1923),
+]
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/AUTHORS.txt b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/AUTHORS.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0360f988f2b533c1d9acd1563018f2bcee8a85b4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/AUTHORS.txt
@@ -0,0 +1,590 @@
+@Switch01
+A_Rog
+Aakanksha Agrawal
+Abhinav Sagar
+ABHYUDAY PRATAP SINGH
+abs51295
+AceGentile
+Adam Chainz
+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
+Alli
+Ami Fischman
+Ananya Maiti
+Anatoly Techtonik
+Anders Kaseorg
+Andre Aguiar
+Andreas Lutro
+Andrei Geacar
+Andrew Gaul
+Andrey Bulgakov
+Andrés Delfino
+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
+Anudit Nagar
+Anuj Godase
+AQNOUCH Mohammed
+AraHaan
+Arindam Choudhury
+Armin Ronacher
+Artem
+Ashley Manton
+Ashwin Ramaswami
+atse
+Atsushi Odagiri
+Avinash Karhana
+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
+Bernard
+Bernard Tyers
+Bernardo B. Marques
+Bernhard M. Wiedemann
+Bertil Hatt
+Bhavam Vidyarthi
+Bogdan Opanchuk
+BorisZZZ
+Brad Erickson
+Bradley Ayers
+Brandon L. Reiss
+Brandt Bucher
+Brett Randall
+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
+Chris Brinker
+Chris Hunt
+Chris Jerdonek
+Chris McDonough
+Chris Wolfe
+Christian Clauss
+Christian Heimes
+Christian Oudard
+Christoph Reiter
+Christopher Hunt
+Christopher Snyder
+cjc7373
+Clark Boylan
+Clay McClure
+Cody
+Cody Soyland
+Colin Watson
+Connor Osborn
+Cooper Lees
+Cooper Ry Lees
+Cory Benfield
+Cory Wright
+Craig Kerstiens
+Cristian Sorinel
+Cristina
+Cristina Muñoz
+Curtis Doty
+cytolentino
+Damian Quiroga
+Dan Black
+Dan Savilonis
+Dan Sully
+daniel
+Daniel Collins
+Daniel Hahler
+Daniel Holth
+Daniel Jost
+Daniel Katz
+Daniel Shaulov
+Daniele Esposti
+Daniele Procida
+Danny Hermes
+Danny McClanahan
+Dav Clark
+Dave Abrahams
+Dave Jones
+David Aguilar
+David Black
+David Bordeynik
+David Caro
+David Evans
+David Linke
+David Poggi
+David Pursehouse
+David Tucker
+David Wales
+Davidovich
+Deepak Sharma
+derwolfe
+Desetude
+Devesh Kumar Singh
+Diego Caraballo
+DiegoCaraballo
+Dmitry Gladkov
+Domen Kožar
+Donald Stufft
+Dongweiming
+Douglas Thor
+DrFeathers
+Dustin Ingram
+Dwayne Bailey
+Ed Morley
+Eitan Adler
+ekristina
+elainechan
+Eli Schwartz
+Elisha Hollander
+Ellen Marie Dash
+Emil Burzo
+Emil Styrke
+Emmanuel Arias
+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
+Filipe Laíns
+Florian Briand
+Florian Rathgeber
+Francesco
+Francesco Montesano
+Frost Ming
+Gabriel Curio
+Gabriel de Perthuis
+Garry Polley
+gdanielson
+Geoffrey Sneddon
+George Song
+Georgi Valkov
+ghost
+Giftlin Rajaiah
+gizmoguy1
+gkdoc
+Gopinath M
+GOTO Hayato
+gpiks
+Greg Ward
+Guilherme Espada
+gutsytechster
+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
+Igor Kuzmitshov
+Igor Sobreira
+Ilan Schnell
+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 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 T. Wodder II
+John-Scott Atlakson
+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
+Jussi Kukkonen
+jwg4
+Jyrki Pulliainen
+Kai Chen
+Kamal Bin Mustafa
+kaustav haldar
+keanemind
+Keith Maxwell
+Kelsey Hightower
+Kenneth Belitzky
+Kenneth Reitz
+Kevin Burke
+Kevin Carter
+Kevin Frommelt
+Kevin R Patterson
+Kexuan Sun
+Kit Randel
+KOLANICH
+kpinc
+Krishna Oza
+Kumar McMillan
+Kyle Persohn
+lakshmanaram
+Laszlo Kiss-Kollar
+Laurent Bristiel
+Laurie O
+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
+Marc Abramowitz
+Marc Tamlyn
+Marcus Smith
+Mariatta
+Mark Kohler
+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
+mdebi
+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
+Nguyễn Gia Phong
+Nick Coghlan
+Nick Stenning
+Nick Timkovich
+Nicolas Bock
+Nicole Harris
+Nikhil Benesch
+Nikolay Korolev
+Nitesh Sharma
+Noah
+Noah Gorny
+Nowell Strite
+NtaleGrey
+nvdv
+Ofekmeister
+ofrinevo
+Oliver Jeeves
+Oliver Mannion
+Oliver Tonnhofer
+Olivier Girardot
+Olivier Grisel
+Ollie Rutherfurd
+OMOTO Kenji
+Omry Yadan
+onlinejudge95
+Oren Held
+Oscar Benjamin
+Oz N Tiram
+Pachwenko
+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
+Pawel Jasinski
+Pekka Klärck
+Peter Lisák
+Peter Waller
+petr-tik
+Phaneendra Chiruvella
+Phil Elson
+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
+Prashant Sharma
+Pratik Mallya
+Preet Thakkar
+Preston Holmes
+Przemek Wrzos
+Pulkit Goyal
+Qiangning Hong
+Quentin Pradet
+R. David Murray
+Rafael Caricio
+Ralf Schmitt
+Razzi Abuissa
+rdb
+Reece Dunham
+Remi Rampin
+Rene Dudfield
+Riccardo Magliocchetti
+Richard Jones
+Ricky Ng-Adam
+RobberPhex
+Robert Collins
+Robert McGibbon
+Robert T. McGibbon
+robin elisha robinson
+Roey Berman
+Rohan Jain
+Roman Bogorodskiy
+Romuald Brunet
+Ronny Pfannschmidt
+Rory McCann
+Ross Brattain
+Roy Wellington Ⅳ
+Ruairidh MacLeod
+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
+shireenrao
+Shlomi Fish
+Shovan Maity
+Simeon Visser
+Simon Cross
+Simon Pichugin
+sinoroc
+sinscary
+socketubs
+Sorin Sbarnea
+Srinivas Nyayapati
+Stavros Korokithakis
+Stefan Scherfke
+Stefano Rivera
+Stephan Erb
+stepshal
+Steve (Gadget) Barnes
+Steve Barnes
+Steve Dower
+Steve Kowalik
+Steven Myint
+stonebig
+Stéphane Bidoul
+Stéphane Bidoul (ACSONE)
+Stéphane Klein
+Sumana Harihareswara
+Surbhi Sharma
+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 Hrnciar
+Tomas Orsava
+Tomer Chachamu
+Tony Beswick
+Tony Zhaocheng Tan
+TonyBeswick
+toonarmycaptain
+Toshio Kuratomi
+toxinu
+Travis Swicegood
+Tzu-ping Chung
+Valentin Haenel
+Victor Stinner
+victorvpaulo
+Vikram - Google
+Viktor Szépe
+Ville Skyttä
+Vinay Sajip
+Vincent Philippon
+Vinicyus Macedo
+Vipul Kumar
+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
+xoviat
+xtreak
+YAMAMOTO Takashi
+Yen Chi Hsuan
+Yeray Diaz Diaz
+Yoval P
+Yu Jian
+Yuan Jing Vincent Yan
+Zearin
+Zhiping Deng
+Zvezdan Petkovic
+Łukasz Langa
+Семён Марьясин
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/LICENSE.txt b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/LICENSE.txt
new file mode 100644
index 0000000000000000000000000000000000000000..75eb0fd80b08c55e9dac4cc6ff6557ca4892eed0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2008-2020 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/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..a1a8d09397e6415f8c5a5910c9d7e397eb66b671
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/METADATA
@@ -0,0 +1,82 @@
+Metadata-Version: 2.1
+Name: setuptools
+Version: 44.1.1
+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
+<https://packaging.python.org/installing/>`_ 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 <http://mail.python.org/pipermail/distutils-sig/>`_.
+Bug reports and especially tested patches may be
+submitted directly to the `bug tracker
+<https://github.com/pypa/setuptools/issues>`_.
+
+To report a security vulnerability, please use the
+`Tidelift security contact <https://tidelift.com/security>`_.
+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 <https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=referral&utm_campaign=github>`_.
+
+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 <https://www.pypa.io/en/latest/code-of-conduct/>`_.
+
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..a3e32d75aeffeb9c7b1dc1a8a2d1719dfd787954
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/RECORD
@@ -0,0 +1,164 @@
+../../../bin/easy_install,sha256=eEp8YDxQKbLtoSCpLCRndhvk4akeArsUZlNuh3wl8Ao,286
+../../../bin/easy_install-3.9,sha256=eEp8YDxQKbLtoSCpLCRndhvk4akeArsUZlNuh3wl8Ao,286
+__pycache__/easy_install.cpython-39.pyc,,
+easy_install.py,sha256=MDC9vt5AxDsXX5qcKlBz2TnW6Tpuv_AobnfhCJ9X3PM,126
+setuptools-44.1.1.dist-info/AUTHORS.txt,sha256=ilkpJ4nuW3rRgU3fX4EufclaM4Y7RsZu5uOu0oizmNM,8036
+setuptools-44.1.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+setuptools-44.1.1.dist-info/LICENSE.txt,sha256=gdAS_gPyTUkBTvvgoNNlG9Mv1KFDTig6W1JdeMD2Efg,1090
+setuptools-44.1.1.dist-info/METADATA,sha256=2AxMds4jCrvXAyK2UO21ULfMbAvTyonMZlYm-L9cx7c,3523
+setuptools-44.1.1.dist-info/RECORD,,
+setuptools-44.1.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
+setuptools-44.1.1.dist-info/WHEEL,sha256=kGT74LWyRUZrL4VgLh6_g12IeVl_9u9ZVhadrgXZUEY,110
+setuptools-44.1.1.dist-info/dependency_links.txt,sha256=HlkCFkoK5TbZ5EMLbLKYhLcY_E31kBWD8TqW2EgmatQ,239
+setuptools-44.1.1.dist-info/entry_points.txt,sha256=ZmIqlp-SBdsBS2cuetmU2NdSOs4DG0kxctUR9UJ8Xk0,3150
+setuptools-44.1.1.dist-info/top_level.txt,sha256=2HUXVVwA4Pff1xgTFr3GsTXXKaPaO6vlG6oNJ_4u4Tg,38
+setuptools-44.1.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
+setuptools/__init__.py,sha256=0SDEgF1acybGfdxJvyjgeAPKC-3-hoYrLKRw8y4YmLQ,7795
+setuptools/__pycache__/__init__.cpython-39.pyc,,
+setuptools/__pycache__/_deprecation_warning.cpython-39.pyc,,
+setuptools/__pycache__/_imp.cpython-39.pyc,,
+setuptools/__pycache__/archive_util.cpython-39.pyc,,
+setuptools/__pycache__/build_meta.cpython-39.pyc,,
+setuptools/__pycache__/config.cpython-39.pyc,,
+setuptools/__pycache__/dep_util.cpython-39.pyc,,
+setuptools/__pycache__/depends.cpython-39.pyc,,
+setuptools/__pycache__/dist.cpython-39.pyc,,
+setuptools/__pycache__/errors.cpython-39.pyc,,
+setuptools/__pycache__/extension.cpython-39.pyc,,
+setuptools/__pycache__/glob.cpython-39.pyc,,
+setuptools/__pycache__/installer.cpython-39.pyc,,
+setuptools/__pycache__/launch.cpython-39.pyc,,
+setuptools/__pycache__/lib2to3_ex.cpython-39.pyc,,
+setuptools/__pycache__/monkey.cpython-39.pyc,,
+setuptools/__pycache__/msvc.cpython-39.pyc,,
+setuptools/__pycache__/namespaces.cpython-39.pyc,,
+setuptools/__pycache__/package_index.cpython-39.pyc,,
+setuptools/__pycache__/py27compat.cpython-39.pyc,,
+setuptools/__pycache__/py31compat.cpython-39.pyc,,
+setuptools/__pycache__/py33compat.cpython-39.pyc,,
+setuptools/__pycache__/py34compat.cpython-39.pyc,,
+setuptools/__pycache__/sandbox.cpython-39.pyc,,
+setuptools/__pycache__/site-patch.cpython-39.pyc,,
+setuptools/__pycache__/ssl_support.cpython-39.pyc,,
+setuptools/__pycache__/unicode_utils.cpython-39.pyc,,
+setuptools/__pycache__/version.cpython-39.pyc,,
+setuptools/__pycache__/wheel.cpython-39.pyc,,
+setuptools/__pycache__/windows_support.cpython-39.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-39.pyc,,
+setuptools/_vendor/__pycache__/ordered_set.cpython-39.pyc,,
+setuptools/_vendor/__pycache__/pyparsing.cpython-39.pyc,,
+setuptools/_vendor/__pycache__/six.cpython-39.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-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/__init__.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/_compat.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/_structures.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/markers.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/requirements.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/tags.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/utils.cpython-39.pyc,,
+setuptools/_vendor/packaging/__pycache__/version.cpython-39.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=MQWILThG6texTPLol6icwM83h8V8TLbg0QCacFRt33k,9887
+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-39.pyc,,
+setuptools/command/__pycache__/alias.cpython-39.pyc,,
+setuptools/command/__pycache__/bdist_egg.cpython-39.pyc,,
+setuptools/command/__pycache__/bdist_rpm.cpython-39.pyc,,
+setuptools/command/__pycache__/bdist_wininst.cpython-39.pyc,,
+setuptools/command/__pycache__/build_clib.cpython-39.pyc,,
+setuptools/command/__pycache__/build_ext.cpython-39.pyc,,
+setuptools/command/__pycache__/build_py.cpython-39.pyc,,
+setuptools/command/__pycache__/develop.cpython-39.pyc,,
+setuptools/command/__pycache__/dist_info.cpython-39.pyc,,
+setuptools/command/__pycache__/easy_install.cpython-39.pyc,,
+setuptools/command/__pycache__/egg_info.cpython-39.pyc,,
+setuptools/command/__pycache__/install.cpython-39.pyc,,
+setuptools/command/__pycache__/install_egg_info.cpython-39.pyc,,
+setuptools/command/__pycache__/install_lib.cpython-39.pyc,,
+setuptools/command/__pycache__/install_scripts.cpython-39.pyc,,
+setuptools/command/__pycache__/py36compat.cpython-39.pyc,,
+setuptools/command/__pycache__/register.cpython-39.pyc,,
+setuptools/command/__pycache__/rotate.cpython-39.pyc,,
+setuptools/command/__pycache__/saveopts.cpython-39.pyc,,
+setuptools/command/__pycache__/sdist.cpython-39.pyc,,
+setuptools/command/__pycache__/setopt.cpython-39.pyc,,
+setuptools/command/__pycache__/test.cpython-39.pyc,,
+setuptools/command/__pycache__/upload.cpython-39.pyc,,
+setuptools/command/__pycache__/upload_docs.cpython-39.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=8k4kJcOp_ZMxZ1sZYmle5_OAtNYLXGjrbWOj-IPjvwY,13023
+setuptools/command/build_py.py,sha256=yWyYaaS9F3o9JbIczn064A5g1C5_UiKRDxGaTqYbtLE,9596
+setuptools/command/develop.py,sha256=B3-ImHP30Bxnqx-s_9Dp-fxtHhE245ACE1W5hmKY9xE,8188
+setuptools/command/dist_info.py,sha256=5t6kOfrdgALT-P3ogss6PF9k-Leyesueycuk3dUyZnI,960
+setuptools/command/easy_install.py,sha256=QU5oxbZC1COqfiBk3m39yB__bG4YwDtWoNEC8GKFyHo,89907
+setuptools/command/egg_info.py,sha256=dnFO_LBQFIZHCfX9_ke_Mtc6s78CrKIpqeiqlFASB0w,25582
+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=14kBw_QOZ9L_RQDqgf9DAlEuoj0zC30X5mfDWeiyZwU,8092
+setuptools/command/setopt.py,sha256=NTWDyx-gjDF-txf4dO577s7LOzHVoKR0Mq33rFxaRr8,5085
+setuptools/command/test.py,sha256=MahF7jRBGYwgM-fdPBLyBpfCqR5ZXSGexPVR-afV3Vc,9610
+setuptools/command/upload.py,sha256=XT3YFVfYPAmA5qhGg0euluU98ftxRUW-PzKcODMLxUs,462
+setuptools/command/upload_docs.py,sha256=O137bN9dt_sELevf4vwuwWRkogHf4bPXc-jNRxVQaiw,7315
+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=WiypLfe-bt358W15a53L-KoO_35xK55EXPbmuTtgBYo,49885
+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-39.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=6pb-B1POtHyLycAbkDETk4fO-Qv8_sY-rjTXhUOoh6k,40605
+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/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/REQUESTED b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/REQUESTED
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..ef99c6cf3283b50a273ac4c6d009a0aa85597070
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/WHEEL
@@ -0,0 +1,6 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/dependency_links.txt b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/dependency_links.txt
new file mode 100644
index 0000000000000000000000000000000000000000..e87d02103ede91545d70783dd59653d183424b68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/dependency_links.txt
@@ -0,0 +1,2 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/entry_points.txt b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/entry_points.txt
new file mode 100644
index 0000000000000000000000000000000000000000..0fed3f1d83f3eb690dddad3f050da3d3f021eb6a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/entry_points.txt
@@ -0,0 +1,68 @@
+[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/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..4577c6a795e510bf7578236665f582c3770fb42e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/top_level.txt
@@ -0,0 +1,3 @@
+easy_install
+pkg_resources
+setuptools
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/zip-safe b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/zip-safe
new file mode 100644
index 0000000000000000000000000000000000000000..8b137891791fe96927ad78e64b0aad7bded08bdc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools-44.1.1.dist-info/zip-safe
@@ -0,0 +1 @@
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__init__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..9d8ae1ed5f5e3702903589d4ff6c8b9807c894ac
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/__init__.py
@@ -0,0 +1,245 @@
+"""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`.
+    class MinimalDistribution(distutils.core.Distribution):
+        """
+        A minimal version of a distribution for supporting the
+        fetch_build_eggs interface.
+        """
+        def __init__(self, attrs):
+            _incl = 'dependency_links', 'setup_requires'
+            filtered = {
+                k: attrs[k]
+                for k in set(_incl) & set(attrs)
+            }
+            distutils.core.Distribution.__init__(self, filtered)
+
+        def finalize_options(self):
+            """
+            Disable finalize_options to avoid building the working set.
+            Ref #2158.
+            """
+
+    dist = MinimalDistribution(attrs)
+
+    # 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/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..35b43b540281a1d9412e612be1a4c2c29247a700
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..30af1e45bcde7472a26750f71b1b5b1c5c783fec
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_deprecation_warning.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_imp.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_imp.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..156744adc27ea6549187d3027d524fce94bd3bff
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/_imp.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/archive_util.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/archive_util.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1fc2d5b7d56ea530494acf532cf3f452ab92ab8f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/archive_util.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/build_meta.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/build_meta.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..7410beecdd7a71615589720dc55623e15fabcf56
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/build_meta.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/config.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/config.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9964bf0a7815cce73d8919ce3a3de3709f94b4b5
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/config.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dep_util.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dep_util.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..21d82227231cb1cf2d0c505c6936aec7f9d69487
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dep_util.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/depends.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/depends.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fcc943e63a479dcdeea5bbbc3511ede752154874
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/depends.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dist.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dist.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..33f4aaba5a197838d6cddbb1165ec4cc94b280df
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/dist.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/errors.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/errors.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6cde54ee4a05bb2531a84649316912e6c855d1b6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/errors.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/extension.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/extension.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..841d0dd930190f38a83f789a84fff4e6a178a8a1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/extension.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/glob.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/glob.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5c7d386f72fb4959ae8756b7c5f5be0dfdb411a6
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/glob.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/installer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/installer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3e346db6d6f8f05fc941024f60093e74db4b823d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/installer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/launch.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/launch.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..02ba5655e667c55e83bfad039879b8325c133e29
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/launch.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cdc5749922e9176383b9f8ea078cd605f9aa29bd
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/lib2to3_ex.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/monkey.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/monkey.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..19219588970bf19e1f335ed7e05033776e05b847
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/monkey.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/msvc.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/msvc.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a30c1b1bc3a26cdf7fe9d277876628db1ba7b9f3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/msvc.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/namespaces.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/namespaces.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ffc6be4100a654c1facb8ff72825a38045ed985e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/namespaces.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/package_index.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/package_index.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4094261f740821ee3ffa22eed6017f73d3b9ecf7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/package_index.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py27compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py27compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..906df791c2dc8921f6a59fecaca2d4d08aa9cce0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py27compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py31compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py31compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..935c4a7c89591d378f81f96b7821d12895266981
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py31compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py33compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py33compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..194b9a5fab31903fd0c022789dde96f9b94fbd90
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py33compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py34compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py34compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4c07c477f7765a7508d72a9a7a8b519aadb64b33
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/py34compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/sandbox.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/sandbox.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..fbedff2b106d8793f717ce03466ee1b759ef69ab
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/sandbox.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/site-patch.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/site-patch.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2ba3c7164b0f4df12f22271f27bff6692cffa66e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/site-patch.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/ssl_support.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/ssl_support.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3019f4aa77e15f7a457c512a85922e13c1828697
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/ssl_support.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/unicode_utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/unicode_utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b6ad8f38715f90363bf3bf1347f4ff13e11dc54c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/unicode_utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dc8127e02129ce511bbda1f90c6863d191193c8d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/wheel.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/wheel.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a14fee3ea386af1d5631604d8c7b768dec153e8d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/wheel.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/windows_support.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/windows_support.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..28d3799206d56c320bad04df6821888cb0b93af7
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/__pycache__/windows_support.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_deprecation_warning.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_deprecation_warning.py
new file mode 100644
index 0000000000000000000000000000000000000000..086b64dd3817c0c1a194ffc1959eeffdd2695bef
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_deprecation_warning.py
@@ -0,0 +1,7 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/_imp.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_imp.py
new file mode 100644
index 0000000000000000000000000000000000000000..a3cce9b284b1e580c1715c5e300a18077d63e8ce
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_imp.py
@@ -0,0 +1,73 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__init__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3110512c996ba51cb3f8dbb8471c722c3c59f339
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..0617636f27d330cdd61c988a48b7028c09494a62
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/ordered_set.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..a5c95ae05657ce8982b157f108880c6e9bc18337
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/pyparsing.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/six.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/six.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..48416790e7efc45109fbd9c48ada6309adc6f6d9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/__pycache__/six.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/ordered_set.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/ordered_set.py
new file mode 100644
index 0000000000000000000000000000000000000000..14876000de895a609d5b9f3de39c3c8fc44ef1fc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/ordered_set.py
@@ -0,0 +1,488 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__about__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__about__.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc95138d049ba3194964d528b552a6d1514fa382
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__about__.py
@@ -0,0 +1,27 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__init__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..a0cf67df5245be16a020ca048832e180f7ce8661
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__init__.py
@@ -0,0 +1,26 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cd96a515cfbca060c2bbb77595debb5b180e3e0f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__about__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9d0b3a1fe2f0121abd7785c68b2460b7244fa5b9
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..6c3714a0ddf233d484570e5b248e459a2d68644e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e5303276ed1f435b45efcc0d60a39f421136b9ad
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/_structures.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..360dcdb5b99da82930adba2ee670af03dfefe4f3
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/markers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..3dfff733b55cee70fc8773ca22a66f31d91a9e19
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/requirements.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..683839d6e0d80b5e9496e12166e17d3b5dd983b1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/specifiers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d1e246a43741d354c74e80e2b397b34322ab26c1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/tags.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b32b5b59899016ddaa22ec9c7c078133eba8a57f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/utils.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f9ed630d8c5b60942d76d8bad35850c8786060b0
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/__pycache__/version.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..25da473c196855ad59a6d2d785ef1ddef49795be
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_compat.py
@@ -0,0 +1,31 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_structures.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_structures.py
new file mode 100644
index 0000000000000000000000000000000000000000..68dcca634d8e3f0081bad2f9ae5e653a2942db68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/_structures.py
@@ -0,0 +1,68 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/markers.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/markers.py
new file mode 100644
index 0000000000000000000000000000000000000000..4bdfdb24f2096eac046bb9a576065bb96cfd476e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/markers.py
@@ -0,0 +1,296 @@
+# 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 "<Marker({0!r})>".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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py
new file mode 100644
index 0000000000000000000000000000000000000000..8a0c2cb9be06e633b26c7205d6efe42827835910
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/requirements.py
@@ -0,0 +1,138 @@
+# 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 "<Requirement({0!r})>".format(str(self))
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/specifiers.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/specifiers.py
new file mode 100644
index 0000000000000000000000000000000000000000..743576a080a0af8d0995f307ea6afc645b13ca61
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/specifiers.py
@@ -0,0 +1,749 @@
+# 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<operator>(==|!=|<=|>=|<|>))
+        \s*
+        (?P<version>
+            [^,;\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<operator>(~=|==|!=|<=|>=|<|>|===))
+        (?P<version>
+            (?:
+                # 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.
+                (?<!==|!=|~=)         # We have special cases for these
+                                      # operators so we want to make sure they
+                                      # don't match here.
+
+                \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]*)
+                )?
+                (?:[-_\.]?dev[-_\.]?[0-9]*)?          # dev release
+            )
+        )
+        """
+
+    _regex = re.compile(r"^\s*" + _regex_str + r"\s*$", re.VERBOSE | re.IGNORECASE)
+
+    _operators = {
+        "~=": "compatible",
+        "==": "equal",
+        "!=": "not_equal",
+        "<=": "less_than_equal",
+        ">=": "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 "<SpecifierSet({0!r}{1})>".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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/tags.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/tags.py
new file mode 100644
index 0000000000000000000000000000000000000000..ec9942f0f6627f34554082a8c0909bc70bd2a260
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/tags.py
@@ -0,0 +1,404 @@
+# 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-<platform>
+    - <interpreter>-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<major>[0-9]+)\.(?P<minor>[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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/utils.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..88418786933b8bc5f6179b8e191f60f79efd7074
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/utils.py
@@ -0,0 +1,57 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/version.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..95157a1f78c26829ffbe1bd2463f7735b636d16f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/packaging/version.py
@@ -0,0 +1,420 @@
+# 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 "<LegacyVersion({0})>".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<epoch>[0-9]+)!)?                           # epoch
+        (?P<release>[0-9]+(?:\.[0-9]+)*)                  # release segment
+        (?P<pre>                                          # pre-release
+            [-_\.]?
+            (?P<pre_l>(a|b|c|rc|alpha|beta|pre|preview))
+            [-_\.]?
+            (?P<pre_n>[0-9]+)?
+        )?
+        (?P<post>                                         # post release
+            (?:-(?P<post_n1>[0-9]+))
+            |
+            (?:
+                [-_\.]?
+                (?P<post_l>post|rev|r)
+                [-_\.]?
+                (?P<post_n2>[0-9]+)?
+            )
+        )?
+        (?P<dev>                                          # dev release
+            [-_\.]?
+            (?P<dev_l>dev)
+            [-_\.]?
+            (?P<dev_n>[0-9]+)?
+        )?
+    )
+    (?:\+(?P<local>[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 "<Version({0})>".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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/pyparsing.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/pyparsing.py
new file mode 100644
index 0000000000000000000000000000000000000000..cf75e1e5fcbfe7eac41d2a9e446c5c980741087b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/pyparsing.py
@@ -0,0 +1,5742 @@
+# 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{"<salutation>, <addressee>!"}), built up using L{Word}, L{Literal}, and L{And} elements 
+(L{'+'<ParserElement.__add__>} 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<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{'+'<And>}, L{'|'<MatchFirst>}, L{'^'<Or>}, and L{'&'<Each>} 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 <ptmcg@users.sourceforge.net>"
+
+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<And._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.<resultsName>} - 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) # -> <class 'pyparsing.ParseResults'> ['sldkj', 'lsdkj', 'sldkj']
+            
+            # Use asList() to create an actual list
+            result_list = result.asList()
+            print(type(result_list), result_list) # -> <class '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)) # -> <class 'pyparsing.ParseResults'> (['12', '/', '31', '/', '1999'], {'day': [('1999', 4)], 'year': [('12', 0)], 'month': [('31', 2)]})
+            
+            result_dict = result.asDict()
+            print(type(result_dict), repr(result_dict)) # -> <class '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,
+                                                "</", resTag, ">" ]
+
+        out += [ nl, indent, "</", selfTag, ">" ]
+        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}<ParserElement.parseString>} for more information
+   on parsing strings containing C{<TAB>}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<loc<len(s) and s[loc-1] == '\n' else loc - s.rfind("\n", 0, loc)
+
+def lineno(loc,strg):
+    """Returns current line number within a string, counting newlines as line separators.
+   The first line 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}<ParserElement.parseString>} for more information
+   on parsing strings containing C{<TAB>}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 = "<parse action>"
+    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, <TAB> 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 = "<unknown>"  # 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}<parseString>} for more information
+        on parsing strings containing C{<TAB>}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}<setParseAction>}.
+        
+        See examples in L{I{copy}<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}<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}<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}<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 <TAB>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{<TAB>}s to spaces before parsing the input string.
+        Must be called before C{parseString} when the input grammar contains elements that
+        match C{<TAB>} 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 <exprname> at loc <n>(<line>,<col>)"}
+        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 (loc<instrlen and instring[loc] in bodychars):
+                throwException = True
+
+        if throwException:
+            raise ParseException(instring, loc, self.errmsg, self)
+
+        return loc, instring[start:loc]
+
+    def __str__( self ):
+        try:
+            return super(Word,self).__str__()
+        except Exception:
+            pass
+
+
+        if self.strRepr is None:
+
+            def charsAsStr(s):
+                if len(s)>4:
+                    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<name>...)}), these will be preserved as 
+    named parse results.
+
+    Example::
+        realnum = Regex(r"[+-]?\d+\.\d*")
+        date = Regex(r'(?P<year>\d{4})-(?P<month>\d\d?)-(?P<day>\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 = {
+        " " : "<SPC>",
+        "\t": "<TAB>",
+        "\n": "<LF>",
+        "\r": "<CR>",
+        "\f": "<FF>",
+        }
+    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):
+            if instring[loc] == "\n":
+                return loc+1, "\n"
+            else:
+                raise ParseException(instring, loc, self.errmsg, self)
+        elif loc == len(instring):
+            return loc+1, []
+        else:
+            raise ParseException(instring, loc, self.errmsg, self)
+
+class StringStart(_PositionToken):
+    """
+    Matches if current position is at the beginning of the parse string
+    """
+    def __init__( self ):
+        super(StringStart,self).__init__()
+        self.errmsg = "Expected start of text"
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        if loc != 0:
+            # see if entire string up to here is just whitespace and ignoreables
+            if loc != self.preParse( instring, 0 ):
+                raise ParseException(instring, loc, self.errmsg, self)
+        return loc, []
+
+class StringEnd(_PositionToken):
+    """
+    Matches if current position is at the end of the parse string
+    """
+    def __init__( self ):
+        super(StringEnd,self).__init__()
+        self.errmsg = "Expected end of text"
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        if loc < len(instring):
+            raise ParseException(instring, loc, self.errmsg, self)
+        elif loc == len(instring):
+            return loc+1, []
+        elif 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<instrlen:
+            if (instring[loc] in self.wordChars or
+                instring[loc-1] not in self.wordChars):
+                raise ParseException(instring, loc, self.errmsg, self)
+        return loc, []
+
+
+class ParseExpression(ParserElement):
+    """
+    Abstract subclass of ParserElement, for combining and post-processing parsed tokens.
+    """
+    def __init__( self, exprs, savelist = False ):
+        super(ParseExpression,self).__init__(savelist)
+        if isinstance( exprs, _generatorType ):
+            exprs = list(exprs)
+
+        if isinstance( exprs, basestring ):
+            self.exprs = [ ParserElement._literalStringClass( exprs ) ]
+        elif isinstance( exprs, Iterable ):
+            exprs = list(exprs)
+            # if sequence of strings provided, wrap with Literal
+            if all(isinstance(expr, basestring) for expr in exprs):
+                exprs = map(ParserElement._literalStringClass, exprs)
+            self.exprs = list(exprs)
+        else:
+            try:
+                self.exprs = list( exprs )
+            except TypeError:
+                self.exprs = [ exprs ]
+        self.callPreparse = False
+
+    def __getitem__( self, i ):
+        return self.exprs[i]
+
+    def append( self, other ):
+        self.exprs.append( other )
+        self.strRepr = None
+        return self
+
+    def leaveWhitespace( self ):
+        """Extends C{leaveWhitespace} defined in base class, and also invokes C{leaveWhitespace} on
+           all contained expressions."""
+        self.skipWhitespace = False
+        self.exprs = [ e.copy() for e in self.exprs ]
+        for e in self.exprs:
+            e.leaveWhitespace()
+        return self
+
+    def ignore( self, other ):
+        if isinstance( other, Suppress ):
+            if other not in self.ignoreExprs:
+                super( ParseExpression, self).ignore( other )
+                for e in self.exprs:
+                    e.ignore( self.ignoreExprs[-1] )
+        else:
+            super( ParseExpression, self).ignore( other )
+            for e in self.exprs:
+                e.ignore( self.ignoreExprs[-1] )
+        return self
+
+    def __str__( self ):
+        try:
+            return super(ParseExpression,self).__str__()
+        except Exception:
+            pass
+
+        if self.strRepr is None:
+            self.strRepr = "%s:(%s)" % ( self.__class__.__name__, _ustr(self.exprs) )
+        return self.strRepr
+
+    def streamline( self ):
+        super(ParseExpression,self).streamline()
+
+        for e in self.exprs:
+            e.streamline()
+
+        # collapse nested And's of the form And( And( And( a,b), c), d) to And( a,b,c,d )
+        # but only if there are no parse actions or resultsNames on the nested And's
+        # (likewise for Or's and MatchFirst's)
+        if ( len(self.exprs) == 2 ):
+            other = self.exprs[0]
+            if ( isinstance( other, self.__class__ ) and
+                  not(other.parseAction) and
+                  other.resultsName is None and
+                  not other.debug ):
+                self.exprs = other.exprs[:] + [ self.exprs[1] ]
+                self.strRepr = None
+                self.mayReturnEmpty |= other.mayReturnEmpty
+                self.mayIndexError  |= other.mayIndexError
+
+            other = self.exprs[-1]
+            if ( isinstance( other, self.__class__ ) and
+                  not(other.parseAction) and
+                  other.resultsName is None and
+                  not other.debug ):
+                self.exprs = self.exprs[:-1] + other.exprs[:]
+                self.strRepr = None
+                self.mayReturnEmpty |= other.mayReturnEmpty
+                self.mayIndexError  |= other.mayIndexError
+
+        self.errmsg = "Expected " + _ustr(self)
+        
+        return self
+
+    def setResultsName( self, name, listAllMatches=False ):
+        ret = super(ParseExpression,self).setResultsName(name,listAllMatches)
+        return ret
+
+    def validate( self, validateTrace=[] ):
+        tmp = validateTrace[:]+[self]
+        for e in self.exprs:
+            e.validate(tmp)
+        self.checkRecursion( [] )
+        
+    def copy(self):
+        ret = super(ParseExpression,self).copy()
+        ret.exprs = [e.copy() for e in self.exprs]
+        return ret
+
+class And(ParseExpression):
+    """
+    Requires all given C{ParseExpression}s to be found in the given order.
+    Expressions may be separated by whitespace.
+    May be constructed using the C{'+'} operator.
+    May also be constructed using the C{'-'} operator, which will suppress backtracking.
+
+    Example::
+        integer = Word(nums)
+        name_expr = OneOrMore(Word(alphas))
+
+        expr = And([integer("id"),name_expr("name"),integer("age")])
+        # more easily written as:
+        expr = integer("id") + name_expr("name") + integer("age")
+    """
+
+    class _ErrorStop(Empty):
+        def __init__(self, *args, **kwargs):
+            super(And._ErrorStop,self).__init__(*args, **kwargs)
+            self.name = '-'
+            self.leaveWhitespace()
+
+    def __init__( self, exprs, savelist = True ):
+        super(And,self).__init__(exprs, savelist)
+        self.mayReturnEmpty = all(e.mayReturnEmpty for e in self.exprs)
+        self.setWhitespaceChars( self.exprs[0].whiteChars )
+        self.skipWhitespace = self.exprs[0].skipWhitespace
+        self.callPreparse = True
+
+    def parseImpl( self, instring, loc, doActions=True ):
+        # pass False as last arg to _parse for first element, since we already
+        # pre-parsed the string as part of our And pre-parsing
+        loc, resultlist = self.exprs[0]._parse( instring, loc, doActions, callPreParse=False )
+        errorStop = False
+        for e in self.exprs[1:]:
+            if isinstance(e, And._ErrorStop):
+                errorStop = True
+                continue
+            if errorStop:
+                try:
+                    loc, exprtokens = e._parse( instring, loc, doActions )
+                except ParseSyntaxException:
+                    raise
+                except ParseBaseException as pe:
+                    pe.__traceback__ = None
+                    raise ParseSyntaxException._from_exception(pe)
+                except IndexError:
+                    raise ParseSyntaxException(instring, len(instring), self.errmsg, self)
+            else:
+                loc, exprtokens = e._parse( instring, loc, doActions )
+            if exprtokens or exprtokens.haskeys():
+                resultlist += exprtokens
+        return loc, resultlist
+
+    def __iadd__(self, other ):
+        if isinstance( other, basestring ):
+            other = ParserElement._literalStringClass( other )
+        return self.append( other ) #And( [ self, other ] )
+
+    def checkRecursion( self, parseElementList ):
+        subRecCheckList = parseElementList[:] + [ self ]
+        for e in self.exprs:
+            e.checkRecursion( subRecCheckList )
+            if not e.mayReturnEmpty:
+                break
+
+    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
+
+
+class Or(ParseExpression):
+    """
+    Requires that at least one C{ParseExpression} is found.
+    If two expressions match, the expression that matches the longest string will be used.
+    May be constructed using the C{'^'} operator.
+
+    Example::
+        # construct Or using '^' operator
+        
+        number = Word(nums) ^ Combine(Word(nums) + '.' + Word(nums))
+        print(number.searchString("123 3.1416 789"))
+    prints::
+        [['123'], ['3.1416'], ['789']]
+    """
+    def __init__( self, exprs, savelist = False ):
+        super(Or,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
+        matches = []
+        for e in self.exprs:
+            try:
+                loc2 = e.tryParse( instring, loc )
+            except ParseException as err:
+                err.__traceback__ = None
+                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)
+            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'], {}))
+        <<leaving remove_duplicate_chars (ret: 'dfjkls')
+        ['dfjkls']
+    """
+    f = _trim_arity(f)
+    def z(*paArgs):
+        thisFunc = f.__name__
+        s,l,t = paArgs[-3:]
+        if len(paArgs)>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( "<<leaving %s (exception: %s)\n" % (thisFunc,exc) )
+            raise
+        sys.stderr.write( "<<leaving %s (ret: %r)\n" % (thisFunc,ret) )
+        return ret
+    try:
+        z.__name__ = f.__name__
+    except AttributeError:
+        pass
+    return z
+
+#
+# global helpers
+#
+def delimitedList( expr, delim=",", combine=False ):
+    """
+    Helper to define a delimited list of expressions - the delimiter defaults to ','.
+    By default, the list elements and delimiters can have intervening whitespace, and
+    comments, but this can be overridden by passing C{combine=True} in the constructor.
+    If C{combine} is set to C{True}, the matching tokens are returned as a single token
+    string, with the delimiters included; otherwise, the matching tokens are returned
+    as a list of tokens, with the delimiters suppressed.
+
+    Example::
+        delimitedList(Word(alphas)).parseString("aa,bb,cc") # -> ['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 <b> bold <i>text</i> </b> normal text "
+        for tag in ("b","i"):
+            opener,closer = makeHTMLTags(tag)
+            patt = originalTextFor(opener + SkipTo(closer) + closer)
+            print(patt.searchString(src)[0])
+    prints::
+        ['<b> bold <i>text</i> </b>']
+        ['<i>text</i>']
+    """
+    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{<TAB>} 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<ParserElement.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("</") + tagStr + ">")
+
+    openTag = openTag.setResultsName("start"+"".join(resname.replace(":"," ").title().split())).setName("<%s>" % resname)
+    closeTag = closeTag.setResultsName("end"+"".join(resname.replace(":"," ").title().split())).setName("</%s>" % 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 = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>'
+        # 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 <A> 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{<TD>} or C{<DIV>}.
+
+    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 = '''
+            <div>
+            Some text
+            <div type="grid">1 4 0 1 0</div>
+            <div type="graph">1,3 2,3 1,1</div>
+            <div>this has no type</div>
+            </div>
+                
+        '''
+        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 = '''
+            <div>
+            Some text
+            <div class="grid">1 4 0 1 0</div>
+            <div class="graph">1,3 2,3 1,1</div>
+            <div>this &lt;div&gt; has no class</div>
+            </div>
+                
+        '''
+        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<entity>' + '|'.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"<!--[\s\S]*?-->").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<integer>}, L{reals<real>}, L{scientific notation<sci_real>})
+     - common L{programming identifiers<identifier>}
+     - network addresses (L{MAC<mac_address>}, L{IPv4<ipv4_address>}, L{IPv6<ipv6_address>})
+     - ISO8601 L{dates<iso8601_date>} and L{datetime<iso8601_datetime>}
+     - L{UUID<uuid>}
+     - L{comma-separated list<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<year>\d{4})(?:-(?P<month>\d\d)(?:-(?P<day>\d\d))?)?').setName("ISO8601 date")
+    "ISO8601 date (C{yyyy-mm-dd})"
+
+    iso8601_datetime = Regex(r'(?P<year>\d{4})-(?P<month>\d\d)-(?P<day>\d\d)[T ](?P<hour>\d\d):(?P<minute>\d\d)(:(?P<second>\d\d(\.\d*)?)?)?(?P<tz>Z|[+-]\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 = '<td>More info at the <a href="http://pyparsing.wikispaces.com">pyparsing</a> wiki page</td>'
+            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/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/six.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/six.py
new file mode 100644
index 0000000000000000000000000000000000000000..190c0239cd7d7af82a6e0cbc8d68053fa2e3dfaf
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/_vendor/six.py
@@ -0,0 +1,868 @@
+"""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 <benjamin@python.org>"
+__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/TP03/TP03/lib/python3.9/site-packages/setuptools/archive_util.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/archive_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..81436044d995ff430334a7ef324b08e616f4b7a7
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/archive_util.py
@@ -0,0 +1,173 @@
+"""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/TP03/TP03/lib/python3.9/site-packages/setuptools/build_meta.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/build_meta.py
new file mode 100644
index 0000000000000000000000000000000000000000..eb9e815ef85a46382c75022005a9ab5d7a44033d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/build_meta.py
@@ -0,0 +1,264 @@
+"""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)
+
+        # Some setup.py scripts (e.g. in pygame and numpy) use sys.argv[0] to
+        # get the directory of the source code. They expect it to refer to the
+        # setup.py script.
+        sys_argv_0 = sys.argv[0]
+        sys.argv[0] = setup_script
+
+        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
+            sys.argv[0] = sys_argv_0
+
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-32.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-32.exe
new file mode 100644
index 0000000000000000000000000000000000000000..b1487b7819e7286577a043c7726fbe0ca1543083
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-32.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-64.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-64.exe
new file mode 100644
index 0000000000000000000000000000000000000000..675e6bf3743f3d3011c238657e7128ee9960ef7f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli-64.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/cli.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli.exe
new file mode 100644
index 0000000000000000000000000000000000000000..b1487b7819e7286577a043c7726fbe0ca1543083
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/cli.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__init__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..743f5588faf3ad79850df7bd196749e7a6c03f93
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__init__.py
@@ -0,0 +1,17 @@
+__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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..49b20ebfbd1ab368664ae3c8ff1145a8b05df122
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/alias.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/alias.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..dd305e5d2aa2adfa605eb0126b9d6f7fb709987c
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/alias.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b4bdedaa41fc54f500e29985a329296ab8562aec
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_egg.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b9d3776152619b96bee189c3a0988720eabb679d
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_rpm.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8358903761b690640c52756776e91125f148cba1
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/bdist_wininst.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_clib.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_clib.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ca50383cd00679a4f19973b5d4525eba5d8fe1fe
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_clib.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_ext.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_ext.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f0375eb974808d13c14ed24e951927fa0fcc1592
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_ext.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_py.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_py.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..27b010e14bc26eeca80a04395b0da368820cdf02
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/build_py.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/develop.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/develop.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e193f304692fc0f387c3a7ee07910c8d6e1c0331
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/develop.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/dist_info.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/dist_info.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5b58e8c46a60b4675b736c67e984dd12d36b1384
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/dist_info.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/easy_install.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/easy_install.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d4055b8789ce918f983779275049cf514d776c6f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/easy_install.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/egg_info.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/egg_info.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..abf7af02dea1e3d43019f3a5ebcafbee0c2f8a8e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/egg_info.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..62c042f9a4a0dcacc05d15d8ed6a66ca54ef42c2
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..20e02d0235b42e1593f09c00cc7bdc8c155d24ee
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_egg_info.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_lib.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_lib.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..f7bdb91a681dd6139176de7fad88eed5b64f171e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_lib.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_scripts.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_scripts.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..d2358d0fbc62799feac6d656ed3a4e155ab7f62f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/install_scripts.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/py36compat.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/py36compat.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..1bb930488734b926ffd4f4b0308bb1d738f678da
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/py36compat.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/register.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/register.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9b36ca8a9ec88e4a702dcd10bc039cadc0478cab
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/register.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/rotate.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/rotate.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..4aa26d7f0b783e2bb16630e58da520066073e51e
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/rotate.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/saveopts.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/saveopts.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..322005ea62b74db4c5ee7728522cb9d5de5b588b
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/saveopts.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/sdist.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/sdist.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..5aa3093b704dfcfbbe154ed1fcb6dda663ca075a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/sdist.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/setopt.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/setopt.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..bd248f1104ca9db3ce97ae7df559414e9d47fa1a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/setopt.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/test.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/test.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2f790fa194c7dab0c15365804b92d1fbed3babdb
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/test.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..b58e897d04e6c1bc6c3cb52ac88cbf9694c6c3fe
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload_docs.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload_docs.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..cb28d769976dddee1b8eb92fa1a716e139695592
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/__pycache__/upload_docs.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/alias.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/alias.py
new file mode 100644
index 0000000000000000000000000000000000000000..4532b1cc0dca76227927e873f9c64f01008e565a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/alias.py
@@ -0,0 +1,80 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_egg.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_egg.py
new file mode 100644
index 0000000000000000000000000000000000000000..98470f1715b21befab94b3e84428622a1ba86463
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_egg.py
@@ -0,0 +1,502 @@
+"""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<name>.+)\.(?P<magic>[^.]+)\.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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_rpm.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_rpm.py
new file mode 100644
index 0000000000000000000000000000000000000000..70730927ecaed778ebbdee98eb37c24ec3f1a8e6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_rpm.py
@@ -0,0 +1,43 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_wininst.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_wininst.py
new file mode 100644
index 0000000000000000000000000000000000000000..073de97b46c92e2e221cade8c1350ab2c5cff891
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/bdist_wininst.py
@@ -0,0 +1,21 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_clib.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_clib.py
new file mode 100644
index 0000000000000000000000000000000000000000..09caff6ffde8fc3f368cb635dc3cbbbc8851530d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_clib.py
@@ -0,0 +1,98 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_ext.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_ext.py
new file mode 100644
index 0000000000000000000000000000000000000000..1b51e040b4560d45cdce245179d2b6a21b2a8b4a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_ext.py
@@ -0,0 +1,327 @@
+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 = (
+                not six.PY2
+                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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_py.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_py.py
new file mode 100644
index 0000000000000000000000000000000000000000..b0314fd413ae7f8c1027ccde0b092fd493fb104b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/build_py.py
@@ -0,0 +1,270 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/develop.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/develop.py
new file mode 100644
index 0000000000000000000000000000000000000000..b561924609a63a38e9f5fe98091ecf93e100a7ae
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/develop.py
@@ -0,0 +1,221 @@
+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 not six.PY2 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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/dist_info.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/dist_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..c45258fa03a3ddd6a73db4514365f8741d16ca86
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/dist_info.py
@@ -0,0 +1,36 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/easy_install.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/easy_install.py
new file mode 100644
index 0000000000000000000000000000000000000000..5a8dbe0f4b64ca77453312f71e24bd8d27f75f5a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/easy_install.py
@@ -0,0 +1,2402 @@
+#!/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("<iii", f.read(12))
+        if tag not in (0x1234567A, 0x1234567B):
+            return None  # not a valid tag
+
+        f.seek(prepended - (12 + cfglen))
+        init = {'version': '', 'target_version': ''}
+        cfg = configparser.RawConfigParser(init)
+        try:
+            part = f.read(cfglen)
+            # Read up to the first null byte.
+            config = part.split(b'\0', 1)[0]
+            # Now the config is in bytes, but for RawConfigParser, it should
+            #  be text, so decode it.
+            config = config.decode(sys.getfilesystemencoding())
+            cfg.readfp(six.StringIO(config))
+        except configparser.Error:
+            return None
+        if not cfg.has_section('metadata') or not cfg.has_section('Setup'):
+            return None
+        return cfg
+
+    finally:
+        f.close()
+
+
+def get_exe_prefixes(exe_filename):
+    """Get exe->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 not six.PY2:
+                    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='<string>'):
+    "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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/egg_info.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/egg_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..13714d6b36bfd93d9863c4d6c82382c7a44235b2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/egg_info.py
@@ -0,0 +1,717 @@
+"""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 not six.PY2:
+            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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install.py
new file mode 100644
index 0000000000000000000000000000000000000000..72b9a3e424707633c7e31a347170f358cfa3f87a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install.py
@@ -0,0 +1,125 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_egg_info.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_egg_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..5f405bcad743bac704e90c5489713a5cd4404497
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_egg_info.py
@@ -0,0 +1,82 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_lib.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_lib.py
new file mode 100644
index 0000000000000000000000000000000000000000..bf81519d98e8221707f45c1a3901b8d836095d30
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_lib.py
@@ -0,0 +1,147 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_scripts.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_scripts.py
new file mode 100644
index 0000000000000000000000000000000000000000..16234273a2d36b0b3d821a7a97bf8f03cf3f2948
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/install_scripts.py
@@ -0,0 +1,65 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/launcher manifest.xml b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/launcher manifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..5972a96d8ded85cc14147ffc1400ec67c3b5a578
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/launcher manifest.xml	
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+    <assemblyIdentity version="1.0.0.0"
+                      processorArchitecture="X86"
+                      name="%(name)s"
+                      type="win32"/>
+    <!-- Identify the application security requirements. -->
+    <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
+        <security>
+            <requestedPrivileges>
+                <requestedExecutionLevel level="asInvoker" uiAccess="false"/>
+            </requestedPrivileges>
+        </security>
+    </trustInfo>
+</assembly>
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/command/py36compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/py36compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..61063e7542586c05c3af21d31cd917ebd1118272
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/py36compat.py
@@ -0,0 +1,136 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/register.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/register.py
new file mode 100644
index 0000000000000000000000000000000000000000..b8266b9a60f8c363ba35f7b73befd7c9c7cb4abc
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/register.py
@@ -0,0 +1,18 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/rotate.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/rotate.py
new file mode 100644
index 0000000000000000000000000000000000000000..b89353f529b3d08e768dea69a9dc8b5e7403003d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/rotate.py
@@ -0,0 +1,66 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/saveopts.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/saveopts.py
new file mode 100644
index 0000000000000000000000000000000000000000..611cec552867a6d50b7edd700c86c7396d906ea2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/saveopts.py
@@ -0,0 +1,22 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/sdist.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/sdist.py
new file mode 100644
index 0000000000000000000000000000000000000000..8c3438eaa6c995a5e52440b4692116593e6ca62b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/sdist.py
@@ -0,0 +1,252 @@
+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 not six.PY2:
+                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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/setopt.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/setopt.py
new file mode 100644
index 0000000000000000000000000000000000000000..7e57cc02627fc3c3bb49613731a51c72452f96ba
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/setopt.py
@@ -0,0 +1,149 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/test.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/test.py
new file mode 100644
index 0000000000000000000000000000000000000000..f6470e9c346dc1987491a735496628057160a4ef
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/test.py
@@ -0,0 +1,279 @@
+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 = not six.PY2 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 not six.PY2 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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload.py
new file mode 100644
index 0000000000000000000000000000000000000000..ec7f81e22772511d668e5ab92f625db33259e803
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload.py
@@ -0,0 +1,17 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload_docs.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload_docs.py
new file mode 100644
index 0000000000000000000000000000000000000000..130a0cb6c9f4e469daa4fe638301049a2b7fab70
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/command/upload_docs.py
@@ -0,0 +1,206 @@
+# -*- 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 = 'strict' if six.PY2 else 'surrogateescape'
+    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 not six.PY2:
+            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/TP03/TP03/lib/python3.9/site-packages/setuptools/config.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/config.py
new file mode 100644
index 0000000000000000000000000000000000000000..9b9a0c45e756b44ddea7660228934d0a37fcd97c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/config.py
@@ -0,0 +1,659 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/dep_util.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/dep_util.py
new file mode 100644
index 0000000000000000000000000000000000000000..2931c13ec35aa60b742ac4c46ceabd4ed32a5511
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/dep_util.py
@@ -0,0 +1,23 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/depends.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/depends.py
new file mode 100644
index 0000000000000000000000000000000000000000..a37675cbd9bc9583fd01cc158198e2f4deda321b
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/depends.py
@@ -0,0 +1,176 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/dist.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/dist.py
new file mode 100644
index 0000000000000000000000000000000000000000..0480aaa8e851d19d234c3c8290a127cec30795ed
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/dist.py
@@ -0,0 +1,1274 @@
+# -*- 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 not six.PY2 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.readfp if six.PY2 else parser.read_file)(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 not six.PY2:
+            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.
+        """
+        group = 'setuptools.finalize_distribution_options'
+
+        def by_order(hook):
+            return getattr(hook, 'order', 0)
+        eps = map(lambda e: e.load(), pkg_resources.iter_entry_points(group))
+        for ep in sorted(eps, key=by_order):
+            ep(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
+    <https://github.com/pypa/setuptools/issues/58>`_ 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/TP03/TP03/lib/python3.9/site-packages/setuptools/errors.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/errors.py
new file mode 100644
index 0000000000000000000000000000000000000000..2701747f56cc77845159f2c5fee2d0ce114259af
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/errors.py
@@ -0,0 +1,16 @@
+"""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/TP03/TP03/lib/python3.9/site-packages/setuptools/extension.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/extension.py
new file mode 100644
index 0000000000000000000000000000000000000000..29468894f828128f4c36660167dd1f9e68e584be
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/extension.py
@@ -0,0 +1,57 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__init__.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..e8c616f910bb9bb874c3d44f1efe5239ecb8f621
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__init__.py
@@ -0,0 +1,73 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9ab286543270e66af94ab426951cb270c001812a
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/extern/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/glob.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/glob.py
new file mode 100644
index 0000000000000000000000000000000000000000..9d7cbc5da68da8605d271b9314befb206b87bca6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/glob.py
@@ -0,0 +1,174 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-32.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-32.exe
new file mode 100644
index 0000000000000000000000000000000000000000..f8d3509653ba8f80ca7f3aa7f95616142ba83a94
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-32.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-64.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-64.exe
new file mode 100644
index 0000000000000000000000000000000000000000..330c51a5dde15a0bb610a48cd0ca11770c914dae
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui-64.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/gui.exe b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui.exe
new file mode 100644
index 0000000000000000000000000000000000000000..f8d3509653ba8f80ca7f3aa7f95616142ba83a94
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/setuptools/gui.exe differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/installer.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/installer.py
new file mode 100644
index 0000000000000000000000000000000000000000..9f8be2ef8427651e3b0fbef497535e152dde66b1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/installer.py
@@ -0,0 +1,150 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/launch.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/launch.py
new file mode 100644
index 0000000000000000000000000000000000000000..308283ea939ed9bced7b099eb8a1879aa9c203d4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/launch.py
@@ -0,0 +1,35 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/lib2to3_ex.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/lib2to3_ex.py
new file mode 100644
index 0000000000000000000000000000000000000000..4b1a73feb26fdad65bafdeb21f5ce6abfb905fc0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/lib2to3_ex.py
@@ -0,0 +1,62 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/monkey.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/monkey.py
new file mode 100644
index 0000000000000000000000000000000000000000..3c77f8cf27f0ab1e71d64cfc114ef9d1bf72295c
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/monkey.py
@@ -0,0 +1,179 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/msvc.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/msvc.py
new file mode 100644
index 0000000000000000000000000000000000000000..2ffe1c81ee629c98246e9e72bf630431fa7905b6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/msvc.py
@@ -0,0 +1,1679 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/namespaces.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/namespaces.py
new file mode 100644
index 0000000000000000000000000000000000000000..dc16106d3dc7048a160129745756bbc9b1fb51d9
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/namespaces.py
@@ -0,0 +1,107 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/package_index.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/package_index.py
new file mode 100644
index 0000000000000000000000000000000000000000..f419d47167b39a71275744b2f2a78f85c9919a8d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/package_index.py
@@ -0,0 +1,1136 @@
+"""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'<a href="([^"#]+)">([^<]+)</a>\n\s+\(<a (?:title="MD5 hash"\n\s+)'
+    r'href="[^?]+\?:action=show_md5&amp;digest=([0-9a-f]{32})">md5</a>\)'
+)
+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*=\s*['"]?([^'">]+)[^>]*)>""", 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 ("<th>Home Page", "<th>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'(?P<hash_name>sha1|sha224|sha384|sha256|sha512|md5)='
+        r'(?P<expected>[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: '<a href="%s#md5=%s">%s</a>' % 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'<title>([^- ]+ - )?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&amp;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}</title>"
+                "</head><body>{files}</body></html>")
+            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/TP03/TP03/lib/python3.9/site-packages/setuptools/py27compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/py27compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..1d57360f4eff13cd94a25fec989036a0b0b80523
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/py27compat.py
@@ -0,0 +1,60 @@
+"""
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/py31compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/py31compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..e1da7ee2a2c56e46e09665d98ba1bc5bfedd2c3e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/py31compat.py
@@ -0,0 +1,32 @@
+__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/TP03/TP03/lib/python3.9/site-packages/setuptools/py33compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/py33compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..cb69443638354b46b43da5bbf187b4f7cba301f1
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/py33compat.py
@@ -0,0 +1,59 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/py34compat.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/py34compat.py
new file mode 100644
index 0000000000000000000000000000000000000000..3ad917222a4e5bb93fe1c9e8fe1713bcab3630b6
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/py34compat.py
@@ -0,0 +1,13 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/sandbox.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/sandbox.py
new file mode 100644
index 0000000000000000000000000000000000000000..685f3f72e3611a5fa99c999e233ffd179c431a6d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/sandbox.py
@@ -0,0 +1,491 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/script (dev).tmpl b/TP03/TP03/lib/python3.9/site-packages/setuptools/script (dev).tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..39a24b04888e79df51e2237577b303a2f901be63
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/script (dev).tmpl	
@@ -0,0 +1,6 @@
+# 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/TP03/TP03/lib/python3.9/site-packages/setuptools/script.tmpl b/TP03/TP03/lib/python3.9/site-packages/setuptools/script.tmpl
new file mode 100644
index 0000000000000000000000000000000000000000..ff5efbcab3b58063dd84787181c26a95fb663d94
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/script.tmpl
@@ -0,0 +1,3 @@
+# EASY-INSTALL-SCRIPT: %(spec)r,%(script_name)r
+__requires__ = %(spec)r
+__import__('pkg_resources').run_script(%(spec)r, %(script_name)r)
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/site-patch.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/site-patch.py
new file mode 100644
index 0000000000000000000000000000000000000000..40b00de0a799686485b266fd92abb9fb100ed718
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/site-patch.py
@@ -0,0 +1,74 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/ssl_support.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/ssl_support.py
new file mode 100644
index 0000000000000000000000000000000000000000..226db694bb38791147c6bf2881c4b86025dd2f8f
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/ssl_support.py
@@ -0,0 +1,260 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/unicode_utils.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/unicode_utils.py
new file mode 100644
index 0000000000000000000000000000000000000000..7c63efd20b350358ab25c079166dbb00ef49f8d2
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/unicode_utils.py
@@ -0,0 +1,44 @@
+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/TP03/TP03/lib/python3.9/site-packages/setuptools/version.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/version.py
new file mode 100644
index 0000000000000000000000000000000000000000..95e1869658566aac3060562d8cd5a6b647887d1e
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/version.py
@@ -0,0 +1,6 @@
+import pkg_resources
+
+try:
+    __version__ = pkg_resources.get_distribution('setuptools').version
+except Exception:
+    __version__ = 'unknown'
diff --git a/TP03/TP03/lib/python3.9/site-packages/setuptools/wheel.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/wheel.py
new file mode 100644
index 0000000000000000000000000000000000000000..025aaa828a24cb7746e5fac9b66984d5b9794bc3
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/wheel.py
@@ -0,0 +1,220 @@
+"""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<project_name>.+?)-(?P<version>\d.*?)
+    ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?)
+    )\.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/TP03/TP03/lib/python3.9/site-packages/setuptools/windows_support.py b/TP03/TP03/lib/python3.9/site-packages/setuptools/windows_support.py
new file mode 100644
index 0000000000000000000000000000000000000000..cb977cff9545ef5d48ad7cf13f2cbe1ebc3e7cd0
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/setuptools/windows_support.py
@@ -0,0 +1,29 @@
+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/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/INSTALLER b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/INSTALLER
new file mode 100644
index 0000000000000000000000000000000000000000..a1b589e38a32041e49332e5e81c2d363dc418d68
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/INSTALLER
@@ -0,0 +1 @@
+pip
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/LICENSE b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/LICENSE
new file mode 100644
index 0000000000000000000000000000000000000000..bd8c7124a7caf7b73e65e2137835ea4da8578072
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/LICENSE
@@ -0,0 +1,24 @@
+Copyright (c) 2013-2023, Graham Dumpleton
+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.
+
+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/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/METADATA b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/METADATA
new file mode 100644
index 0000000000000000000000000000000000000000..05f33a9f7a2a87d357b84a89bcc8017c980be6fe
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/METADATA
@@ -0,0 +1,172 @@
+Metadata-Version: 2.1
+Name: wrapt
+Version: 1.15.0
+Summary: Module for decorators, wrappers and monkey patching.
+Home-page: https://github.com/GrahamDumpleton/wrapt
+Author: Graham Dumpleton
+Author-email: Graham.Dumpleton@gmail.com
+License: BSD
+Project-URL: Bug Tracker, https://github.com/GrahamDumpleton/wrapt/issues/
+Project-URL: Changelog, https://wrapt.readthedocs.io/en/latest/changes.html
+Project-URL: Documentation, https://wrapt.readthedocs.io/
+Keywords: wrapper,proxy,decorator
+Platform: any
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: License :: OSI Approved :: BSD License
+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 :: 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
+Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
+Description-Content-Type: text/x-rst
+License-File: LICENSE
+
+wrapt
+=====
+
+|Actions| |PyPI|
+
+The aim of the **wrapt** module is to provide a transparent object proxy
+for Python, which can be used as the basis for the construction of function
+wrappers and decorator functions.
+
+The **wrapt** module focuses very much on correctness. It therefore goes
+way beyond existing mechanisms such as ``functools.wraps()`` to ensure that
+decorators preserve introspectability, signatures, type checking abilities
+etc. The decorators that can be constructed using this module will work in
+far more scenarios than typical decorators and provide more predictable and
+consistent behaviour.
+
+To ensure that the overhead is as minimal as possible, a C extension module
+is used for performance critical components. An automatic fallback to a
+pure Python implementation is also provided where a target system does not
+have a compiler to allow the C extension to be compiled.
+
+Documentation
+-------------
+
+For further information on the **wrapt** module see:
+
+* http://wrapt.readthedocs.org/
+
+Quick Start
+-----------
+
+To implement your decorator you need to first define a wrapper function.
+This will be called each time a decorated function is called. The wrapper
+function needs to take four positional arguments:
+
+* ``wrapped`` - The wrapped function which in turns needs to be called by your wrapper function.
+* ``instance`` - The object to which the wrapped function was bound when it was called.
+* ``args`` - The list of positional arguments supplied when the decorated function was called.
+* ``kwargs`` - The dictionary of keyword arguments supplied when the decorated function was called.
+
+The wrapper function would do whatever it needs to, but would usually in
+turn call the wrapped function that is passed in via the ``wrapped``
+argument.
+
+The decorator ``@wrapt.decorator`` then needs to be applied to the wrapper
+function to convert it into a decorator which can in turn be applied to
+other functions.
+
+.. code-block:: python
+
+    import wrapt
+    
+    @wrapt.decorator
+    def pass_through(wrapped, instance, args, kwargs):
+        return wrapped(*args, **kwargs)
+
+    @pass_through
+    def function():
+        pass
+
+If you wish to implement a decorator which accepts arguments, then wrap the
+definition of the decorator in a function closure. Any arguments supplied
+to the outer function when the decorator is applied, will be available to
+the inner wrapper when the wrapped function is called.
+
+.. code-block:: python
+
+    import wrapt
+
+    def with_arguments(myarg1, myarg2):
+        @wrapt.decorator
+        def wrapper(wrapped, instance, args, kwargs):
+            return wrapped(*args, **kwargs)
+        return wrapper
+
+    @with_arguments(1, 2)
+    def function():
+        pass
+
+When applied to a normal function or static method, the wrapper function
+when called will be passed ``None`` as the ``instance`` argument.
+
+When applied to an instance method, the wrapper function when called will
+be passed the instance of the class the method is being called on as the
+``instance`` argument. This will be the case even when the instance method
+was called explicitly via the class and the instance passed as the first
+argument. That is, the instance will never be passed as part of ``args``.
+
+When applied to a class method, the wrapper function when called will be
+passed the class type as the ``instance`` argument.
+
+When applied to a class, the wrapper function when called will be passed
+``None`` as the ``instance`` argument. The ``wrapped`` argument in this
+case will be the class.
+
+The above rules can be summarised with the following example.
+
+.. code-block:: python
+
+    import inspect
+    
+    @wrapt.decorator
+    def universal(wrapped, instance, args, kwargs):
+        if instance is None:
+            if inspect.isclass(wrapped):
+                # Decorator was applied to a class.
+                return wrapped(*args, **kwargs)
+            else:
+                # Decorator was applied to a function or staticmethod.
+                return wrapped(*args, **kwargs)
+        else:
+            if inspect.isclass(instance):
+                # Decorator was applied to a classmethod.
+                return wrapped(*args, **kwargs)
+            else:
+                # Decorator was applied to an instancemethod.
+                return wrapped(*args, **kwargs)
+
+Using these checks it is therefore possible to create a universal decorator
+that can be applied in all situations. It is no longer necessary to create
+different variants of decorators for normal functions and instance methods,
+or use additional wrappers to convert a function decorator into one that
+will work for instance methods.
+
+In all cases, the wrapped function passed to the wrapper function is called
+in the same way, with ``args`` and ``kwargs`` being passed. The
+``instance`` argument doesn't need to be used in calling the wrapped
+function.
+
+Repository
+----------
+
+Full source code for the **wrapt** module, including documentation files
+and unit tests, can be obtained from github.
+
+* https://github.com/GrahamDumpleton/wrapt
+
+.. |Actions| image:: https://img.shields.io/github/workflow/status/GrahamDumpleton/wrapt/Test/develop?logo=github&cacheSeconds=600
+   :target: https://github.com/GrahamDumpleton/wrapt/actions
+.. |PyPI| image:: https://img.shields.io/pypi/v/wrapt.svg?logo=python&cacheSeconds=3600
+   :target: https://pypi.python.org/pypi/wrapt
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/RECORD b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/RECORD
new file mode 100644
index 0000000000000000000000000000000000000000..ae0ecca5282d1dca95417d6372541bc909be678a
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/RECORD
@@ -0,0 +1,17 @@
+wrapt-1.15.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
+wrapt-1.15.0.dist-info/LICENSE,sha256=WXTvu8i2JrIFCBDWPDqQfuIckr9ks3QPxiOtBes0SKs,1304
+wrapt-1.15.0.dist-info/METADATA,sha256=NXeWsQUcY9owhRxlX25FL2FeWcJEAQmzXtFkV0GTHvQ,6739
+wrapt-1.15.0.dist-info/RECORD,,
+wrapt-1.15.0.dist-info/WHEEL,sha256=sp8bqymqcAVFzHoFVjE1SqPW4pKjs2FXlE2MEqCSjNY,217
+wrapt-1.15.0.dist-info/top_level.txt,sha256=Jf7kcuXtwjUJMwOL0QzALDg2WiSiXiH9ThKMjN64DW0,6
+wrapt/__init__.py,sha256=W0Uw_PT2IItZNrCGm7M1dbApccnvsLlqPtZTL8S7g_s,1200
+wrapt/__pycache__/__init__.cpython-39.pyc,,
+wrapt/__pycache__/arguments.cpython-39.pyc,,
+wrapt/__pycache__/decorators.cpython-39.pyc,,
+wrapt/__pycache__/importer.cpython-39.pyc,,
+wrapt/__pycache__/wrappers.cpython-39.pyc,,
+wrapt/_wrappers.cpython-39-x86_64-linux-gnu.so,sha256=6d_EVuNl6bmubJttUif8YS6A6sRtzT1jy9raWopGG6s,189384
+wrapt/arguments.py,sha256=RF0nTEdPzPIewJ-jnSY42i4JSzK3ctjPABV1SJxLymg,1746
+wrapt/decorators.py,sha256=gNy1PVq9NNVDAB9tujaAVhb0xtVKSSzqT-hdGFeWM34,21332
+wrapt/importer.py,sha256=SUC6gNKXYI6lrDBBpNCNCFiEwqh8h8bsHn9Qm-ZlrAw,10782
+wrapt/wrappers.py,sha256=bxHYZi0CONYAi4m45h1YC0FKEGlR6sNBt_aGrKZX2Sk,36161
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/WHEEL b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/WHEEL
new file mode 100644
index 0000000000000000000000000000000000000000..1feaba6ba3e2fbdae7647ec6be4386ebb038ec77
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/WHEEL
@@ -0,0 +1,8 @@
+Wheel-Version: 1.0
+Generator: bdist_wheel (0.38.4)
+Root-Is-Purelib: false
+Tag: cp39-cp39-manylinux_2_5_x86_64
+Tag: cp39-cp39-manylinux1_x86_64
+Tag: cp39-cp39-manylinux_2_17_x86_64
+Tag: cp39-cp39-manylinux2014_x86_64
+
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/top_level.txt b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/top_level.txt
new file mode 100644
index 0000000000000000000000000000000000000000..ba11553ab9e90bd2fc2366e2d157f5bf947d80d5
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt-1.15.0.dist-info/top_level.txt
@@ -0,0 +1 @@
+wrapt
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__init__.py b/TP03/TP03/lib/python3.9/site-packages/wrapt/__init__.py
new file mode 100644
index 0000000000000000000000000000000000000000..c536352499835d97bcca8d8704ed073d0244bb61
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt/__init__.py
@@ -0,0 +1,27 @@
+__version_info__ = ('1', '15', '0')
+__version__ = '.'.join(__version_info__)
+
+from .wrappers import (ObjectProxy, CallableObjectProxy, FunctionWrapper,
+        BoundFunctionWrapper, WeakFunctionProxy, PartialCallableObjectProxy,
+        resolve_path, apply_patch, wrap_object, wrap_object_attribute,
+        function_wrapper, wrap_function_wrapper, patch_function_wrapper,
+        transient_function_wrapper)
+
+from .decorators import (adapter_factory, AdapterFactory, decorator,
+        synchronized)
+
+from .importer import (register_post_import_hook, when_imported,
+        notify_module_loaded, discover_post_import_hooks)
+
+# Import of inspect.getcallargs() included for backward compatibility. An
+# implementation of this was previously bundled and made available here for
+# Python <2.7. Avoid using this in future.
+
+from inspect import getcallargs
+
+# Variant of inspect.formatargspec() included here for forward compatibility.
+# This is being done because Python 3.11 dropped inspect.formatargspec() but
+# code for handling signature changing decorators relied on it. Exposing the
+# bundled implementation here in case any user of wrapt was also needing it.
+
+from .arguments import formatargspec
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/__init__.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..9d1d7a41a7ca15dd89c270308fc1e388c6f4444f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/__init__.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/arguments.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/arguments.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..e2471ad84e914c2c494cc659935b4523f44f008f
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/arguments.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/decorators.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/decorators.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..8e85ed2e7d2e8713c41acdcddf1b7b61903acb82
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/decorators.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/importer.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/importer.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..2941ca334fa18e22fa44d46285fc612b300dcc22
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/importer.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/wrappers.cpython-39.pyc b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/wrappers.cpython-39.pyc
new file mode 100644
index 0000000000000000000000000000000000000000..ee8ecc8d8e83e75ba36cdcd6133dd44cb9121871
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/__pycache__/wrappers.cpython-39.pyc differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/_wrappers.cpython-39-x86_64-linux-gnu.so b/TP03/TP03/lib/python3.9/site-packages/wrapt/_wrappers.cpython-39-x86_64-linux-gnu.so
new file mode 100755
index 0000000000000000000000000000000000000000..71e6725bcf32ad9ea84fb01c970a71a50bc73486
Binary files /dev/null and b/TP03/TP03/lib/python3.9/site-packages/wrapt/_wrappers.cpython-39-x86_64-linux-gnu.so differ
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/arguments.py b/TP03/TP03/lib/python3.9/site-packages/wrapt/arguments.py
new file mode 100644
index 0000000000000000000000000000000000000000..032bc059e003c43b871d4dfe523ceb60881d2140
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt/arguments.py
@@ -0,0 +1,38 @@
+# The inspect.formatargspec() function was dropped in Python 3.11 but we need
+# need it for when constructing signature changing decorators based on result of
+# inspect.getargspec() or inspect.getfullargspec(). The code here implements
+# inspect.formatargspec() base on Parameter and Signature from inspect module,
+# which were added in Python 3.6. Thanks to Cyril Jouve for the implementation.
+
+try:
+    from inspect import Parameter, Signature
+except ImportError:
+    from inspect import formatargspec
+else:
+    def formatargspec(args, varargs=None, varkw=None, defaults=None,
+                      kwonlyargs=(), kwonlydefaults={}, annotations={}):
+        if kwonlydefaults is None:
+            kwonlydefaults = {}
+        ndefaults = len(defaults) if defaults else 0
+        parameters = [
+            Parameter(
+                arg,
+                Parameter.POSITIONAL_OR_KEYWORD,
+                default=defaults[i] if i >= 0 else Parameter.empty,
+                annotation=annotations.get(arg, Parameter.empty),
+            ) for i, arg in enumerate(args, ndefaults - len(args))
+        ]
+        if varargs:
+            parameters.append(Parameter(varargs, Parameter.VAR_POSITIONAL))
+        parameters.extend(
+            Parameter(
+                kwonlyarg,
+                Parameter.KEYWORD_ONLY,
+                default=kwonlydefaults.get(kwonlyarg, Parameter.empty),
+                annotation=annotations.get(kwonlyarg, Parameter.empty),
+            ) for kwonlyarg in kwonlyargs
+        )
+        if varkw:
+            parameters.append(Parameter(varkw, Parameter.VAR_KEYWORD))
+        return_annotation = annotations.get('return', Signature.empty)
+        return str(Signature(parameters, return_annotation=return_annotation))
\ No newline at end of file
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/decorators.py b/TP03/TP03/lib/python3.9/site-packages/wrapt/decorators.py
new file mode 100644
index 0000000000000000000000000000000000000000..c3f2547295a815f8e0b377bfdc90b3838de84726
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt/decorators.py
@@ -0,0 +1,541 @@
+"""This module implements decorators for implementing other decorators
+as well as some commonly used decorators.
+
+"""
+
+import sys
+
+PY2 = sys.version_info[0] == 2
+
+if PY2:
+    string_types = basestring,
+
+    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_""")
+
+else:
+    string_types = str,
+
+    import builtins
+
+    exec_ = getattr(builtins, "exec")
+    del builtins
+
+from functools import partial
+from inspect import isclass
+from threading import Lock, RLock
+
+from .arguments import formatargspec
+
+try:
+    from inspect import signature
+except ImportError:
+    pass
+
+from .wrappers import (FunctionWrapper, BoundFunctionWrapper, ObjectProxy,
+    CallableObjectProxy)
+
+# Adapter wrapper for the wrapped function which will overlay certain
+# properties from the adapter function onto the wrapped function so that
+# functions such as inspect.getargspec(), inspect.getfullargspec(),
+# inspect.signature() and inspect.getsource() return the correct results
+# one would expect.
+
+class _AdapterFunctionCode(CallableObjectProxy):
+
+    def __init__(self, wrapped_code, adapter_code):
+        super(_AdapterFunctionCode, self).__init__(wrapped_code)
+        self._self_adapter_code = adapter_code
+
+    @property
+    def co_argcount(self):
+        return self._self_adapter_code.co_argcount
+
+    @property
+    def co_code(self):
+        return self._self_adapter_code.co_code
+
+    @property
+    def co_flags(self):
+        return self._self_adapter_code.co_flags
+
+    @property
+    def co_kwonlyargcount(self):
+        return self._self_adapter_code.co_kwonlyargcount
+
+    @property
+    def co_varnames(self):
+        return self._self_adapter_code.co_varnames
+
+class _AdapterFunctionSurrogate(CallableObjectProxy):
+
+    def __init__(self, wrapped, adapter):
+        super(_AdapterFunctionSurrogate, self).__init__(wrapped)
+        self._self_adapter = adapter
+
+    @property
+    def __code__(self):
+        return _AdapterFunctionCode(self.__wrapped__.__code__,
+                self._self_adapter.__code__)
+
+    @property
+    def __defaults__(self):
+        return self._self_adapter.__defaults__
+
+    @property
+    def __kwdefaults__(self):
+        return self._self_adapter.__kwdefaults__
+
+    @property
+    def __signature__(self):
+        if 'signature' not in globals():
+            return self._self_adapter.__signature__
+        else:
+            return signature(self._self_adapter)
+
+    if PY2:
+        func_code = __code__
+        func_defaults = __defaults__
+
+class _BoundAdapterWrapper(BoundFunctionWrapper):
+
+    @property
+    def __func__(self):
+        return _AdapterFunctionSurrogate(self.__wrapped__.__func__,
+                self._self_parent._self_adapter)
+
+    @property
+    def __signature__(self):
+        if 'signature' not in globals():
+            return self.__wrapped__.__signature__
+        else:
+            return signature(self._self_parent._self_adapter)
+
+    if PY2:
+        im_func = __func__
+
+class AdapterWrapper(FunctionWrapper):
+
+    __bound_function_wrapper__ = _BoundAdapterWrapper
+
+    def __init__(self, *args, **kwargs):
+        adapter = kwargs.pop('adapter')
+        super(AdapterWrapper, self).__init__(*args, **kwargs)
+        self._self_surrogate = _AdapterFunctionSurrogate(
+                self.__wrapped__, adapter)
+        self._self_adapter = adapter
+
+    @property
+    def __code__(self):
+        return self._self_surrogate.__code__
+
+    @property
+    def __defaults__(self):
+        return self._self_surrogate.__defaults__
+
+    @property
+    def __kwdefaults__(self):
+        return self._self_surrogate.__kwdefaults__
+
+    if PY2:
+        func_code = __code__
+        func_defaults = __defaults__
+
+    @property
+    def __signature__(self):
+        return self._self_surrogate.__signature__
+
+class AdapterFactory(object):
+    def __call__(self, wrapped):
+        raise NotImplementedError()
+
+class DelegatedAdapterFactory(AdapterFactory):
+    def __init__(self, factory):
+        super(DelegatedAdapterFactory, self).__init__()
+        self.factory = factory
+    def __call__(self, wrapped):
+        return self.factory(wrapped)
+
+adapter_factory = DelegatedAdapterFactory
+
+# Decorator for creating other decorators. This decorator and the
+# wrappers which they use are designed to properly preserve any name
+# attributes, function signatures etc, in addition to the wrappers
+# themselves acting like a transparent proxy for the original wrapped
+# function so the wrapper is effectively indistinguishable from the
+# original wrapped function.
+
+def decorator(wrapper=None, enabled=None, adapter=None, proxy=FunctionWrapper):
+    # The decorator should be supplied with a single positional argument
+    # which is the wrapper function to be used to implement the
+    # decorator. This may be preceded by a step whereby the keyword
+    # arguments are supplied to customise the behaviour of the
+    # decorator. The 'adapter' argument is used to optionally denote a
+    # separate function which is notionally used by an adapter
+    # decorator. In that case parts of the function '__code__' and
+    # '__defaults__' attributes are used from the adapter function
+    # rather than those of the wrapped function. This allows for the
+    # argument specification from inspect.getfullargspec() and similar
+    # functions to be overridden with a prototype for a different
+    # function than what was wrapped. The 'enabled' argument provides a
+    # way to enable/disable the use of the decorator. If the type of
+    # 'enabled' is a boolean, then it is evaluated immediately and the
+    # wrapper not even applied if it is False. If not a boolean, it will
+    # be evaluated when the wrapper is called for an unbound wrapper,
+    # and when binding occurs for a bound wrapper. When being evaluated,
+    # if 'enabled' is callable it will be called to obtain the value to
+    # be checked. If False, the wrapper will not be called and instead
+    # the original wrapped function will be called directly instead.
+    # The 'proxy' argument provides a way of passing a custom version of
+    # the FunctionWrapper class used in decorating the function.
+
+    if wrapper is not None:
+        # Helper function for creating wrapper of the appropriate
+        # time when we need it down below.
+
+        def _build(wrapped, wrapper, enabled=None, adapter=None):
+            if adapter:
+                if isinstance(adapter, AdapterFactory):
+                    adapter = adapter(wrapped)
+
+                if not callable(adapter):
+                    ns = {}
+
+                    # Check if the signature argument specification has
+                    # annotations. If it does then we need to remember
+                    # it but also drop it when attempting to manufacture
+                    # a standin adapter function. This is necessary else
+                    # it will try and look up any types referenced in
+                    # the annotations in the empty namespace we use,
+                    # which will fail.
+
+                    annotations = {}
+
+                    if not isinstance(adapter, string_types):
+                        if len(adapter) == 7:
+                            annotations = adapter[-1]
+                            adapter = adapter[:-1]
+                        adapter = formatargspec(*adapter)
+
+                    exec_('def adapter{}: pass'.format(adapter), ns, ns)
+                    adapter = ns['adapter']
+
+                    # Override the annotations for the manufactured
+                    # adapter function so they match the original
+                    # adapter signature argument specification.
+
+                    if annotations:
+                        adapter.__annotations__ = annotations
+
+                return AdapterWrapper(wrapped=wrapped, wrapper=wrapper,
+                        enabled=enabled, adapter=adapter)
+
+            return proxy(wrapped=wrapped, wrapper=wrapper, enabled=enabled)
+
+        # The wrapper has been provided so return the final decorator.
+        # The decorator is itself one of our function wrappers so we
+        # can determine when it is applied to functions, instance methods
+        # or class methods. This allows us to bind the instance or class
+        # method so the appropriate self or cls attribute is supplied
+        # when it is finally called.
+
+        def _wrapper(wrapped, instance, args, kwargs):
+            # We first check for the case where the decorator was applied
+            # to a class type.
+            #
+            #     @decorator
+            #     class mydecoratorclass(object):
+            #         def __init__(self, arg=None):
+            #             self.arg = arg
+            #         def __call__(self, wrapped, instance, args, kwargs):
+            #             return wrapped(*args, **kwargs)
+            #
+            #     @mydecoratorclass(arg=1)
+            #     def function():
+            #         pass
+            #
+            # In this case an instance of the class is to be used as the
+            # decorator wrapper function. If args was empty at this point,
+            # then it means that there were optional keyword arguments
+            # supplied to be used when creating an instance of the class
+            # to be used as the wrapper function.
+
+            if instance is None and isclass(wrapped) and not args:
+                # We still need to be passed the target function to be
+                # wrapped as yet, so we need to return a further function
+                # to be able to capture it.
+
+                def _capture(target_wrapped):
+                    # Now have the target function to be wrapped and need
+                    # to create an instance of the class which is to act
+                    # as the decorator wrapper function. Before we do that,
+                    # we need to first check that use of the decorator
+                    # hadn't been disabled by a simple boolean. If it was,
+                    # the target function to be wrapped is returned instead.
+
+                    _enabled = enabled
+                    if type(_enabled) is bool:
+                        if not _enabled:
+                            return target_wrapped
+                        _enabled = None
+
+                    # Now create an instance of the class which is to act
+                    # as the decorator wrapper function. Any arguments had
+                    # to be supplied as keyword only arguments so that is
+                    # all we pass when creating it.
+
+                    target_wrapper = wrapped(**kwargs)
+
+                    # Finally build the wrapper itself and return it.
+
+                    return _build(target_wrapped, target_wrapper,
+                            _enabled, adapter)
+
+                return _capture
+
+            # We should always have the target function to be wrapped at
+            # this point as the first (and only) value in args.
+
+            target_wrapped = args[0]
+
+            # Need to now check that use of the decorator hadn't been
+            # disabled by a simple boolean. If it was, then target
+            # function to be wrapped is returned instead.
+
+            _enabled = enabled
+            if type(_enabled) is bool:
+                if not _enabled:
+                    return target_wrapped
+                _enabled = None
+
+            # We now need to build the wrapper, but there are a couple of
+            # different cases we need to consider.
+
+            if instance is None:
+                if isclass(wrapped):
+                    # In this case the decorator was applied to a class
+                    # type but optional keyword arguments were not supplied
+                    # for initialising an instance of the class to be used
+                    # as the decorator wrapper function.
+                    #
+                    #     @decorator
+                    #     class mydecoratorclass(object):
+                    #         def __init__(self, arg=None):
+                    #             self.arg = arg
+                    #         def __call__(self, wrapped, instance,
+                    #                 args, kwargs):
+                    #             return wrapped(*args, **kwargs)
+                    #
+                    #     @mydecoratorclass
+                    #     def function():
+                    #         pass
+                    #
+                    # We still need to create an instance of the class to
+                    # be used as the decorator wrapper function, but no
+                    # arguments are pass.
+
+                    target_wrapper = wrapped()
+
+                else:
+                    # In this case the decorator was applied to a normal
+                    # function, or possibly a static method of a class.
+                    #
+                    #     @decorator
+                    #     def mydecoratorfuntion(wrapped, instance,
+                    #             args, kwargs):
+                    #         return wrapped(*args, **kwargs)
+                    #
+                    #     @mydecoratorfunction
+                    #     def function():
+                    #         pass
+                    #
+                    # That normal function becomes the decorator wrapper
+                    # function.
+
+                    target_wrapper = wrapper
+
+            else:
+                if isclass(instance):
+                    # In this case the decorator was applied to a class
+                    # method.
+                    #
+                    #     class myclass(object):
+                    #         @decorator
+                    #         @classmethod
+                    #         def decoratorclassmethod(cls, wrapped,
+                    #                 instance, args, kwargs):
+                    #             return wrapped(*args, **kwargs)
+                    #
+                    #     instance = myclass()
+                    #
+                    #     @instance.decoratorclassmethod
+                    #     def function():
+                    #         pass
+                    #
+                    # This one is a bit strange because binding was actually
+                    # performed on the wrapper created by our decorator
+                    # factory. We need to apply that binding to the decorator
+                    # wrapper function that the decorator factory
+                    # was applied to.
+
+                    target_wrapper = wrapper.__get__(None, instance)
+
+                else:
+                    # In this case the decorator was applied to an instance
+                    # method.
+                    #
+                    #     class myclass(object):
+                    #         @decorator
+                    #         def decoratorclassmethod(self, wrapped,
+                    #                 instance, args, kwargs):
+                    #             return wrapped(*args, **kwargs)
+                    #
+                    #     instance = myclass()
+                    #
+                    #     @instance.decoratorclassmethod
+                    #     def function():
+                    #         pass
+                    #
+                    # This one is a bit strange because binding was actually
+                    # performed on the wrapper created by our decorator
+                    # factory. We need to apply that binding to the decorator
+                    # wrapper function that the decorator factory
+                    # was applied to.
+
+                    target_wrapper = wrapper.__get__(instance, type(instance))
+
+            # Finally build the wrapper itself and return it.
+
+            return _build(target_wrapped, target_wrapper, _enabled, adapter)
+
+        # We first return our magic function wrapper here so we can
+        # determine in what context the decorator factory was used. In
+        # other words, it is itself a universal decorator. The decorator
+        # function is used as the adapter so that linters see a signature
+        # corresponding to the decorator and not the wrapper it is being
+        # applied to.
+
+        return _build(wrapper, _wrapper, adapter=decorator)
+
+    else:
+        # The wrapper still has not been provided, so we are just
+        # collecting the optional keyword arguments. Return the
+        # decorator again wrapped in a partial using the collected
+        # arguments.
+
+        return partial(decorator, enabled=enabled, adapter=adapter,
+                proxy=proxy)
+
+# Decorator for implementing thread synchronization. It can be used as a
+# decorator, in which case the synchronization context is determined by
+# what type of function is wrapped, or it can also be used as a context
+# manager, where the user needs to supply the correct synchronization
+# context. It is also possible to supply an object which appears to be a
+# synchronization primitive of some sort, by virtue of having release()
+# and acquire() methods. In that case that will be used directly as the
+# synchronization primitive without creating a separate lock against the
+# derived or supplied context.
+
+def synchronized(wrapped):
+    # Determine if being passed an object which is a synchronization
+    # primitive. We can't check by type for Lock, RLock, Semaphore etc,
+    # as the means of creating them isn't the type. Therefore use the
+    # existence of acquire() and release() methods. This is more
+    # extensible anyway as it allows custom synchronization mechanisms.
+
+    if hasattr(wrapped, 'acquire') and hasattr(wrapped, 'release'):
+        # We remember what the original lock is and then return a new
+        # decorator which accesses and locks it. When returning the new
+        # decorator we wrap it with an object proxy so we can override
+        # the context manager methods in case it is being used to wrap
+        # synchronized statements with a 'with' statement.
+
+        lock = wrapped
+
+        @decorator
+        def _synchronized(wrapped, instance, args, kwargs):
+            # Execute the wrapped function while the original supplied
+            # lock is held.
+
+            with lock:
+                return wrapped(*args, **kwargs)
+
+        class _PartialDecorator(CallableObjectProxy):
+
+            def __enter__(self):
+                lock.acquire()
+                return lock
+
+            def __exit__(self, *args):
+                lock.release()
+
+        return _PartialDecorator(wrapped=_synchronized)
+
+    # Following only apply when the lock is being created automatically
+    # based on the context of what was supplied. In this case we supply
+    # a final decorator, but need to use FunctionWrapper directly as we
+    # want to derive from it to add context manager methods in case it is
+    # being used to wrap synchronized statements with a 'with' statement.
+
+    def _synchronized_lock(context):
+        # Attempt to retrieve the lock for the specific context.
+
+        lock = vars(context).get('_synchronized_lock', None)
+
+        if lock is None:
+            # There is no existing lock defined for the context we
+            # are dealing with so we need to create one. This needs
+            # to be done in a way to guarantee there is only one
+            # created, even if multiple threads try and create it at
+            # the same time. We can't always use the setdefault()
+            # method on the __dict__ for the context. This is the
+            # case where the context is a class, as __dict__ is
+            # actually a dictproxy. What we therefore do is use a
+            # meta lock on this wrapper itself, to control the
+            # creation and assignment of the lock attribute against
+            # the context.
+
+            with synchronized._synchronized_meta_lock:
+                # We need to check again for whether the lock we want
+                # exists in case two threads were trying to create it
+                # at the same time and were competing to create the
+                # meta lock.
+
+                lock = vars(context).get('_synchronized_lock', None)
+
+                if lock is None:
+                    lock = RLock()
+                    setattr(context, '_synchronized_lock', lock)
+
+        return lock
+
+    def _synchronized_wrapper(wrapped, instance, args, kwargs):
+        # Execute the wrapped function while the lock for the
+        # desired context is held. If instance is None then the
+        # wrapped function is used as the context.
+
+        with _synchronized_lock(instance if instance is not None else wrapped):
+            return wrapped(*args, **kwargs)
+
+    class _FinalDecorator(FunctionWrapper):
+
+        def __enter__(self):
+            self._self_lock = _synchronized_lock(self.__wrapped__)
+            self._self_lock.acquire()
+            return self._self_lock
+
+        def __exit__(self, *args):
+            self._self_lock.release()
+
+    return _FinalDecorator(wrapped=wrapped, wrapper=_synchronized_wrapper)
+
+synchronized._synchronized_meta_lock = Lock()
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/importer.py b/TP03/TP03/lib/python3.9/site-packages/wrapt/importer.py
new file mode 100644
index 0000000000000000000000000000000000000000..1e5e68863eefd8be6ab64898ca03220a71965bb4
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt/importer.py
@@ -0,0 +1,293 @@
+"""This module implements a post import hook mechanism styled after what is
+described in PEP-369. Note that it doesn't cope with modules being reloaded.
+
+"""
+
+import sys
+import threading
+
+PY2 = sys.version_info[0] == 2
+
+if PY2:
+    string_types = basestring,
+    find_spec = None
+else:
+    string_types = str,
+    from importlib.util import find_spec
+
+# The dictionary registering any post import hooks to be triggered once
+# the target module has been imported. Once a module has been imported
+# and the hooks fired, the list of hooks recorded against the target
+# module will be truncated but the list left in the dictionary. This
+# acts as a flag to indicate that the module had already been imported.
+
+_post_import_hooks = {}
+_post_import_hooks_init = False
+_post_import_hooks_lock = threading.RLock()
+
+# Register a new post import hook for the target module name. This
+# differs from the PEP-369 implementation in that it also allows the
+# hook function to be specified as a string consisting of the name of
+# the callback in the form 'module:function'. This will result in a
+# proxy callback being registered which will defer loading of the
+# specified module containing the callback function until required.
+
+def _create_import_hook_from_string(name):
+    def import_hook(module):
+        module_name, function = name.split(':')
+        attrs = function.split('.')
+        __import__(module_name)
+        callback = sys.modules[module_name]
+        for attr in attrs:
+            callback = getattr(callback, attr)
+        return callback(module)
+    return import_hook
+
+def register_post_import_hook(hook, name):
+    # Create a deferred import hook if hook is a string name rather than
+    # a callable function.
+
+    if isinstance(hook, string_types):
+        hook = _create_import_hook_from_string(hook)
+
+    with _post_import_hooks_lock:
+        # Automatically install the import hook finder if it has not already
+        # been installed.
+
+        global _post_import_hooks_init
+
+        if not _post_import_hooks_init:
+            _post_import_hooks_init = True
+            sys.meta_path.insert(0, ImportHookFinder())
+
+        # Check if the module is already imported. If not, register the hook
+        # to be called after import.
+
+        module = sys.modules.get(name, None)
+
+        if module is None:
+            _post_import_hooks.setdefault(name, []).append(hook)
+
+    # If the module is already imported, we fire the hook right away. Note that
+    # the hook is called outside of the lock to avoid deadlocks if code run as a
+    # consequence of calling the module import hook in turn triggers a separate
+    # thread which tries to register an import hook.
+
+    if module is not None:
+        hook(module)
+
+# Register post import hooks defined as package entry points.
+
+def _create_import_hook_from_entrypoint(entrypoint):
+    def import_hook(module):
+        __import__(entrypoint.module_name)
+        callback = sys.modules[entrypoint.module_name]
+        for attr in entrypoint.attrs:
+            callback = getattr(callback, attr)
+        return callback(module)
+    return import_hook
+
+def discover_post_import_hooks(group):
+    try:
+        import pkg_resources
+    except ImportError:
+        return
+
+    for entrypoint in pkg_resources.iter_entry_points(group=group):
+        callback = _create_import_hook_from_entrypoint(entrypoint)
+        register_post_import_hook(callback, entrypoint.name)
+
+# Indicate that a module has been loaded. Any post import hooks which
+# were registered against the target module will be invoked. If an
+# exception is raised in any of the post import hooks, that will cause
+# the import of the target module to fail.
+
+def notify_module_loaded(module):
+    name = getattr(module, '__name__', None)
+
+    with _post_import_hooks_lock:
+        hooks = _post_import_hooks.pop(name, ())
+
+    # Note that the hook is called outside of the lock to avoid deadlocks if
+    # code run as a consequence of calling the module import hook in turn
+    # triggers a separate thread which tries to register an import hook.
+
+    for hook in hooks:
+        hook(module)
+
+# A custom module import finder. This intercepts attempts to import
+# modules and watches out for attempts to import target modules of
+# interest. When a module of interest is imported, then any post import
+# hooks which are registered will be invoked.
+
+class _ImportHookLoader:
+
+    def load_module(self, fullname):
+        module = sys.modules[fullname]
+        notify_module_loaded(module)
+
+        return module
+
+class _ImportHookChainedLoader:
+
+    def __init__(self, loader):
+        self.loader = loader
+
+        if hasattr(loader, "load_module"):
+          self.load_module = self._load_module
+        if hasattr(loader, "create_module"):
+          self.create_module = self._create_module
+        if hasattr(loader, "exec_module"):
+          self.exec_module = self._exec_module
+
+    def _set_loader(self, module):
+        # Set module's loader to self.loader unless it's already set to
+        # something else. Import machinery will set it to spec.loader if it is
+        # None, so handle None as well. The module may not support attribute
+        # assignment, in which case we simply skip it. Note that we also deal
+        # with __loader__ not existing at all. This is to future proof things
+        # due to proposal to remove the attribue as described in the GitHub
+        # issue at https://github.com/python/cpython/issues/77458. Also prior
+        # to Python 3.3, the __loader__ attribute was only set if a custom
+        # module loader was used. It isn't clear whether the attribute still
+        # existed in that case or was set to None.
+
+        class UNDEFINED: pass
+
+        if getattr(module, "__loader__", UNDEFINED) in (None, self):
+            try:
+                module.__loader__ = self.loader
+            except AttributeError:
+                pass
+
+        if (getattr(module, "__spec__", None) is not None
+                and getattr(module.__spec__, "loader", None) is self):
+            module.__spec__.loader = self.loader
+
+    def _load_module(self, fullname):
+        module = self.loader.load_module(fullname)
+        self._set_loader(module)
+        notify_module_loaded(module)
+
+        return module
+
+    # Python 3.4 introduced create_module() and exec_module() instead of
+    # load_module() alone. Splitting the two steps.
+
+    def _create_module(self, spec):
+        return self.loader.create_module(spec)
+
+    def _exec_module(self, module):
+        self._set_loader(module)
+        self.loader.exec_module(module)
+        notify_module_loaded(module)
+
+class ImportHookFinder:
+
+    def __init__(self):
+        self.in_progress = {}
+
+    def find_module(self, fullname, path=None):
+        # If the module being imported is not one we have registered
+        # post import hooks for, we can return immediately. We will
+        # take no further part in the importing of this module.
+
+        with _post_import_hooks_lock:
+            if fullname not in _post_import_hooks:
+                return None
+
+        # When we are interested in a specific module, we will call back
+        # into the import system a second time to defer to the import
+        # finder that is supposed to handle the importing of the module.
+        # We set an in progress flag for the target module so that on
+        # the second time through we don't trigger another call back
+        # into the import system and cause a infinite loop.
+
+        if fullname in self.in_progress:
+            return None
+
+        self.in_progress[fullname] = True
+
+        # Now call back into the import system again.
+
+        try:
+            if not find_spec:
+                # For Python 2 we don't have much choice but to
+                # call back in to __import__(). This will
+                # actually cause the module to be imported. If no
+                # module could be found then ImportError will be
+                # raised. Otherwise we return a loader which
+                # returns the already loaded module and invokes
+                # the post import hooks.
+
+                __import__(fullname)
+
+                return _ImportHookLoader()
+
+            else:
+                # For Python 3 we need to use find_spec().loader
+                # from the importlib.util module. It doesn't actually
+                # import the target module and only finds the
+                # loader. If a loader is found, we need to return
+                # our own loader which will then in turn call the
+                # real loader to import the module and invoke the
+                # post import hooks.
+
+                loader = getattr(find_spec(fullname), "loader", None)
+
+                if loader and not isinstance(loader, _ImportHookChainedLoader):
+                    return _ImportHookChainedLoader(loader)
+
+        finally:
+            del self.in_progress[fullname]
+
+    def find_spec(self, fullname, path=None, target=None):
+        # Since Python 3.4, you are meant to implement find_spec() method
+        # instead of find_module() and since Python 3.10 you get deprecation
+        # warnings if you don't define find_spec().
+
+        # If the module being imported is not one we have registered
+        # post import hooks for, we can return immediately. We will
+        # take no further part in the importing of this module.
+
+        with _post_import_hooks_lock:
+            if fullname not in _post_import_hooks:
+                return None
+
+        # When we are interested in a specific module, we will call back
+        # into the import system a second time to defer to the import
+        # finder that is supposed to handle the importing of the module.
+        # We set an in progress flag for the target module so that on
+        # the second time through we don't trigger another call back
+        # into the import system and cause a infinite loop.
+
+        if fullname in self.in_progress:
+            return None
+
+        self.in_progress[fullname] = True
+
+        # Now call back into the import system again.
+
+        try:
+            # This should only be Python 3 so find_spec() should always
+            # exist so don't need to check.
+
+            spec = find_spec(fullname)
+            loader = getattr(spec, "loader", None)
+
+            if loader and not isinstance(loader, _ImportHookChainedLoader):
+                spec.loader = _ImportHookChainedLoader(loader)
+
+            return spec
+
+        finally:
+            del self.in_progress[fullname]
+
+# Decorator for marking that a function should be called as a post
+# import hook when the target module is imported.
+
+def when_imported(name):
+    def register(hook):
+        register_post_import_hook(hook, name)
+        return hook
+    return register
diff --git a/TP03/TP03/lib/python3.9/site-packages/wrapt/wrappers.py b/TP03/TP03/lib/python3.9/site-packages/wrapt/wrappers.py
new file mode 100644
index 0000000000000000000000000000000000000000..48f334eea3b321394a609580f5ab8ef20049076d
--- /dev/null
+++ b/TP03/TP03/lib/python3.9/site-packages/wrapt/wrappers.py
@@ -0,0 +1,1016 @@
+import os
+import sys
+import functools
+import operator
+import weakref
+import inspect
+
+PY2 = sys.version_info[0] == 2
+
+if PY2:
+    string_types = basestring,
+else:
+    string_types = str,
+
+def with_metaclass(meta, *bases):
+    """Create a base class with a metaclass."""
+    return meta("NewBase", bases, {})
+
+class _ObjectProxyMethods(object):
+
+    # We use properties to override the values of __module__ and
+    # __doc__. If we add these in ObjectProxy, the derived class
+    # __dict__ will still be setup to have string variants of these
+    # attributes and the rules of descriptors means that they appear to
+    # take precedence over the properties in the base class. To avoid
+    # that, we copy the properties into the derived class type itself
+    # via a meta class. In that way the properties will always take
+    # precedence.
+
+    @property
+    def __module__(self):
+        return self.__wrapped__.__module__
+
+    @__module__.setter
+    def __module__(self, value):
+        self.__wrapped__.__module__ = value
+
+    @property
+    def __doc__(self):
+        return self.__wrapped__.__doc__
+
+    @__doc__.setter
+    def __doc__(self, value):
+        self.__wrapped__.__doc__ = value
+
+    # We similar use a property for __dict__. We need __dict__ to be
+    # explicit to ensure that vars() works as expected.
+
+    @property
+    def __dict__(self):
+        return self.__wrapped__.__dict__
+
+    # Need to also propagate the special __weakref__ attribute for case
+    # where decorating classes which will define this. If do not define
+    # it and use a function like inspect.getmembers() on a decorator
+    # class it will fail. This can't be in the derived classes.
+
+    @property
+    def __weakref__(self):
+        return self.__wrapped__.__weakref__
+
+class _ObjectProxyMetaType(type):
+    def __new__(cls, name, bases, dictionary):
+        # Copy our special properties into the class so that they
+        # always take precedence over attributes of the same name added
+        # during construction of a derived class. This is to save
+        # duplicating the implementation for them in all derived classes.
+
+        dictionary.update(vars(_ObjectProxyMethods))
+
+        return type.__new__(cls, name, bases, dictionary)
+
+class ObjectProxy(with_metaclass(_ObjectProxyMetaType)):
+
+    __slots__ = '__wrapped__'
+
+    def __init__(self, wrapped):
+        object.__setattr__(self, '__wrapped__', wrapped)
+
+        # Python 3.2+ has the __qualname__ attribute, but it does not
+        # allow it to be overridden using a property and it must instead
+        # be an actual string object instead.
+
+        try:
+            object.__setattr__(self, '__qualname__', wrapped.__qualname__)
+        except AttributeError:
+            pass
+
+        # Python 3.10 onwards also does not allow itself to be overridden
+        # using a property and it must instead be set explicitly.
+
+        try:
+            object.__setattr__(self, '__annotations__', wrapped.__annotations__)
+        except AttributeError:
+            pass
+
+    @property
+    def __name__(self):
+        return self.__wrapped__.__name__
+
+    @__name__.setter
+    def __name__(self, value):
+        self.__wrapped__.__name__ = value
+
+    @property
+    def __class__(self):
+        return self.__wrapped__.__class__
+
+    @__class__.setter
+    def __class__(self, value):
+        self.__wrapped__.__class__ = value
+
+    def __dir__(self):
+        return dir(self.__wrapped__)
+
+    def __str__(self):
+        return str(self.__wrapped__)
+
+    if not PY2:
+        def __bytes__(self):
+            return bytes(self.__wrapped__)
+
+    def __repr__(self):
+        return '<{} at 0x{:x} for {} at 0x{:x}>'.format(
+                type(self).__name__, id(self),
+                type(self.__wrapped__).__name__,
+                id(self.__wrapped__))
+
+    def __reversed__(self):
+        return reversed(self.__wrapped__)
+
+    if not PY2:
+        def __round__(self):
+            return round(self.__wrapped__)
+
+    if sys.hexversion >= 0x03070000:
+        def __mro_entries__(self, bases):
+            return (self.__wrapped__,)
+
+    def __lt__(self, other):
+        return self.__wrapped__ < other
+
+    def __le__(self, other):
+        return self.__wrapped__ <= other
+
+    def __eq__(self, other):
+        return self.__wrapped__ == other
+
+    def __ne__(self, other):
+        return self.__wrapped__ != other
+
+    def __gt__(self, other):
+        return self.__wrapped__ > other
+
+    def __ge__(self, other):
+        return self.__wrapped__ >= other
+
+    def __hash__(self):
+        return hash(self.__wrapped__)
+
+    def __nonzero__(self):
+        return bool(self.__wrapped__)
+
+    def __bool__(self):
+        return bool(self.__wrapped__)
+
+    def __setattr__(self, name, value):
+        if name.startswith('_self_'):
+            object.__setattr__(self, name, value)
+
+        elif name == '__wrapped__':
+            object.__setattr__(self, name, value)
+            try:
+                object.__delattr__(self, '__qualname__')
+            except AttributeError:
+                pass
+            try:
+                object.__setattr__(self, '__qualname__', value.__qualname__)
+            except AttributeError:
+                pass
+            try:
+                object.__delattr__(self, '__annotations__')
+            except AttributeError:
+                pass
+            try:
+                object.__setattr__(self, '__annotations__', value.__annotations__)
+            except AttributeError:
+                pass
+
+        elif name == '__qualname__':
+            setattr(self.__wrapped__, name, value)
+            object.__setattr__(self, name, value)
+
+        elif name == '__annotations__':
+            setattr(self.__wrapped__, name, value)
+            object.__setattr__(self, name, value)
+
+        elif hasattr(type(self), name):
+            object.__setattr__(self, name, value)
+
+        else:
+            setattr(self.__wrapped__, name, value)
+
+    def __getattr__(self, name):
+        # If we are being to lookup '__wrapped__' then the
+        # '__init__()' method cannot have been called.
+
+        if name == '__wrapped__':
+            raise ValueError('wrapper has not been initialised')
+
+        return getattr(self.__wrapped__, name)
+
+    def __delattr__(self, name):
+        if name.startswith('_self_'):
+            object.__delattr__(self, name)
+
+        elif name == '__wrapped__':
+            raise TypeError('__wrapped__ must be an object')
+
+        elif name == '__qualname__':
+            object.__delattr__(self, name)
+            delattr(self.__wrapped__, name)
+
+        elif hasattr(type(self), name):
+            object.__delattr__(self, name)
+
+        else:
+            delattr(self.__wrapped__, name)
+
+    def __add__(self, other):
+        return self.__wrapped__ + other
+
+    def __sub__(self, other):
+        return self.__wrapped__ - other
+
+    def __mul__(self, other):
+        return self.__wrapped__ * other
+
+    def __div__(self, other):
+        return operator.div(self.__wrapped__, other)
+
+    def __truediv__(self, other):
+        return operator.truediv(self.__wrapped__, other)
+
+    def __floordiv__(self, other):
+        return self.__wrapped__ // other
+
+    def __mod__(self, other):
+        return self.__wrapped__ % other
+
+    def __divmod__(self, other):
+        return divmod(self.__wrapped__, other)
+
+    def __pow__(self, other, *args):
+        return pow(self.__wrapped__, other, *args)
+
+    def __lshift__(self, other):
+        return self.__wrapped__ << other
+
+    def __rshift__(self, other):
+        return self.__wrapped__ >> other
+
+    def __and__(self, other):
+        return self.__wrapped__ & other
+
+    def __xor__(self, other):
+        return self.__wrapped__ ^ other
+
+    def __or__(self, other):
+        return self.__wrapped__ | other
+
+    def __radd__(self, other):
+        return other + self.__wrapped__
+
+    def __rsub__(self, other):
+        return other - self.__wrapped__
+
+    def __rmul__(self, other):
+        return other * self.__wrapped__
+
+    def __rdiv__(self, other):
+        return operator.div(other, self.__wrapped__)
+
+    def __rtruediv__(self, other):
+        return operator.truediv(other, self.__wrapped__)
+
+    def __rfloordiv__(self, other):
+        return other // self.__wrapped__
+
+    def __rmod__(self, other):
+        return other % self.__wrapped__
+
+    def __rdivmod__(self, other):
+        return divmod(other, self.__wrapped__)
+
+    def __rpow__(self, other, *args):
+        return pow(other, self.__wrapped__, *args)
+
+    def __rlshift__(self, other):
+        return other << self.__wrapped__
+
+    def __rrshift__(self, other):
+        return other >> self.__wrapped__
+
+    def __rand__(self, other):
+        return other & self.__wrapped__
+
+    def __rxor__(self, other):
+        return other ^ self.__wrapped__
+
+    def __ror__(self, other):
+        return other | self.__wrapped__
+
+    def __iadd__(self, other):
+        self.__wrapped__ += other
+        return self
+
+    def __isub__(self, other):
+        self.__wrapped__ -= other
+        return self
+
+    def __imul__(self, other):
+        self.__wrapped__ *= other
+        return self
+
+    def __idiv__(self, other):
+        self.__wrapped__ = operator.idiv(self.__wrapped__, other)
+        return self
+
+    def __itruediv__(self, other):
+        self.__wrapped__ = operator.itruediv(self.__wrapped__, other)
+        return self
+
+    def __ifloordiv__(self, other):
+        self.__wrapped__ //= other
+        return self
+
+    def __imod__(self, other):
+        self.__wrapped__ %= other
+        return self
+
+    def __ipow__(self, other):
+        self.__wrapped__ **= other
+        return self
+
+    def __ilshift__(self, other):
+        self.__wrapped__ <<= other
+        return self
+
+    def __irshift__(self, other):
+        self.__wrapped__ >>= other
+        return self
+
+    def __iand__(self, other):
+        self.__wrapped__ &= other
+        return self
+
+    def __ixor__(self, other):
+        self.__wrapped__ ^= other
+        return self
+
+    def __ior__(self, other):
+        self.__wrapped__ |= other
+        return self
+
+    def __neg__(self):
+        return -self.__wrapped__
+
+    def __pos__(self):
+        return +self.__wrapped__
+
+    def __abs__(self):
+        return abs(self.__wrapped__)
+
+    def __invert__(self):
+        return ~self.__wrapped__
+
+    def __int__(self):
+        return int(self.__wrapped__)
+
+    def __long__(self):
+        return long(self.__wrapped__)
+
+    def __float__(self):
+        return float(self.__wrapped__)
+
+    def __complex__(self):
+        return complex(self.__wrapped__)
+
+    def __oct__(self):
+        return oct(self.__wrapped__)
+
+    def __hex__(self):
+        return hex(self.__wrapped__)
+
+    def __index__(self):
+        return operator.index(self.__wrapped__)
+
+    def __len__(self):
+        return len(self.__wrapped__)
+
+    def __contains__(self, value):
+        return value in self.__wrapped__
+
+    def __getitem__(self, key):
+        return self.__wrapped__[key]
+
+    def __setitem__(self, key, value):
+        self.__wrapped__[key] = value
+
+    def __delitem__(self, key):
+        del self.__wrapped__[key]
+
+    def __getslice__(self, i, j):
+        return self.__wrapped__[i:j]
+
+    def __setslice__(self, i, j, value):
+        self.__wrapped__[i:j] = value
+
+    def __delslice__(self, i, j):
+        del self.__wrapped__[i:j]
+
+    def __enter__(self):
+        return self.__wrapped__.__enter__()
+
+    def __exit__(self, *args, **kwargs):
+        return self.__wrapped__.__exit__(*args, **kwargs)
+
+    def __iter__(self):
+        return iter(self.__wrapped__)
+
+    def __copy__(self):
+        raise NotImplementedError('object proxy must define __copy__()')
+
+    def __deepcopy__(self, memo):
+        raise NotImplementedError('object proxy must define __deepcopy__()')
+
+    def __reduce__(self):
+        raise NotImplementedError(
+                'object proxy must define __reduce_ex__()')
+
+    def __reduce_ex__(self, protocol):
+        raise NotImplementedError(
+                'object proxy must define __reduce_ex__()')
+
+class CallableObjectProxy(ObjectProxy):
+
+    def __call__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+
+        return self.__wrapped__(*args, **kwargs)
+
+class PartialCallableObjectProxy(ObjectProxy):
+
+    def __init__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+
+        if len(args) < 1:
+            raise TypeError('partial type takes at least one argument')
+
+        wrapped, args = args[0], args[1:]
+
+        if not callable(wrapped):
+            raise TypeError('the first argument must be callable')
+
+        super(PartialCallableObjectProxy, self).__init__(wrapped)
+
+        self._self_args = args
+        self._self_kwargs = kwargs
+
+    def __call__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+    
+        _args = self._self_args + args
+
+        _kwargs = dict(self._self_kwargs)
+        _kwargs.update(kwargs)
+
+        return self.__wrapped__(*_args, **_kwargs)
+
+class _FunctionWrapperBase(ObjectProxy):
+
+    __slots__ = ('_self_instance', '_self_wrapper', '_self_enabled',
+            '_self_binding', '_self_parent')
+
+    def __init__(self, wrapped, instance, wrapper, enabled=None,
+            binding='function', parent=None):
+
+        super(_FunctionWrapperBase, self).__init__(wrapped)
+
+        object.__setattr__(self, '_self_instance', instance)
+        object.__setattr__(self, '_self_wrapper', wrapper)
+        object.__setattr__(self, '_self_enabled', enabled)
+        object.__setattr__(self, '_self_binding', binding)
+        object.__setattr__(self, '_self_parent', parent)
+
+    def __get__(self, instance, owner):
+        # This method is actually doing double duty for both unbound and
+        # bound derived wrapper classes. It should possibly be broken up
+        # and the distinct functionality moved into the derived classes.
+        # Can't do that straight away due to some legacy code which is
+        # relying on it being here in this base class.
+        #
+        # The distinguishing attribute which determines whether we are
+        # being called in an unbound or bound wrapper is the parent
+        # attribute. If binding has never occurred, then the parent will
+        # be None.
+        #
+        # First therefore, is if we are called in an unbound wrapper. In
+        # this case we perform the binding.
+        #
+        # We have one special case to worry about here. This is where we
+        # are decorating a nested class. In this case the wrapped class
+        # would not have a __get__() method to call. In that case we
+        # simply return self.
+        #
+        # Note that we otherwise still do binding even if instance is
+        # None and accessing an unbound instance method from a class.
+        # This is because we need to be able to later detect that
+        # specific case as we will need to extract the instance from the
+        # first argument of those passed in.
+
+        if self._self_parent is None:
+            if not inspect.isclass(self.__wrapped__):
+                descriptor = self.__wrapped__.__get__(instance, owner)
+
+                return self.__bound_function_wrapper__(descriptor, instance,
+                        self._self_wrapper, self._self_enabled,
+                        self._self_binding, self)
+
+            return self
+
+        # Now we have the case of binding occurring a second time on what
+        # was already a bound function. In this case we would usually
+        # return ourselves again. This mirrors what Python does.
+        #
+        # The special case this time is where we were originally bound
+        # with an instance of None and we were likely an instance
+        # method. In that case we rebind against the original wrapped
+        # function from the parent again.
+
+        if self._self_instance is None and self._self_binding == 'function':
+            descriptor = self._self_parent.__wrapped__.__get__(
+                    instance, owner)
+
+            return self._self_parent.__bound_function_wrapper__(
+                    descriptor, instance, self._self_wrapper,
+                    self._self_enabled, self._self_binding,
+                    self._self_parent)
+
+        return self
+
+    def __call__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+
+        # If enabled has been specified, then evaluate it at this point
+        # and if the wrapper is not to be executed, then simply return
+        # the bound function rather than a bound wrapper for the bound
+        # function. When evaluating enabled, if it is callable we call
+        # it, otherwise we evaluate it as a boolean.
+
+        if self._self_enabled is not None:
+            if callable(self._self_enabled):
+                if not self._self_enabled():
+                    return self.__wrapped__(*args, **kwargs)
+            elif not self._self_enabled:
+                return self.__wrapped__(*args, **kwargs)
+
+        # This can occur where initial function wrapper was applied to
+        # a function that was already bound to an instance. In that case
+        # we want to extract the instance from the function and use it.
+
+        if self._self_binding in ('function', 'classmethod'):
+            if self._self_instance is None:
+                instance = getattr(self.__wrapped__, '__self__', None)
+                if instance is not None:
+                    return self._self_wrapper(self.__wrapped__, instance,
+                            args, kwargs)
+
+        # This is generally invoked when the wrapped function is being
+        # called as a normal function and is not bound to a class as an
+        # instance method. This is also invoked in the case where the
+        # wrapped function was a method, but this wrapper was in turn
+        # wrapped using the staticmethod decorator.
+
+        return self._self_wrapper(self.__wrapped__, self._self_instance,
+                args, kwargs)
+
+    def __set_name__(self, owner, name):
+        # This is a special method use to supply information to
+        # descriptors about what the name of variable in a class
+        # definition is. Not wanting to add this to ObjectProxy as not
+        # sure of broader implications of doing that. Thus restrict to
+        # FunctionWrapper used by decorators.
+
+        if hasattr(self.__wrapped__, "__set_name__"):
+            self.__wrapped__.__set_name__(owner, name)
+
+    def __instancecheck__(self, instance):
+        # This is a special method used by isinstance() to make checks
+        # instance of the `__wrapped__`.
+        return isinstance(instance, self.__wrapped__)
+
+    def __subclasscheck__(self, subclass):
+        # This is a special method used by issubclass() to make checks
+        # about inheritance of classes. We need to upwrap any object
+        # proxy. Not wanting to add this to ObjectProxy as not sure of
+        # broader implications of doing that. Thus restrict to
+        # FunctionWrapper used by decorators.
+
+        if hasattr(subclass, "__wrapped__"):
+            return issubclass(subclass.__wrapped__, self.__wrapped__)
+        else:
+            return issubclass(subclass, self.__wrapped__)
+
+class BoundFunctionWrapper(_FunctionWrapperBase):
+
+    def __call__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+
+        # If enabled has been specified, then evaluate it at this point
+        # and if the wrapper is not to be executed, then simply return
+        # the bound function rather than a bound wrapper for the bound
+        # function. When evaluating enabled, if it is callable we call
+        # it, otherwise we evaluate it as a boolean.
+
+        if self._self_enabled is not None:
+            if callable(self._self_enabled):
+                if not self._self_enabled():
+                    return self.__wrapped__(*args, **kwargs)
+            elif not self._self_enabled:
+                return self.__wrapped__(*args, **kwargs)
+
+        # We need to do things different depending on whether we are
+        # likely wrapping an instance method vs a static method or class
+        # method.
+
+        if self._self_binding == 'function':
+            if self._self_instance is None:
+                # This situation can occur where someone is calling the
+                # instancemethod via the class type and passing the instance
+                # as the first argument. We need to shift the args before
+                # making the call to the wrapper and effectively bind the
+                # instance to the wrapped function using a partial so the
+                # wrapper doesn't see anything as being different.
+
+                if not args:
+                    raise TypeError('missing 1 required positional argument')
+
+                instance, args = args[0], args[1:]
+                wrapped = PartialCallableObjectProxy(self.__wrapped__, instance)
+                return self._self_wrapper(wrapped, instance, args, kwargs)
+
+            return self._self_wrapper(self.__wrapped__, self._self_instance,
+                    args, kwargs)
+
+        else:
+            # As in this case we would be dealing with a classmethod or
+            # staticmethod, then _self_instance will only tell us whether
+            # when calling the classmethod or staticmethod they did it via an
+            # instance of the class it is bound to and not the case where
+            # done by the class type itself. We thus ignore _self_instance
+            # and use the __self__ attribute of the bound function instead.
+            # For a classmethod, this means instance will be the class type
+            # and for a staticmethod it will be None. This is probably the
+            # more useful thing we can pass through even though we loose
+            # knowledge of whether they were called on the instance vs the
+            # class type, as it reflects what they have available in the
+            # decoratored function.
+
+            instance = getattr(self.__wrapped__, '__self__', None)
+
+            return self._self_wrapper(self.__wrapped__, instance, args,
+                    kwargs)
+
+class FunctionWrapper(_FunctionWrapperBase):
+
+    __bound_function_wrapper__ = BoundFunctionWrapper
+
+    def __init__(self, wrapped, wrapper, enabled=None):
+        # What it is we are wrapping here could be anything. We need to
+        # try and detect specific cases though. In particular, we need
+        # to detect when we are given something that is a method of a
+        # class. Further, we need to know when it is likely an instance
+        # method, as opposed to a class or static method. This can
+        # become problematic though as there isn't strictly a fool proof
+        # method of knowing.
+        #
+        # The situations we could encounter when wrapping a method are:
+        #
+        # 1. The wrapper is being applied as part of a decorator which
+        # is a part of the class definition. In this case what we are
+        # given is the raw unbound function, classmethod or staticmethod
+        # wrapper objects.
+        #
+        # The problem here is that we will not know we are being applied
+        # in the context of the class being set up. This becomes
+        # important later for the case of an instance method, because in
+        # that case we just see it as a raw function and can't
+        # distinguish it from wrapping a normal function outside of
+        # a class context.
+        #
+        # 2. The wrapper is being applied when performing monkey
+        # patching of the class type afterwards and the method to be
+        # wrapped was retrieved direct from the __dict__ of the class
+        # type. This is effectively the same as (1) above.
+        #
+        # 3. The wrapper is being applied when performing monkey
+        # patching of the class type afterwards and the method to be
+        # wrapped was retrieved from the class type. In this case
+        # binding will have been performed where the instance against
+        # which the method is bound will be None at that point.
+        #
+        # This case is a problem because we can no longer tell if the
+        # method was a static method, plus if using Python3, we cannot
+        # tell if it was an instance method as the concept of an
+        # unnbound method no longer exists.
+        #
+        # 4. The wrapper is being applied when performing monkey
+        # patching of an instance of a class. In this case binding will
+        # have been perfomed where the instance was not None.
+        #
+        # This case is a problem because we can no longer tell if the
+        # method was a static method.
+        #
+        # Overall, the best we can do is look at the original type of the
+        # object which was wrapped prior to any binding being done and
+        # see if it is an instance of classmethod or staticmethod. In
+        # the case where other decorators are between us and them, if
+        # they do not propagate the __class__  attribute so that the
+        # isinstance() checks works, then likely this will do the wrong
+        # thing where classmethod and staticmethod are used.
+        #
+        # Since it is likely to be very rare that anyone even puts
+        # decorators around classmethod and staticmethod, likelihood of
+        # that being an issue is very small, so we accept it and suggest
+        # that those other decorators be fixed. It is also only an issue
+        # if a decorator wants to actually do things with the arguments.
+        #
+        # As to not being able to identify static methods properly, we
+        # just hope that that isn't something people are going to want
+        # to wrap, or if they do suggest they do it the correct way by
+        # ensuring that it is decorated in the class definition itself,
+        # or patch it in the __dict__ of the class type.
+        #
+        # So to get the best outcome we can, whenever we aren't sure what
+        # it is, we label it as a 'function'. If it was already bound and
+        # that is rebound later, we assume that it will be an instance
+        # method and try an cope with the possibility that the 'self'
+        # argument it being passed as an explicit argument and shuffle
+        # the arguments around to extract 'self' for use as the instance.
+
+        if isinstance(wrapped, classmethod):
+            binding = 'classmethod'
+
+        elif isinstance(wrapped, staticmethod):
+            binding = 'staticmethod'
+
+        elif hasattr(wrapped, '__self__'):
+            if inspect.isclass(wrapped.__self__):
+                binding = 'classmethod'
+            else:
+                binding = 'function'
+
+        else:
+            binding = 'function'
+
+        super(FunctionWrapper, self).__init__(wrapped, None, wrapper,
+                enabled, binding)
+
+try:
+    if not os.environ.get('WRAPT_DISABLE_EXTENSIONS'):
+        from ._wrappers import (ObjectProxy, CallableObjectProxy,
+            PartialCallableObjectProxy, FunctionWrapper,
+            BoundFunctionWrapper, _FunctionWrapperBase)
+except ImportError:
+    pass
+
+# Helper functions for applying wrappers to existing functions.
+
+def resolve_path(module, name):
+    if isinstance(module, string_types):
+        __import__(module)
+        module = sys.modules[module]
+
+    parent = module
+
+    path = name.split('.')
+    attribute = path[0]
+
+    # We can't just always use getattr() because in doing
+    # that on a class it will cause binding to occur which
+    # will complicate things later and cause some things not
+    # to work. For the case of a class we therefore access
+    # the __dict__ directly. To cope though with the wrong
+    # class being given to us, or a method being moved into
+    # a base class, we need to walk the class hierarchy to
+    # work out exactly which __dict__ the method was defined
+    # in, as accessing it from __dict__ will fail if it was
+    # not actually on the class given. Fallback to using
+    # getattr() if we can't find it. If it truly doesn't
+    # exist, then that will fail.
+
+    def lookup_attribute(parent, attribute):
+        if inspect.isclass(parent):
+            for cls in inspect.getmro(parent):
+                if attribute in vars(cls):
+                    return vars(cls)[attribute]
+            else:
+                return getattr(parent, attribute)
+        else:
+            return getattr(parent, attribute)
+
+    original = lookup_attribute(parent, attribute)
+
+    for attribute in path[1:]:
+        parent = original
+        original = lookup_attribute(parent, attribute)
+
+    return (parent, attribute, original)
+
+def apply_patch(parent, attribute, replacement):
+    setattr(parent, attribute, replacement)
+
+def wrap_object(module, name, factory, args=(), kwargs={}):
+    (parent, attribute, original) = resolve_path(module, name)
+    wrapper = factory(original, *args, **kwargs)
+    apply_patch(parent, attribute, wrapper)
+    return wrapper
+
+# Function for applying a proxy object to an attribute of a class
+# instance. The wrapper works by defining an attribute of the same name
+# on the class which is a descriptor and which intercepts access to the
+# instance attribute. Note that this cannot be used on attributes which
+# are themselves defined by a property object.
+
+class AttributeWrapper(object):
+
+    def __init__(self, attribute, factory, args, kwargs):
+        self.attribute = attribute
+        self.factory = factory
+        self.args = args
+        self.kwargs = kwargs
+
+    def __get__(self, instance, owner):
+        value = instance.__dict__[self.attribute]
+        return self.factory(value, *self.args, **self.kwargs)
+
+    def __set__(self, instance, value):
+        instance.__dict__[self.attribute] = value
+
+    def __delete__(self, instance):
+        del instance.__dict__[self.attribute]
+
+def wrap_object_attribute(module, name, factory, args=(), kwargs={}):
+    path, attribute = name.rsplit('.', 1)
+    parent = resolve_path(module, path)[2]
+    wrapper = AttributeWrapper(attribute, factory, args, kwargs)
+    apply_patch(parent, attribute, wrapper)
+    return wrapper
+
+# Functions for creating a simple decorator using a FunctionWrapper,
+# plus short cut functions for applying wrappers to functions. These are
+# for use when doing monkey patching. For a more featured way of
+# creating decorators see the decorator decorator instead.
+
+def function_wrapper(wrapper):
+    def _wrapper(wrapped, instance, args, kwargs):
+        target_wrapped = args[0]
+        if instance is None:
+            target_wrapper = wrapper
+        elif inspect.isclass(instance):
+            target_wrapper = wrapper.__get__(None, instance)
+        else:
+            target_wrapper = wrapper.__get__(instance, type(instance))
+        return FunctionWrapper(target_wrapped, target_wrapper)
+    return FunctionWrapper(wrapper, _wrapper)
+
+def wrap_function_wrapper(module, name, wrapper):
+    return wrap_object(module, name, FunctionWrapper, (wrapper,))
+
+def patch_function_wrapper(module, name):
+    def _wrapper(wrapper):
+        return wrap_object(module, name, FunctionWrapper, (wrapper,))
+    return _wrapper
+
+def transient_function_wrapper(module, name):
+    def _decorator(wrapper):
+        def _wrapper(wrapped, instance, args, kwargs):
+            target_wrapped = args[0]
+            if instance is None:
+                target_wrapper = wrapper
+            elif inspect.isclass(instance):
+                target_wrapper = wrapper.__get__(None, instance)
+            else:
+                target_wrapper = wrapper.__get__(instance, type(instance))
+            def _execute(wrapped, instance, args, kwargs):
+                (parent, attribute, original) = resolve_path(module, name)
+                replacement = FunctionWrapper(original, target_wrapper)
+                setattr(parent, attribute, replacement)
+                try:
+                    return wrapped(*args, **kwargs)
+                finally:
+                    setattr(parent, attribute, original)
+            return FunctionWrapper(target_wrapped, _execute)
+        return FunctionWrapper(wrapper, _wrapper)
+    return _decorator
+
+# A weak function proxy. This will work on instance methods, class
+# methods, static methods and regular functions. Special treatment is
+# needed for the method types because the bound method is effectively a
+# transient object and applying a weak reference to one will immediately
+# result in it being destroyed and the weakref callback called. The weak
+# reference is therefore applied to the instance the method is bound to
+# and the original function. The function is then rebound at the point
+# of a call via the weak function proxy.
+
+def _weak_function_proxy_callback(ref, proxy, callback):
+    if proxy._self_expired:
+        return
+
+    proxy._self_expired = True
+
+    # This could raise an exception. We let it propagate back and let
+    # the weakref.proxy() deal with it, at which point it generally
+    # prints out a short error message direct to stderr and keeps going.
+
+    if callback is not None:
+        callback(proxy)
+
+class WeakFunctionProxy(ObjectProxy):
+
+    __slots__ = ('_self_expired', '_self_instance')
+
+    def __init__(self, wrapped, callback=None):
+        # We need to determine if the wrapped function is actually a
+        # bound method. In the case of a bound method, we need to keep a
+        # reference to the original unbound function and the instance.
+        # This is necessary because if we hold a reference to the bound
+        # function, it will be the only reference and given it is a
+        # temporary object, it will almost immediately expire and
+        # the weakref callback triggered. So what is done is that we
+        # hold a reference to the instance and unbound function and
+        # when called bind the function to the instance once again and
+        # then call it. Note that we avoid using a nested function for
+        # the callback here so as not to cause any odd reference cycles.
+
+        _callback = callback and functools.partial(
+                _weak_function_proxy_callback, proxy=self,
+                callback=callback)
+
+        self._self_expired = False
+
+        if isinstance(wrapped, _FunctionWrapperBase):
+            self._self_instance = weakref.ref(wrapped._self_instance,
+                    _callback)
+
+            if wrapped._self_parent is not None:
+                super(WeakFunctionProxy, self).__init__(
+                        weakref.proxy(wrapped._self_parent, _callback))
+
+            else:
+                super(WeakFunctionProxy, self).__init__(
+                        weakref.proxy(wrapped, _callback))
+
+            return
+
+        try:
+            self._self_instance = weakref.ref(wrapped.__self__, _callback)
+
+            super(WeakFunctionProxy, self).__init__(
+                    weakref.proxy(wrapped.__func__, _callback))
+
+        except AttributeError:
+            self._self_instance = None
+
+            super(WeakFunctionProxy, self).__init__(
+                    weakref.proxy(wrapped, _callback))
+
+    def __call__(*args, **kwargs):
+        def _unpack_self(self, *args):
+            return self, args
+
+        self, args = _unpack_self(*args)
+
+        # We perform a boolean check here on the instance and wrapped
+        # function as that will trigger the reference error prior to
+        # calling if the reference had expired.
+
+        instance = self._self_instance and self._self_instance()
+        function = self.__wrapped__ and self.__wrapped__
+
+        # If the wrapped function was originally a bound function, for
+        # which we retained a reference to the instance and the unbound
+        # function we need to rebind the function and then call it. If
+        # not just called the wrapped function.
+
+        if instance is None:
+            return self.__wrapped__(*args, **kwargs)
+
+        return function.__get__(instance, type(instance))(*args, **kwargs)
diff --git a/TP03/TP03/lib64 b/TP03/TP03/lib64
new file mode 120000
index 0000000000000000000000000000000000000000..7951405f85a569efbacc12fccfee529ef1866602
--- /dev/null
+++ b/TP03/TP03/lib64
@@ -0,0 +1 @@
+lib
\ No newline at end of file
diff --git a/TP03/TP03/pyvenv.cfg b/TP03/TP03/pyvenv.cfg
new file mode 100644
index 0000000000000000000000000000000000000000..5c102c1f348763a31ae260cddad1b2ec73fac247
--- /dev/null
+++ b/TP03/TP03/pyvenv.cfg
@@ -0,0 +1,3 @@
+home = /usr/bin
+include-system-site-packages = false
+version = 3.9.2
diff --git a/TP03/TP03/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..6ef9423855100871b18e22e764ce5dfdb1924328
Binary files /dev/null and b/TP03/TP03/share/python-wheels/CacheControl-0.12.6-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/appdirs-1.4.4-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/appdirs-1.4.4-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..24590035eb25f9084cb5a610893678047e92c71f
Binary files /dev/null and b/TP03/TP03/share/python-wheels/appdirs-1.4.4-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/certifi-2020.6.20-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/certifi-2020.6.20-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..9f6ebc60c024b4bac368f060c14dfa42a2c359f8
Binary files /dev/null and b/TP03/TP03/share/python-wheels/certifi-2020.6.20-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/chardet-4.0.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/chardet-4.0.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..c120243cd78f3a0b447755ef84bfca8ad6e4034c
Binary files /dev/null and b/TP03/TP03/share/python-wheels/chardet-4.0.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/colorama-0.4.4-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/colorama-0.4.4-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..d38d3a004bc254ddd8ab5fbb6bcc1d9fbed1bf55
Binary files /dev/null and b/TP03/TP03/share/python-wheels/colorama-0.4.4-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/contextlib2-0.6.0.post1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/contextlib2-0.6.0.post1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..d1dca5f37268dbafa89511a8e8dbcc6a16786b60
Binary files /dev/null and b/TP03/TP03/share/python-wheels/contextlib2-0.6.0.post1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/distlib-0.3.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/distlib-0.3.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..6503b96b49bad7c5a887a2daf53cc5913426dc54
Binary files /dev/null and b/TP03/TP03/share/python-wheels/distlib-0.3.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..3708fe7373b195a390e349e7043e6b6b0e15b75c
Binary files /dev/null and b/TP03/TP03/share/python-wheels/distro-1.5.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/html5lib-1.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/html5lib-1.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..fb5e80c07c9526ad81d3c110fa26aace581ff328
Binary files /dev/null and b/TP03/TP03/share/python-wheels/html5lib-1.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/idna-2.10-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/idna-2.10-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..0ba1ddac371b09197ec3c1f4f109d49a5d99fd27
Binary files /dev/null and b/TP03/TP03/share/python-wheels/idna-2.10-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..98157fa9925322bd80c662d466db65c5c162aaee
Binary files /dev/null and b/TP03/TP03/share/python-wheels/ipaddr-2.2.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/msgpack-1.0.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/msgpack-1.0.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..e761172fd87d6d25024a8474f21e50798c71bd6c
Binary files /dev/null and b/TP03/TP03/share/python-wheels/msgpack-1.0.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/packaging-20.9-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/packaging-20.9-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..e6598ec41084d5a846eaf95d24ff2a0e3ad2c3c2
Binary files /dev/null and b/TP03/TP03/share/python-wheels/packaging-20.9-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/pep517-0.9.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/pep517-0.9.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..d870913f54c63d5c3876129fe04815732e267a87
Binary files /dev/null and b/TP03/TP03/share/python-wheels/pep517-0.9.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/pip-20.3.4-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/pip-20.3.4-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..51cafb99cfbc1a225e58a5f988bbb412d481e9d3
Binary files /dev/null and b/TP03/TP03/share/python-wheels/pip-20.3.4-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..72e02ffaf4cb9145532154d25e693e615c0f32a8
Binary files /dev/null and b/TP03/TP03/share/python-wheels/pkg_resources-0.0.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/progress-1.5-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/progress-1.5-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..7f58777ec733636fd11cdb88ddec7280ab6f1a3d
Binary files /dev/null and b/TP03/TP03/share/python-wheels/progress-1.5-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/pyparsing-2.4.7-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/pyparsing-2.4.7-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..9ff2e000c380ed0df8fa380ece0e1983faaf43e6
Binary files /dev/null and b/TP03/TP03/share/python-wheels/pyparsing-2.4.7-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/requests-2.25.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/requests-2.25.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..eb382f75ed3c1414ade801f63f661a140dd639f8
Binary files /dev/null and b/TP03/TP03/share/python-wheels/requests-2.25.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..cd8f0de8f551d86aca25beebd4f7fdf29cdf0afb
Binary files /dev/null and b/TP03/TP03/share/python-wheels/resolvelib-0.5.4-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..e2f8ffa8c2f4e881d0202e4a3e6525e93471049e
Binary files /dev/null and b/TP03/TP03/share/python-wheels/retrying-1.3.3-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/setuptools-44.1.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/setuptools-44.1.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..e3d6e08b4c62ccdd1e0b0b71da52b77c8ed84827
Binary files /dev/null and b/TP03/TP03/share/python-wheels/setuptools-44.1.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/six-1.16.0-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/six-1.16.0-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..574b3abb54d1df11fc943edcf61b7fbb22e59b0b
Binary files /dev/null and b/TP03/TP03/share/python-wheels/six-1.16.0-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/toml-0.10.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/toml-0.10.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..3b1cbcb4f4efea1f93aa08677bb5d74f09f8bac3
Binary files /dev/null and b/TP03/TP03/share/python-wheels/toml-0.10.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..b17a8e84d96ebcfa4b8eff9f41ac01f28a1bf0bf
Binary files /dev/null and b/TP03/TP03/share/python-wheels/urllib3-1.26.5-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..0a83fdd9fdca0723d096afb4e164eb0e9f674986
Binary files /dev/null and b/TP03/TP03/share/python-wheels/webencodings-0.5.1-py2.py3-none-any.whl differ
diff --git a/TP03/TP03/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl b/TP03/TP03/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl
new file mode 100644
index 0000000000000000000000000000000000000000..3fcb11b3416016defd18648b2983c69ef8f28ab0
Binary files /dev/null and b/TP03/TP03/share/python-wheels/wheel-0.34.2-py2.py3-none-any.whl differ
diff --git a/TP03/names.py b/TP03/names.py
new file mode 100755
index 0000000000000000000000000000000000000000..cf4059923e1aa0a9f263afd8b9211c9c4019bea9
--- /dev/null
+++ b/TP03/names.py
@@ -0,0 +1,6 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+from fabric import SerialGroup as Group
+
+hosts = [ f"teck{nb:02d}" for nb in range(1, 27) ]
+salle = Group(*hosts)
+salle.run('hostname')
\ No newline at end of file
diff --git a/TP03/on_machine.py b/TP03/on_machine.py
new file mode 100644
index 0000000000000000000000000000000000000000..773e0cd6ed65d47b2991d87fd8ba7c57fb513424
--- /dev/null
+++ b/TP03/on_machine.py
@@ -0,0 +1,16 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+from pathlib import Path
+import os
+
+vdi = []
+def find_boxes(USER=None, size=True):
+    if USER==None or USER=="None":
+        USER= os.getlogin()
+    path= Path(f"/usr/local/virtual_machine/infoetu/{USER}/")
+    vdi = [file for file in path.glob('**/*') if file.suffix in ('.vdi', '.vmdk')]
+    for file in vdi:
+        if(size == True):
+            taille = (file.stat().st_size) / 1024 / 1024 / 1024
+            print(f"- {file.parent.name}/{file.name} ({taille:.2f} Go)")
+        else:
+            print(f"- {file.parent.name}/{file.name}")
diff --git a/TP03/requirements.txt b/TP03/requirements.txt
new file mode 100644
index 0000000000000000000000000000000000000000..6ab2a1c2f5464e1260c47aa71b4cbcc86635b76d
--- /dev/null
+++ b/TP03/requirements.txt
@@ -0,0 +1,11 @@
+bcrypt==4.0.1
+cffi==1.16.0
+cryptography==41.0.4
+decorator==5.1.1
+Deprecated==1.2.14
+fabric==3.2.2
+invoke==2.2.0
+paramiko==3.3.1
+pycparser==2.21
+PyNaCl==1.5.0
+wrapt==1.15.0
diff --git a/TP03/vms.py b/TP03/vms.py
new file mode 100755
index 0000000000000000000000000000000000000000..bbc46ce204a1548f2f0ab6f5cf0a61827d544ff3
--- /dev/null
+++ b/TP03/vms.py
@@ -0,0 +1,34 @@
+#!/home/infoetu/corentin.sotoca.etu/Documents/r5b_04/TP03/TP03/bin/python3
+import fabric,argparse
+
+salles={"ayou":26,"bouleau":26,"meleze":26,"teck":26,"frene":26,"acajou":26,"epicea":26,"hevea":26,"saule":26,"if":14,"sequoya":8,"hetre":8}
+
+# Args:
+# ----------------------
+parser = argparse.ArgumentParser()
+parser.add_argument("-s", help="Nom de la salle")
+parser.add_argument("-l", help="Précise un utilisateur a vérifier")
+parser.add_argument("--size", help="Affiche la taille occupé par la machine", action="store_true")
+args=parser.parse_args()
+# print(args)
+
+def iterateSalle(salle,login,size_b):
+    hosts = [ f"{str(salle)}{nb:02d}" for nb in range(1, salles.get(salle)+1) ]
+    fabric.Connection(hosts[0]).put("on_machine.py","on_machine.py")
+    salle = fabric.SerialGroup(*hosts)
+    #salle.put("on_machine.py")
+    salle.run(f"echo -e \"----------------\n$HOSTNAME\n----------------\";python -c 'from on_machine import *; find_boxes(\"{login}\",{size_b})'")
+    fabric.Connection(hosts[0]).run("rm on_machine.py")
+
+    
+
+# Choix de la salle
+# ----------------------
+if(args.s == None):
+    for salle in salles.keys():
+        iterateSalle(salle,args.l,args.size)
+elif(salles.get(args.s) != None): 
+    iterateSalle(args.s,args.l,args.size)
+else:
+    print("Veuillez entrer un bon argument pour le nom de la salle ou le laisser vide. La salle "+args.s+" n'existe pas.")
+